Re: callgraph not working
William Cohen <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
On 11/18/2016 07:04 AM, enrico . wrote:
> Dear all,
> I am encountering a problem when trying to produce a callgraph on Debian 8, on an x86_64 machine.
> The problem is basically what is described here: https://sourceforge.net/p/oprofile/mailman/message/24408843/
>
> Basically I cannot produce a callgraph. The solution proposed in the thread I linked (i.e. compiling with the -fno-omit-frame-pointer) does not seem to help.
>
> The symptoms: running `operf ./foo` and then `opreport -cl ./foo` outputs a callgraph made of single calls, with no depth (like in the thread linked above).
> Running `operf --callgraph ./foo` and then `opreport -cl ./foo` outputs "get_symbol_by_filepos: no symbols at all?" and aborts.
> In both cases, `opreport -l ./foo` works fine and finds the right symbols.
>
> I copy below my test program, which I compiled with gcc 4.9.2 on Debian 8, both with `gcc -fno-omit-frame-pointer -g foo.cpp` and `gcc -O0 -g foo.cpp`,
> with the results described above.
>
> Cheers,
> blue
>
>
> ##### foo.cpp #######
> void loop(unsigned int n) {
> for(unsigned int i=0; i<n; ++i);
> return;
> }
>
> void slow_f() {
> for(unsigned int i=0; i<1000000000; ++i);
> loop(1000000000);
> return;
> }
>
> int main() {
> slow_f();
> return 0;
> }
Hi,
I am not sure what is going on with the debian environment. I tried to replicate the failure on fedora 24 but did not see the problem occur as seen below in the fedora 24 output. It would be helpful to include information about the specific version of oprofile being used (opreport -v) and the precise output for the opreport command.
-Will
[wcohen@santana callgraph]$ rpm -q oprofile
oprofile-1.1.0-4.fc24.x86_64
[wcohen@santana callgraph]$ uname -r
4.8.8-200.fc24.x86_64
[wcohen@santana callgraph]$ gcc -fno-omit-frame-pointer -g foo.cpp -o ./foo
[wcohen@santana callgraph]$ operf --callgraph ./foo
operf: Profiler started
WARNING: Lost samples detected! See /home/wcohen/research/profiling/oprofile/callgraph/oprofile_data/samples/operf.log for details.
Lowering the sampling rate may reduce or eliminate lost samples.
See the '--events' option description in the operf man page for help.
Profiling done.
[wcohen@santana callgraph]$ opreport -cl ./foo -t1
Using /home/wcohen/research/profiling/oprofile/callgraph/oprofile_data/samples/ for samples directory.
WARNING: Lost samples detected! See /home/wcohen/research/profiling/oprofile/callgraph/oprofile_data/samples/operf.log for details.
warning: /drm could not be found.
warning: /kvm could not be found.
warning: /nouveau could not be found.
CPU: Intel Ivy Bridge microarchitecture, speed 3300 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 90000
samples % symbol name
-------------------------------------------------------------------------------
81671 100.000 slow_f()
81548 51.3779 loop(unsigned int)
81548 99.8494 loop(unsigned int) [self]
-------------------------------------------------------------------------------
158706 100.000 main
76549 48.2283 slow_f()
81671 51.4606 loop(unsigned int)
76549 48.2332 slow_f() [self]
-------------------------------------------------------------------------------
Compiling the code without the -fno-omit-frame-pointer still gave meaningful results:
[wcohen@santana callgraph]$ rm -rf oprofile_data/
[wcohen@santana callgraph]$ gcc -O0 -g foo.cpp -o ./foo
[wcohen@santana callgraph]$ operf --callgraph ./foo
operf: Profiler started
WARNING: Lost samples detected! See /home/wcohen/research/profiling/oprofile/callgraph/oprofile_data/samples/operf.log for details.
Lowering the sampling rate may reduce or eliminate lost samples.
See the '--events' option description in the operf man page for help.
Profiling done.
[wcohen@santana callgraph]$ opreport -cl ./foo -t1
Using /home/wcohen/research/profiling/oprofile/callgraph/oprofile_data/samples/ for samples directory.
WARNING: Lost samples detected! See /home/wcohen/research/profiling/oprofile/callgraph/oprofile_data/samples/operf.log for details.
warning: /dm_crypt could not be found.
warning: /kvm could not be found.
CPU: Intel Ivy Bridge microarchitecture, speed 3300 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 90000
samples % symbol name
-------------------------------------------------------------------------------
83714 100.000 slow_f()
83181 50.6938 loop(unsigned int)
83181 99.3633 loop(unsigned int) [self]
-------------------------------------------------------------------------------
164061 100.000 main
79763 48.6108 slow_f()
83714 51.0261 loop(unsigned int)
79763 48.6179 slow_f() [self]
-------------------------------------------------------------------------------
------------------------------------------------------------------------------