Profiling sleep times with perf

后端 未结 3 2106
野的像风
野的像风 2021-02-01 06:32

I was looking for a way to find out where my program spends time. I read the perf tutorial and tried to profile sleep times as it is described there. I wrote the simplest possib

3条回答
  •  孤街浪徒
    2021-02-01 07:23

    This works for me for "perf version 3.11.1" on an "openSUSE 13.1 (x86_64)" box.

    Here is the output if you care:

    # ========
    # captured on: Sun Feb 16 09:49:38 2014
    # hostname : *****************
    # os release : 3.11.10-7-desktop
    # perf version : 3.11.1
    # arch : x86_64
    # nrcpus online : 8
    # nrcpus avail : 8
    # cpudesc : Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz
    # cpuid : GenuineIntel,6,58,9
    # total memory : 32945368 kB
    # cmdline : /usr/bin/perf inject -v -s -i perf.data.raw -o perf.data 
    # event : name = sched:sched_stat_sleep, type = 2, config = 0x48, config1 = 0x0, config2 = 0x
    # event : name = sched:sched_switch, type = 2, config = 0x51, config1 = 0x0, config2 = 0x0, e
    # event : name = sched:sched_process_exit, type = 2, config = 0x4e, config1 = 0x0, config2 = 
    # HEADER_CPU_TOPOLOGY info available, use -I to display
    # HEADER_NUMA_TOPOLOGY info available, use -I to display
    # pmu mappings: cpu = 4, software = 1, tracepoint = 2, uncore_cbox_0 = 6, uncore_cbox_1 = 7, 
    # ========
    #
    # Samples: 0  of event 'sched:sched_stat_sleep'
    # Event count (approx.): 0
    #
    # Overhead        Period  Command  Shared Object  Symbol
    # ........  ............  .......  .............  ......
    #
    
    
    # Samples: 8  of event 'sched:sched_switch'
    # Event count (approx.): 80099958776
    #
    # Overhead        Period  Command      Shared Object             Symbol
    # ........  ............  .......  .................  .................
    #
       100.00%   80099958776      bla  [kernel.kallsyms]  [k] thread_return
                    |
                    --- thread_return
                        thread_return
                        do_nanosleep
                        hrtimer_nanosleep
                        SyS_nanosleep
                        system_call_fastpath
                        0x7fbc0dec6570
                        __GI___libc_nanosleep
                        (nil)
    
    
    
    # Samples: 0  of event 'sched:sched_process_exit'
    # Event count (approx.): 0
    #
    # Overhead        Period  Command  Shared Object  Symbol
    # ........  ............  .......  .............  ......
    #
    
    
    #
    # (For a higher level overview, try: perf report --sort comm,dso)
    #
    }
    

提交回复
热议问题