-
Notifications
You must be signed in to change notification settings - Fork 88
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
add examples to instrument RustyHermit applications #112
Conversation
- make sure that RUSTFLAGS is set correctly
- remove obsolete "instrument" feature in applications, which aren't used as instrumentation examples
- a `handle` must be use to free the buffer
99: PR hermit-os#112 requires a socket handle to consume the buffer r=stlankes a=stlankes in addition, we revised the benchmark to measure the stream bandwidth and supports now also non-blocking streams. Co-authored-by: Stefan Lankes <[email protected]>
Is compiling in release mode required for rftrace? |
No, you have to enable the feature "instrument". If you do it rftrace will be included. |
If it's not required for performance reasons, I'd suggest to compile in debug mode instead. This way commit c476784 "remove lto support [...]" is not needed and can be reverted. |
Hm, performance analysis in debug mode isn't really an option. In debug mode is the performance always bad. It is difficult to find possible performance issues. |
@stlankes In that case I'd recommend adding a new custom profile for rftrace, so that we don't have to disable lto in release mode for an optional feature. |
Can we add a custom profile for LTO? I like that @stlankes Do we really need instrumentation for all these applications? How about add one example application and put an explanation on how to use the instrument feature in the README of that application? |
@jbreitbart That's a good idea! |
All benchmarks don't use the instrument feature. Only hello_world and rusty_demo use it. |
Then why did you change pi_sequential as well? ;) But regardless: why do you want to add it to these benchmarks? |
I added a new profile to test LTO support. With following command, we optimize
However, this PR based on a unstable feature of cargo (see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#custom-named-profiles). |
Ok, I added it to the whole package "rusty_demo". :-) These aren't benchmarks, just a few examples. I want to show it by a few small examples. |
Also the profile "release-lto" depends on the release version of libhermit and build this version.
I want to add a description into the wiki. I think that only the major points should be published in the README. |
bors try |
I was referring to the README of the one instrument example, not the top level README, but if you prefer to have it all three feel free. I'll remind you once you have to update them in case of a change of the tracing. 😄 Are the examples build with tracing enabled? Can we do that as part of the CI pipeline? |
Per default tracing is disabled. But I can provide an example for the pipeline |
bors try |
tryBuild failed: |
bors try |
tryBuild failed: |
bors try |
tryBuild failed: |
bors try |
tryBuild failed: |
bors try |
🔒 Permission denied Existing reviewers: click here to make stappersg a reviewer |
I need to revise the PR. I currently I revise @tlambertz crate rftrace. It doesn't work with the latest nightly compiler. |
Compiling on latest nightly is a bit annoying. I haven't tested rftrace recently, but have been using uftrace some. Upstream LLVM changed how the mcount symbol is added, and you now have to manually specify LLVM passes. The required passes depend on the rust version. Newer versions: There might be issues with LTO and mcount as well, where inlined functions still include the mcount call. I haven't investigated anything here, just going from reports in the issue. Relevant issues are: |
Add an example to show, how we are able to trace RustyHermit applications. For instance, the following command builds the demo application with tracing support:
Afterwards, we have to create an output directory
trace
in the current working directory and run the application withinuhyve
.The outputs in the trace folder is compatible to the uftrace's Data Format. However, the file with the symbol names and their addresses are missing. In the current stage, we have to create this file by hand.
nm
can be used to create a file with all symbol addresses.Our binary, is relocatable and starts at address
0x0
. But the loader move the binary to a valid start address. Consequently, we have to add to all symbol addresses the start address of the kernel.awk
helps us to modify the start addresses:In this case, the kernel messages show that the start address is located at
0x400000
(=4194304
) and the script adds the start address to all symbol addresses.To visualize the results, we are able to use Perfetto. In this case, we have to convert the trace files to the Chrome trace viewer format as follows:
Afterwards the json file can be be uploaded to Perfetto and anaylzed.