-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 support of JITDUMP_USE_ARCH_TIMESTAMP to perfjitdump. #111359
Conversation
Thanks for adding me @tommcdon. The idea of this change seems very reasonable to me. I like the idea that it is an opt-in change as well. In terms of configuration - Do we want to control this via a separate environment variable, or do we want configuration to occur via something like the |
I think this environment variable is automatically set by perf when profiling with intel pt: Without that, |
Thanks @Kuinox. Am I understanding correctly that the scenario here is that |
Yes.
I tested just to be sure:
|
Gotcha - in that case, I think it's fine to have the environment variable control this. At the same time, we probably want to internally configure this using |
If I understand correctly, you want that this config be set via |
Are intel_pt and I agree that it would be good to extend recording timestamps as TSC to any interested profiler, rather than requiring all profilers to know to set the specific |
intel pt will only work on Intel CPUs, not AMD ones.
Here for my changes it's specifically for the perf jit dump, is it used by other profilers ? |
if (!initialized) | ||
{ | ||
#if defined(HOST_AMD64) | ||
const char* archTimestamp = getenv("JITDUMP_USE_ARCH_TIMESTAMP"); |
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.
Instead of using getenv() directly you can add this to the other config settings the runtime supports:
-
Declare a config value in configvalues.h. Here is an example that uses the 'DontPrependPrefix' flag to declare an env var without the DOTNET_ prefix:
https://github.com/dotnet/runtime/blob/main/src/coreclr/inc/clrconfigvalues.h#L426 -
Use CLRConfig::GetConfigValue(CLRConfig::) to retrieve the value. Example:
runtime/src/coreclr/vm/profilinghelper.cpp
Line 634 in cea112c
fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_PROFILING);
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 think it would have to be CLRConfigNoCache::Get("JITDUMP_USE_ARCH_TIMESTAMP", /*noprefix*/ true, &getenv)
to avoid layering issues with PAL. When this method is called with noprefix=true
, it just calls getenv
without anything extra.
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 @jkotas! - I missed the pal layering aspect in there.
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.
Does this mean i dont have to update the configvalue.h and simply change the getenv method with what @jkotas said.
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 think calling getenv
directly looks better.
+1
|
As I understand it, this new bit is orthogonal to the settings currently on PerfMapType. @brianrob were you suggesting that this new bit would show up on the PerfMapEnabled env var so now instead of 0-3 we'd have 0-7? I have been thinking about it a little differently so far:
For now I'd be content if we only implemented (1) because it sounds like the scenario which needs the new timestamp is relatively coupled with launching a single process via perf. I'd delay implementing (2) and (3) until it was clearer what is the E2E scenario is that would use it. |
Agreed that this is an orthogonal configuration bit. I was just thinking about adding one additional value (0-4) to add a new type "jitdump with rdtsc". The idea being that if other profilers end up needing to use this capability, they may not want to force end-to-end process capture invoked by the profiler itself, and may want to support attach, including using IPC. I'm ok with an incremental approach - I just want to make sure that we have the option to expose this via IPC in the future should this be necessary. |
Yep, I don't see anything here that precludes us supporting it for IPC in the future if the need arises. |
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
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
Thanks @Kuinox! |
* main: (89 commits) Add Dispose for X509Chain instance (dotnet#110740) Fix XML comment on regex split enumerator (dotnet#111572) JIT: tolerate missing InitClass map in SPMI (dotnet#111555) Build ilasm/ildasm packages for the host machine (dotnet#111512) Unicode 16.0 Support (dotnet#111469) Improve performance of interface method resolution in ILC (dotnet#103066) Fix building the host-targeting components and packing ILC (dotnet#111552) Improve JSON validation perf (dotnet#111332) Update github-merge-flow.jsonc to autoflow 9.0 to 9.0-staging (dotnet#111549) Include GPL-3 licence text in the notice (dotnet#111528) Remove explicit __compact_unwind entries from x64 assembler (dotnet#111530) Add MemoryExtensions overloads with comparer (dotnet#110197) Avoid capturing the ExecutionContext for the whole HTTP connection lifetime (dotnet#111475) Forward DefaultArtifactVisibility down from the VMR orchestrator (dotnet#111513) Fix relocs errors on riscv64 (dotnet#111317) Added JITDUMP_USE_ARCH_TIMESTAMP support. (dotnet#111359) add rcl/rcr tp and latency info (dotnet#111442) Fix stack overflow in compiler-generated state (dotnet#109207) Produce a package with the host-running ILC for repos in the VMR (dotnet#111443) Delete dead code in ilasm PE writer (dotnet#111218) ...
Fixes #110809.
They way I read the env variable is probably wrong but I have no idea how to do it.
I did find the files where lots of dotnet env variable were declared, but in this case the variable name should not follow the dotnet convention since it's a standardized env variable to configure this setting.