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

FR pgcollect: add -a "all cpus" option - or similar #23

Open
GitMensch opened this issue Nov 28, 2022 · 4 comments
Open

FR pgcollect: add -a "all cpus" option - or similar #23

GitMensch opened this issue Nov 28, 2022 · 4 comments

Comments

@GitMensch
Copy link
Contributor

The option to limit the recording (in perf only "by event" or "by user name/id") would be necessary, too (username/id would be fine, "by binary" would be extra cool, "by text match in command line" would be even better).

pgconvert could then use a single "logical" "collection" as root (if necessary) and then the PIDs as logical sub-notes - before adding the appropriate stack; pginfo would provide some details on the PIDs collected.

A feature like this is the one part that is missing most compared to "plain perf" or its rcording + conversion to callgrind format (which misses details but most important "eats CPU like an end-boss").

@ostash
Copy link
Owner

ostash commented Nov 28, 2022

This is not so easy. perfgrind was created to see callgraphs, and there is no calls between different unrelated processes. You can get take a look on flat profile, but this is already available with standard 'perf'.

Another option is to generated distinct callgraphs for each PID separately, but for system wide profiling this will end with huge number of files, each distinct one for each process running in the system. I do not think anybody is interested in this.

Usually people identify processes they are interested in and then focus on them.

On side note there is "bug" in pgcollect regarding how it handles forks, see here:

perfgrind/TODO

Lines 10 to 13 in 485b3f7

- create several profiles from collected data. If we collect samples by forking
new process, we have to enable inherit mode. This means that we will get
samles not only forked process, but from its children as well. We will need
to add PERF_SAMPLE_TID to sample_type and change .pgdata format.

@GitMensch
Copy link
Contributor Author

GitMensch commented Nov 28, 2022 via email

@ostash
Copy link
Owner

ostash commented Nov 29, 2022

Ok, I see the use case, however an item in TODO list should be implemented first.
I'm wondering whether some workaround is possible in meanwhile, e.g. like discussed here: https://unix.stackexchange.com/questions/688478/how-do-i-run-command-hooks-when-a-specific-process-is-started

@GitMensch
Copy link
Contributor Author

Ok, I see the use case, however an item in TODO list should be implemented first.

It would be nice to add that issue and the workaround in the TODO :-)

I've implemented the workaround as two cases

  • a script placed early in PATH that is named as the executable, which calls pgcollect with the command option using the full path for the command; con: this needs toggling PATH or placing a script in an existing entry - and don't forget to remove that later
  • specific in the place where I need that: there's a "runner script" already that executes the executable after setting up some environment variables; I've added an environment variable in front of it, that allows to "only" export the variable to pgcollect; while this works in general there's again the need to set the variable (in this case possibly the login script) and it is harder than necessary to set the a useful output file name... I'm creating "an easy" issue for that next.

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

2 participants