corefx-tools
corefx-tools copied to clipboard
PerfCollect can only profile privileged Docker processes
PerfCollect docs say that as long as a developer execs into a Docker container with --privileged, perfcollect should work, even if the container wasn't itself started with --privileged.
Instead, collection immediately stops and I get this error:
root@2ffc1d52bc5f:/app/perfcollect# ./perfcollect collect test
Collection started. Press CTRL+C to stop.
...STOPPED.
Starting post-processing. This may take some time.
zero-sized file (perf.data), nothing to do!
Generating native image symbol files
zero-sized file (perf.data), nothing to do!
libcoreclr.so not found in perf data. Please verify that your .NET Core process is running and consuming CPU.
Saving native symbols
zero-sized file (perf.data), nothing to do!
...FINISHED
Exporting perf.data file
...FINISHED
Compressing trace files
...FINISHED
Cleaning up artifacts
...FINISHED
If the container to be profiled is started initially (at docker run
time) with --privileged and --pid=host (as if I were going to be attaching LLDB), then perfcollect collection works as expected.
If perfcollect can be made to work with non-privileged containers, that would be great. Otherwise, we should update the docs to explain the necessary steps for collecting traces in a Docker container.
+1
TI was facing same issue , in my case (and in usual cases) this was happening because this perfcollect internally runs perf executable , thus if you look at line 1737 on perfcollect script :
RunSilent $perfcmd $collectionArgs
here , try to print it like :
` WriteStatus $perfcmd
WriteStatus $collectionArgs
RunSilent $perfcmd $collectionArgs
`
Now, based on output try to run that command with same output argument (should be something like $perfcmd was /usr/bin/perf & $collectionArgs were record
see if that works , as this might fail.
as usually it should be perf record -g -p
hus i modified this perfcollect script to run correct command and issue was resolved.