-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve get_metrics.py #73
Conversation
@rafzi It would be great if you could test this together with the corresponding MR in the Also feel free to suggest any other approaches @wysiwyng. |
print(" stack: " + printSz(s.usage())) | ||
print(" heap: " + printSz(h.usage())) | ||
print(" stack: " + (printSz(s.usage()) if trace_available else "unknown (missing trace file)")) | ||
print(" heap: " + (printSz(h.usage()) if trace_available else "unknown (missing trace file)")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to be able to run the get_metrics.py
script without a trace file, so just getting the ROM usage metrics from the ELF file. Is it fine implemented like (if the trace file is not found) this or should I throw an error is this is the case and eventually add an command line flag --skip-trace
to disable tracing mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it would probably be useful to (optionally) write the parsed/traced memory stats into a CSV file instead of just printing it to the terminal, as this would get rid of the need to parse the command line output for evaluating benchmarks...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine for me.
yes, i agree. we could directly output a machine readable format here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested this in the full flow and it is working as expected, thanks! Just a small comment, then this is good to merge.
The memsegs could theoretically be used more flexibly, but I don't see a use-case for this in the near future. We would then also want the access permissions of the segments in that ini file, which would tell us whether the segment could be placed in ROM or RAM. But then again, this would require some guess-work to figure out where the stack is.
For the heap, we could track all memory accesses outside of known sections (except stack space) and classify them as heap area. But I'd say the current compromise is fine.
''' | ||
|
||
# Feel free to overwrite these defaults for your needs | ||
DEFAULT_RAM_START = 0x100000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should use the same default as the example in the etiss repo, so 0x80000 and 0x80000
if not heapStart: | ||
raise RuntimeError("did not find heap start") | ||
if not stackSize: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code
print(" stack: " + printSz(s.usage())) | ||
print(" heap: " + printSz(h.usage())) | ||
print(" stack: " + (printSz(s.usage()) if trace_available else "unknown (missing trace file)")) | ||
print(" heap: " + (printSz(h.usage()) if trace_available else "unknown (missing trace file)")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine for me.
yes, i agree. we could directly output a machine readable format here.
A quick thought on the memory segments: Currently there should only be 2 of them for most (if not all) applications, but this might not be the case for some special project. You could use the ELF entry point and check in which segment this falls and assume this is ROM. With our linker scripts at least the stack begin is also defined as a symbol in the ELF file, whatever this segment falls into is most likely RAM. Also like @rafzi said, the access permissions give hints on the type of memory, these are also best read directly from the ELF file. |
@rafzi I will resolve your comments later, thank you for the review. @wysiwyng You have mentioned some good points! Would you mind if I implement the determination of the memory segments in a later PR? I would really like to implement it but currently I can not invest too much time in contributing to ETISS as I have to finish by master thesis first. |
This also adds the argparse python package as an dependency
9662941
to
6f760d7
Compare
6f760d7
to
69006de
Compare
I have implemented what was beeing discussed in #68 in addition with further smaller improvements to the
get_metrics.py
script.I had to add the argparse package as a requirement to be able to use optional command line parameters. This should hopefully not break too many existing setups...
For parsing the INI containing the memory layout, I have used the following as a reference. Can I expect that there are always 2 memory segments, the first being for ROM and the other one for RAM? If not, then I am not sure how to find out which one is which...
BTW:
heapStart
is unfortunately still relying on the symbol table.