corefx-tools
corefx-tools copied to clipboard
perfcollect terminates immediately
I'm trying to run perfcollect in a docker container following these instructions. https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/linux-performance-tracing.md
When I run ./perfcollect collect sampletrace It immediately terminates with the following output.
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
Trace saved to sampleTrace.trace.zip
I've verified that the dotnet process is running and consuming 100% CPU. The image I'm trying to run this in is microsoft/aspnetcore:2.0.8-stretch
I can't figure out why this won't run. Does anyone have any suggestions?
I was running into this issue as well, turns out perf
was failing to run which causes the script to immediately exit. Try running perf
manually to see what the error is.
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.
@cgibbons
https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/linux-performance-tracing.md#collecting-in-a-docker-container
In order to use the instructions in this document to collect a trace, spawn a new shell inside the container that is privileged.
docker exec -it --privileged <container_name> /bin/bash
I'm using Docker for Mac and I had to use the privileged flag on my container (docker run --privileged ...
) as well as when creating the shell (docker exec -it --privileged ...
)
Solved !!!
After installing perfcollect one can run this command perf record -g -p . This will let you know whether the underlying perf command is working or not. I was getting error that it was not installed properly. So I installed it via below command
RUN apt-get install -y linux-perf-4.19
This solved the purpose of perf command not found. Please ensure you installing right perf tool with respect to your linux distribution.
After this one might face issue with privileged issue as perf requires high level permission.
please refer this url on how to fix that - https://medium.com/@geekidea_81313/running-perf-in-docker-kubernetes-7eb878afcd42
I used the --privileged option while running the container.
This way I was able to proceed collecting traces using linux containers for .net core web application.
For those opting for dockerized option please refer below url for ensuring right dlls are installed https://raw.githubusercontent.com/microsoft/perfview/master/src/perfcollect/docker-demo/Dockerfile