-
Notifications
You must be signed in to change notification settings - Fork 124
[tools] add unified runtime tracing tool #444
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
Conversation
|
I also have a few other things in the pipeline for argument printing verbosity, but I didn't want to do them here due to potential conflicts with #411. Example output (it will improve once #411 is merged): |
igchor
left a comment
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.
LGTM
084b45e to
e0c026c
Compare
| # with a known good match file. | ||
| # | ||
|
|
||
| find_package(Python3 COMPONENTS Interpreter) |
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 done in the main CMakeLists.txt - do you have to run this again in this script to have python3 path defined?
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.
Yes, because this is a separate instance of the cmake process.
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/match.cmake
...
)
This starts a new cmake process to run the provided script. It's unfortunate, but that's how it works. I could replace this entire match.cmake script with a python one, which would simplify things (but that's a separate PR).
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.
Thanks, that's ok then.
| # with a known good match file. | ||
| # | ||
|
|
||
| find_package(Python3 COMPONENTS Interpreter) |
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.
Thanks, that's ok then.
| @@ -0,0 +1,136 @@ | |||
| #!/usr/bin/env python | |||
|
|
|||
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.
Could you give this file a .py extension?
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.
No, because I want it to look like a normal binary if installed in the system.
| ostr << dur.count() << "ns"; | ||
| } break; | ||
| case TIME_UNIT_US: { | ||
| std::chrono::duration<double, std::micro> d = dur; |
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.
nit: Might be more readable:
std::chrono::microseconds d = dur
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.
but it would only print whole integer microseconds, which is not useful...
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.
Oh, I missed that, sure.
| MAX_TIME_UNIT, | ||
| }; | ||
|
|
||
| const char *time_unit_str[MAX_TIME_UNIT] = {"auto", "ns", "us", "ms", "s"}; |
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.
Would making a time_unit and a const char *time_unit_str a map entry cause a performance hit here? It seems cleaner to use a map instead, however you won't be able to switch through all of the keys.
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 disagree that using a map is cleaner. This allocates no memory and is very straightforward. It's a very common pattern for mapping enum values to strings...
f83e33d to
549f701
Compare
| if args.debug: | ||
| print(result) | ||
|
|
||
| exit(result.returncode) |
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.
No empty line at EOF.
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.
That's not true? Git shows something like 'no newline at end of file' and on github in PRs there's a red bar if that's the case.
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.
That's what I meant, to add an empty newline, sorry for misconfusion.
1b3cb44 to
9ce3535
Compare
urtrace is a command-line tool for tracing and profiling Unified Runtime library calls in a process. It can be used to inspect the function arguments of each call, and provides options for filtering, output formatting, and profiling.
| ostr << dur.count() << "ns"; | ||
| } break; | ||
| case TIME_UNIT_US: { | ||
| std::chrono::duration<double, std::micro> d = dur; |
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.
Oh, I missed that, sure.
| if args.debug: | ||
| print(result) | ||
|
|
||
| exit(result.returncode) |
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.
That's what I meant, to add an empty newline, sorry for misconfusion.
urtrace is a command-line tool for tracing and profiling Unified Runtime library calls in a process. It can be used to inspect the function arguments of each call, and provides options for filtering, output formatting, and profiling.