Skip to content
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

obtaining process args for disambiguation #121

Open
vvuk opened this issue Mar 19, 2024 · 2 comments
Open

obtaining process args for disambiguation #121

vvuk opened this issue Mar 19, 2024 · 2 comments

Comments

@vvuk
Copy link
Collaborator

vvuk commented Mar 19, 2024

Unity has a complex process tree including kicking off a bunch of dotnet processes, that are lunched via dotnet exec MyProgram.dll. All of these show up just as dotnet, which is not super useful for figuring out what's what :)

I'm thinking to do a local hack for when a process name is dotnet to grab the pid and use proc_pidinfo to get the command line, but I'm unsure if it's safe to do this during TaskProfiler::new just due to it being unclear how long that operation would take. I'm assuming the risk would be some lost samples on process startup, right?

Also, if I were to generalize this to a PR, it would probably look something like an argument to record that's something like... --use_arg_for_command_name dotnet:2 which means "if the command is dotnet, use argv[2] as the recorded command name". Does that sound reasonable?

@ishitatsuyuki
Copy link
Contributor

I guess dotnet doesn't do this but if you set /proc/pid/comm of the main thread then samply will rename the process accordingly. We use this pretty extensively when profiling Wine apps.

@mstange
Copy link
Owner

mstange commented Jun 29, 2024

In #274 I added an --include-args (or --include-args=5) argument. We will see if proc_pidinfo on macOS is fast enough.

On Linux, renaming the process will still work as before; it will overwrite the old name including the arguments.

Also, if I were to generalize this to a PR, it would probably look something like an argument to record that's something like... --use_arg_for_command_name dotnet:2 which means "if the command is dotnet, use argv[2] as the recorded command name". Does that sound reasonable?

This sounds reasonable to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants