I'm using callgrind to profile a small piece of code. Callgrind output files are well generated, their content looks ok, but I'm unable to open them with kcachegrind: I get the following error message:
Could not open file "callgrind.out.4953". Check it exists and you have enough permissions to read it.
I have all permissions on files and directories they are in, but with the same issue. Also, it works well with an other project, in an other folder in the same workspace. I also precise that the processes terminate correctly in both cases.
I recently reported to the kcachegrind developer a problem with exactly the same symptoms. The problem is triggered when callgrind is used with a very long command line. This was fixed in the next versions of valgrind/callgrind and kcachegrind. Find below the commit log for the valgrind side. Waiting for the new releases of valgrind and kcachegrind, if your problem is also due to a too long command line, you can just edit the file and truncate the cmd: line. If your problem is not the length of the cmd line, then I guess you will need to use callgrind_annotate (if this work) or further investigate why kcachegrind finds your file problematic.
Author: weidendo Date: Tue Jan 10 20:21:21 2017 New Revision: 16196
Log: Add a format marker to callgrind files
KCachegrind currently uses a quick format detection before actually loading a file, and checks for a line starting with "events:" in the first 2kB for that. This obviously is fragile, as shown by an internal bug report by Philippe: before the "events" line, Callgrind puts a "cmd:" line with the command line. If this is very long, the detection fails and the file does not get loaded at all.
While KCachegrind would not need to have this quick format check at all, it is useful if multiple input format filters get supported at some point, to automatically select the correct filter.
Further, for the "file" command, for file managers and desktop environments, having an unique way to detect a file format is important.
It is not too late to fix this issue for the callgrind format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With