1. 29 8月, 2019 1 次提交
  2. 27 8月, 2019 1 次提交
  3. 26 8月, 2019 2 次提交
  4. 23 8月, 2019 2 次提交
  5. 15 8月, 2019 8 次提交
    • A
      perf evswitch: Introduce init() method to set the on/off evsels from the command line · 124e02be
      Arnaldo Carvalho de Melo 提交于
      Another step in having all the boilerplate in just one place to then use
      in the other tools.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-snreb1wmwyjei3eefwotxp1l@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      124e02be
    • A
      perf evswitch: Introduce OPTS_EVSWITCH() for cmd line processing · add3a719
      Arnaldo Carvalho de Melo 提交于
      All tools will want those, so provide a convenient way to get them.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-v16pe3sbf3wjmn152u18f649@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      add3a719
    • A
      perf evswitch: Add the names of on/off events · 0b495b12
      Arnaldo Carvalho de Melo 提交于
      So that we can have macros for the OPT_ entries and also for finding
      those in an evlist, this way other tools will use this very easily.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-q0og1xoqqi0w38ve5u0a43k2@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0b495b12
    • A
      perf evswitch: Move switch logic to use in other tools · 8829e56f
      Arnaldo Carvalho de Melo 提交于
      Now other tools that want switching can use an evswitch for that, just
      set it up and add it to the PERF_RECORD_SAMPLE processing function.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-b1trj1q97qwfv251l66q3noj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8829e56f
    • A
      perf evswitch: Move struct to a separate header to use in other tools · d2360442
      Arnaldo Carvalho de Melo 提交于
      Now that we see that the simple userspace-based "slicing" of events
      using delimiter events ("markers") works, lets move it to a separate
      header to make it available to other tools, next step will be having
      the switch on/off check done at the PERF_RECORD_SAMPLE processing
      function moved too.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-z0cyi9ifzlr37cedr9xztc1k@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2360442
    • A
      perf script: Allow specifying event to switch off processing of other events · dd41f660
      Arnaldo Carvalho de Melo 提交于
      Counterpart of --switch-on:
      
        # perf record -e sched:*,syscalls:sys_*_nanosleep sleep 1
        [ perf record: Woken up 36 times to write data ]
        [ perf record: Captured and wrote 0.032 MB perf.data (10 samples) ]
        #
        # perf script
            :20918 20918 [002] 109866.143696:            sched:sched_waking: comm=perf pid=20919 prio=120 target_cpu=001
            :20918 20918 [002] 109866.143702:            sched:sched_wakeup: perf:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109866.144081:      sched:sched_process_exec: filename=/usr/bin/sleep pid=20919 old_pid=20919
             sleep 20919 [001] 109866.144408:  syscalls:sys_enter_nanosleep: rqtp: 0x7ffc2384fef0, rmtp: 0x00000000
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109867.144614:   syscalls:sys_exit_nanosleep: 0x0
             sleep 20919 [001] 109867.144753:      sched:sched_process_exit: comm=sleep pid=20919 prio=120
        #
        # perf script --switch-off syscalls:sys_exit_nanosleep
            :20918 20918 [002] 109866.143696:            sched:sched_waking: comm=perf pid=20919 prio=120 target_cpu=001
            :20918 20918 [002] 109866.143702:            sched:sched_wakeup: perf:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109866.144081:      sched:sched_process_exec: filename=/usr/bin/sleep pid=20919 old_pid=20919
             sleep 20919 [001] 109866.144408:  syscalls:sys_enter_nanosleep: rqtp: 0x7ffc2384fef0, rmtp: 0x00000000
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109867.144753:      sched:sched_process_exit: comm=sleep pid=20919 prio=120
        #
        # perf script --switch-on syscalls:sys_enter_nanosleep --switch-off syscalls:sys_exit_nanosleep
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
        #
        # perf script --switch-on syscalls:sys_enter_nanosleep --switch-off syscalls:sys_exit_nanosleep --show-on-off
             sleep 20919 [001] 109866.144408:  syscalls:sys_enter_nanosleep: rqtp: 0x7ffc2384fef0, rmtp: 0x00000000
             sleep 20919 [001] 109866.144411:      sched:sched_stat_runtime: comm=sleep pid=20919 runtime=521249 [ns] vruntime=202919398131 [n>
             sleep 20919 [001] 109866.144412:            sched:sched_switch: sleep:20919 [120] S ==> swapper/1:0 [120]
           swapper     0 [001] 109867.144568:            sched:sched_waking: comm=sleep pid=20919 prio=120 target_cpu=001
           swapper     0 [001] 109867.144586:            sched:sched_wakeup: sleep:20919 [120] success=1 CPU:001
             sleep 20919 [001] 109867.144614:   syscalls:sys_exit_nanosleep: 0x0
        #
      
      Now think about using this together with 'perf probe' to create custom on/off
      events in your app :-)
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-li3j01c4tmj9kw6ydsl8swej@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dd41f660
    • A
      perf script: Allow showing the --switch-on event · 6469eb6d
      Arnaldo Carvalho de Melo 提交于
      One may want to see the --switch-on event as well, allow for that, using
      the previous cset example:
      
        # perf script --switch-on syscalls:sys_enter_nanosleep --show-on-off
              sleep 13638 [001] 108237.582286: syscalls:sys_enter_nanosleep: rqtp: 0x7fff1948ac40, rmtp: 0x00000000
              sleep 13638 [001] 108237.582289:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
              sleep 13638 [001] 108237.582291:           sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
            swapper     0 [001] 108238.582428:           sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
            swapper     0 [001] 108238.582458:           sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
              sleep 13638 [001] 108238.582698:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
              sleep 13638 [001] 108238.582782:     sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
        # perf script --switch-on syscalls:sys_enter_nanosleep
              sleep 13638 [001] 108237.582289:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
              sleep 13638 [001] 108237.582291:           sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
            swapper     0 [001] 108238.582428:           sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
            swapper     0 [001] 108238.582458:           sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
              sleep 13638 [001] 108238.582698:     sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
              sleep 13638 [001] 108238.582782:     sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Link: https://lkml.kernel.org/n/tip-0omwwoywj1v63gu8cz0tr0cy@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6469eb6d
    • A
      perf script: Allow specifying event to switch on processing of other events · f90a2417
      Arnaldo Carvalho de Melo 提交于
      Sometime we want to only consider events after something happens, so
      allow discarding events till such events is found, e.g.:
      
      Record all scheduler tracepoints and the sys_enter_nanosleep syscall
      event for the 'sleep 1' workload:
      
        # perf record -e sched:*,syscalls:sys_enter_nanosleep sleep 1
        [ perf record: Woken up 31 times to write data ]
        [ perf record: Captured and wrote 0.032 MB perf.data (10 samples) ]
        #
      
      So we have these events in the generated perf data file:
      
        # perf evlist
        sched:sched_kthread_stop
        sched:sched_kthread_stop_ret
        sched:sched_waking
        sched:sched_wakeup
        sched:sched_wakeup_new
        sched:sched_switch
        sched:sched_migrate_task
        sched:sched_process_free
        sched:sched_process_exit
        sched:sched_wait_task
        sched:sched_process_wait
        sched:sched_process_fork
        sched:sched_process_exec
        sched:sched_stat_wait
        sched:sched_stat_sleep
        sched:sched_stat_iowait
        sched:sched_stat_blocked
        sched:sched_stat_runtime
        sched:sched_pi_setprio
        sched:sched_move_numa
        sched:sched_stick_numa
        sched:sched_swap_numa
        sched:sched_wake_idle_without_ipi
        syscalls:sys_enter_nanosleep
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
        #
      
      Then show all of the events that actually took place in this 'perf record' session:
      
        # perf script
                :13637 13637 [002] 108237.581529:            sched:sched_waking: comm=perf pid=13638 prio=120 target_cpu=001
                :13637 13637 [002] 108237.581537:            sched:sched_wakeup: perf:13638 [120] success=1 CPU:001
                 sleep 13638 [001] 108237.581992:      sched:sched_process_exec: filename=/usr/bin/sleep pid=13638 old_pid=13638
                 sleep 13638 [001] 108237.582286:  syscalls:sys_enter_nanosleep: rqtp: 0x7fff1948ac40, rmtp: 0x00000000
                 sleep 13638 [001] 108237.582289:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
                 sleep 13638 [001] 108237.582291:            sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
               swapper     0 [001] 108238.582428:            sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
               swapper     0 [001] 108238.582458:            sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
                 sleep 13638 [001] 108238.582698:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
                 sleep 13638 [001] 108238.582782:      sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
      
      Now lets see only the ones that took place after a certain "marker":
      
        # perf script --switch-on syscalls:sys_enter_nanosleep
                 sleep 13638 [001] 108237.582289:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=578104 [ns] vruntime=202889459556 [ns]
                 sleep 13638 [001] 108237.582291:            sched:sched_switch: sleep:13638 [120] S ==> swapper/1:0 [120]
               swapper     0 [001] 108238.582428:            sched:sched_waking: comm=sleep pid=13638 prio=120 target_cpu=001
               swapper     0 [001] 108238.582458:            sched:sched_wakeup: sleep:13638 [120] success=1 CPU:001
                 sleep 13638 [001] 108238.582698:      sched:sched_stat_runtime: comm=sleep pid=13638 runtime=173915 [ns] vruntime=202889633471 [ns]
                 sleep 13638 [001] 108238.582782:      sched:sched_process_exit: comm=sleep pid=13638 prio=120
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-f1oo0ufdhrkx6nhy2lj1ierm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f90a2417
  6. 30 7月, 2019 9 次提交
  7. 23 7月, 2019 1 次提交
  8. 10 7月, 2019 1 次提交
  9. 09 7月, 2019 2 次提交
  10. 03 7月, 2019 1 次提交
    • A
      perf script: Allow specifying the files to process guest samples · 15a108af
      Arnaldo Carvalho de Melo 提交于
      The 'perf kvm' command set up things so that we can record, report, top,
      etc, but not 'script', so make 'perf script' be able to process samples
      by allowing to pass guest kallsyms, vmlinux, modules, etc, and if at
      least one of those is provided, set perf_guest to true so that guest
      samples get properly resolved.
      
      Testing it:
      
        # perf kvm --guest --guestkallsyms /wb/rhel6.kallsyms --guestmodules /wb/rhel6.modules record -e cycles:Gk
      ^C[ perf record: Woken up 7 times to write data ]
        [ perf record: Captured and wrote 3.602 MB perf.data.guest (10492 samples) ]
      
        #
        # perf evlist -i perf.data.guest
      cycles:Gk
        # perf evlist -v -i perf.data.guest
      cycles:Gk: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_user: 1, exclude_hv: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_host: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
        #
        # perf kvm --guestkallsyms /wb/rhel6.kallsyms --guestmodules /wb/rhel6.modules report --stdio -s sym | head -30
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 10K of event 'cycles:Gk'
        # Event count (approx.): 2434201408
        #
        # Overhead  Symbol
        # ........  ..............................................
        #
            11.93%  [g] avtab_search_node
             3.95%  [g] sidtab_context_to_sid
             2.41%  [g] n_tty_write
             2.20%  [g] _spin_unlock_irqrestore
             1.37%  [g] _aesni_dec4
             1.33%  [g] kmem_cache_alloc
             1.07%  [g] native_write_cr0
             0.99%  [g] kfree
             0.95%  [g] _spin_lock
             0.91%  [g] __memset
             0.87%  [g] schedule
             0.83%  [g] _spin_lock_irqsave
             0.76%  [g] __kmalloc
             0.67%  [g] avc_has_perm_noaudit
             0.66%  [g] kmem_cache_free
             0.65%  [g] glue_xts_crypt_128bit
             0.59%  [g] __d_lookup
             0.59%  [g] __audit_syscall_exit
             0.56%  [g] __memcpy
        #
      
      Then, when trying to use perf script to generate a python script and
      then process the events after adding a python hook for non-tracepoint
      events:
      
        # perf script -i perf.data.guest -g python
        generated Python script: perf-script.py
        # vim perf-script.py
        # tail -2 perf-script.py
        def process_event(param_dict):
              print(param_dict["symbol"])
        #
        # perf script -i perf.data.guest -s perf-script.py  | head
        in trace_begin
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        vmx_vmexit
        231
        #
      
      We'd see just the vmx_vmexit, i.e. the samples from the guest don't show
      up.
      
      After this patch:
      
        # perf script --guestkallsyms /wb/rhel6.kallsyms --guestmodules /wb/rhel6.modules -i perf.data.guest -s perf-script.py 2> /dev/null | head -30
        in trace_begin
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        save_args
        do_timer
        drain_array
        inode_permission
        avc_has_perm_noaudit
        run_timer_softirq
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        apic_timer_interrupt
        kvm_guest_apic_eoi_write
        run_posix_cpu_timers
        _spin_lock
        handle_pte_fault
        rcu_irq_enter
        delay_tsc
        delay_tsc
        native_read_tsc
        apic_timer_interrupt
        sys_open
        internal_add_timer
        list_del
        rcu_exit_nohz
        #
      
      Jiri Olsa noticed we need to set 'perf_guest' to true if we want to
      process guest samples and I made it be set if one of the guest files
      settings get set via the command line options added in this patch, that
      match those present in the 'perf kvm' command.
      
      We probably want to have 'perf record', 'perf report' etc to notice that
      there are guest samples and do the right thing, which is to look for
      files with some suffix that make it be associated with the guest used to
      collect the samples, i.e. if a vmlinux file is passed, we can get the
      build-id from it, if not some other identifier or simply looking for
      "kallsyms.guest", for instance, in the current directory.
      Reported-by: NMariano Pache <npache@redhat.com>
      Tested-by: NMariano Pache <npache@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: Ali Raza <alirazabhutta.10@gmail.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Larry Woodman <lwoodman@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Orran Krieger <okrieger@redhat.com>
      Cc: Ramkumar Ramachandra <artagnon@gmail.com>
      Cc: Yunlong Song <yunlong.song@huawei.com>
      Link: https://lkml.kernel.org/n/tip-d54gj64rerlxcqsrod05biwn@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      15a108af
  11. 26 6月, 2019 2 次提交
  12. 11 6月, 2019 1 次提交
  13. 05 6月, 2019 1 次提交
    • A
      perf script: Add output of IPC ratio · 68fb45bf
      Adrian Hunter 提交于
      Add field 'ipc' to display instructions-per-cycle.
      
      Example:
      
       perf record -e intel_pt/cyc/u ls
       perf script --insn-trace --xed -F+ipc,-dso,-cpu,-tid
      
       ls  2670177.697113434:  7f0dfdbcd090 _start+0x0      mov %rsp, %rdi   IPC: 0.00 (1/877)
       ls  2670177.697113434:  7f0dfdbcd093 _start+0x3      callq  0x7f0dfdbce030
       ls  2670177.697113434:  7f0dfdbce030 _dl_start+0x0   pushq  %rbp
       ls  2670177.697113434:  7f0dfdbce031 _dl_start+0x1   mov %rsp, %rbp
       ls  2670177.697113434:  7f0dfdbce034 _dl_start+0x4   pushq  %r15
       ls  2670177.697113434:  7f0dfdbce036 _dl_start+0x6   pushq  %r14
       ls  2670177.697113434:  7f0dfdbce038 _dl_start+0x8   pushq  %r13
       ls  2670177.697113434:  7f0dfdbce03a _dl_start+0xa   pushq  %r12
       ls  2670177.697113434:  7f0dfdbce03c _dl_start+0xc   mov %rdi, %r12
       ls  2670177.697113434:  7f0dfdbce03f _dl_start+0xf   pushq  %rbx
       ls  2670177.697113434:  7f0dfdbce040 _dl_start+0x10  sub $0x38, %rsp
       ls  2670177.697113434:  7f0dfdbce044 _dl_start+0x14  rdtsc
       ls  2670177.697113434:  7f0dfdbce046 _dl_start+0x16  mov %eax, %eax
       ls  2670177.697113434:  7f0dfdbce048 _dl_start+0x18  shl $0x20, %rdx
       ls  2670177.697113434:  7f0dfdbce04c _dl_start+0x1c  or %rax, %rdx
       ls  2670177.697114471:  7f0dfdbce04f _dl_start+0x1f  movq  0x27e22(%rip), %rax        IPC: 0.00 (15/1685)
       ls  2670177.697116177:  7f0dfdbce056 _dl_start+0x26  movq  %rdx, 0x27683(%rip)        IPC: 0.00 (1/881)
      
      Note, the IPC values are low due to page faults at the beginning of
      execution. The additional cycles are due to the time to enter the
      kernel, not the actual kernel page fault handler.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-9-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      68fb45bf
  14. 29 5月, 2019 2 次提交
    • J
      perf script: Add --show-bpf-events to show eBPF related events · 490c8cc9
      Jiri Olsa 提交于
      Add the --show-bpf-events command line option to show the eBPF related events:
      
        PERF_RECORD_KSYMBOL
        PERF_RECORD_BPF_EVENT
      
      Usage:
      
        # perf record -a
        ...
        # perf script --show-bpf-events
        ...
        swapper     0 [000]     0.000000: PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc0ef971d len 229 type 1 flags 0x0 name bpf_prog_2a142ef67aaad174
        swapper     0 [000]     0.000000: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 36
        ...
      
      Committer testing:
      
        # perf script --show-bpf-events | egrep -i 'PERF_RECORD_(BPF|KSY)'
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc029a6c3 len 229 type 1 flags 0x0 name bpf_prog_7be49e3934a125ba
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 47
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc029c1ae len 229 type 1 flags 0x0 name bpf_prog_2a142ef67aaad174
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 48
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc02ddd1c len 229 type 1 flags 0x0 name bpf_prog_7be49e3934a125ba
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 49
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc02dfc11 len 229 type 1 flags 0x0 name bpf_prog_2a142ef67aaad174
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 50
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc045da0a len 229 type 1 flags 0x0 name bpf_prog_7be49e3934a125ba
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 51
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc04ef4b4 len 229 type 1 flags 0x0 name bpf_prog_2a142ef67aaad174
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 52
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc09e15da len 229 type 1 flags 0x0 name bpf_prog_7be49e3934a125ba
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 53
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc0d2b1a3 len 229 type 1 flags 0x0 name bpf_prog_2a142ef67aaad174
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 54
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc0fd9850 len 381 type 1 flags 0x0 name bpf_prog_819967866022f1e1_sys_enter
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 179
          0 PERF_RECORD_KSYMBOL ksymbol event with addr ffffffffc0feb1ec len 191 type 1 flags 0x0 name bpf_prog_c1bd85c092d6e4aa_sys_exit
          0 PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 180
        ^C[root@quaco pt]# perf evlist
        intel_pt//ku
        dummy:u
        #
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Link: http://lkml.kernel.org/r/20190508132010.14512-11-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      490c8cc9
    • J
      perf script: Pad DSO name for --call-trace · 1c492422
      Jiri Olsa 提交于
      Pad the DSO name in --call-trace so we don't have the indent screwed by
      different DSO name lengths, as now for kernel there's also BPF code
      displayed.
      
        # perf-with-kcore record pt -e intel_pt//ku -- sleep 1
        # perf-core/perf-with-kcore script pt --call-trace
      
      Before:
      
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms])                      kretprobe_perf_func
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms])                          trace_call_bpf
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms])                              __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms])                                  __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806464725: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         bpf_get_current_pid_tgid
         sleep 3660 [16] 57036.806464725: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         bpf_ktime_get_ns
         sleep 3660 [16] 57036.806464725: ([kernel.kallsyms])                                          __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806464725: ([kernel.kallsyms])                                              __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806465045: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         __htab_map_lookup_elem
         sleep 3660 [16] 57036.806465366: ([kernel.kallsyms])                                          memcmp
         sleep 3660 [16] 57036.806465687: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         bpf_probe_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                          probe_kernel_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                              __check_object_size
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                                  check_stack_object
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                              copy_user_enhanced_fast_string
         sleep 3660 [16] 57036.806465687: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         bpf_probe_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                          probe_kernel_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                              __check_object_size
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                                  check_stack_object
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms])                                              copy_user_enhanced_fast_string
         sleep 3660 [16] 57036.806466008: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         bpf_get_current_uid_gid
         sleep 3660 [16] 57036.806466008: ([kernel.kallsyms])                                          from_kgid
         sleep 3660 [16] 57036.806466008: ([kernel.kallsyms])                                          from_kuid
         sleep 3660 [16] 57036.806466008: (bpf_prog_da4fe6b3d2c29b25_trace_return)                                         bpf_perf_event_output
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms])                                          perf_event_output
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms])                                              perf_prepare_sample
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms])                                                  perf_misc_flags
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms])                                                      __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms])                                                          __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806466328: ([kvm])                                                      kvm_is_in_guest
         sleep 3660 [16] 57036.806466649: ([kernel.kallsyms])                                                  __perf_event_header__init_id.isra.0
         sleep 3660 [16] 57036.806466649: ([kernel.kallsyms])                                              perf_output_begin
      
      After:
      
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms]                      )     kretprobe_perf_func
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms]                      )         trace_call_bpf
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms]                      )             __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806464404: ([kernel.kallsyms]                      )                 __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806464725: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     bpf_get_current_pid_tgid
         sleep 3660 [16] 57036.806464725: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     bpf_ktime_get_ns
         sleep 3660 [16] 57036.806464725: ([kernel.kallsyms]                      )                         __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806464725: ([kernel.kallsyms]                      )                             __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806465045: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     __htab_map_lookup_elem
         sleep 3660 [16] 57036.806465366: ([kernel.kallsyms]                      )                         memcmp
         sleep 3660 [16] 57036.806465687: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     bpf_probe_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                         probe_kernel_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                             __check_object_size
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                                 check_stack_object
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                             copy_user_enhanced_fast_string
         sleep 3660 [16] 57036.806465687: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     bpf_probe_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                         probe_kernel_read
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                             __check_object_size
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                                 check_stack_object
         sleep 3660 [16] 57036.806465687: ([kernel.kallsyms]                      )                             copy_user_enhanced_fast_string
         sleep 3660 [16] 57036.806466008: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     bpf_get_current_uid_gid
         sleep 3660 [16] 57036.806466008: ([kernel.kallsyms]                      )                         from_kgid
         sleep 3660 [16] 57036.806466008: ([kernel.kallsyms]                      )                         from_kuid
         sleep 3660 [16] 57036.806466008: (bpf_prog_da4fe6b3d2c29b25_trace_return )                     bpf_perf_event_output
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms]                      )                         perf_event_output
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms]                      )                             perf_prepare_sample
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms]                      )                                 perf_misc_flags
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms]                      )                                     __x86_indirect_thunk_rax
         sleep 3660 [16] 57036.806466328: ([kernel.kallsyms]                      )                                         __x86_indirect_thunk_rax
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Link: http://lkml.kernel.org/r/20190508132010.14512-8-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1c492422
  15. 20 3月, 2019 1 次提交
    • A
      perf script: Support relative time · 90b10f47
      Andi Kleen 提交于
      When comparing time stamps in 'perf script' traces it can be annoying to
      work with the full perf time stamps.
      
      Add a --reltime option that displays time stamps relative to the trace
      start to make it easier to read the traces.
      
      Note: not currently supported for --time. Report an error in this
      case.
      
      Before:
      
        % perf script
            swapper 0 [000] 245402.891216:    1 cycles:ppp: ffffffffa0068814 native_write_msr+0x4 ([kernel.kallsyms])
            swapper 0 [000] 245402.891223:    1 cycles:ppp: ffffffffa0068814 native_write_msr+0x4 ([kernel.kallsyms])
            swapper 0 [000] 245402.891227:    5 cycles:ppp: ffffffffa0068814 native_write_msr+0x4 ([kernel.kallsyms])
            swapper 0 [000] 245402.891231:   41 cycles:ppp: ffffffffa0068816 native_write_msr+0x6 ([kernel.kallsyms])
            swapper 0 [000] 245402.891235:  355 cycles:ppp: ffffffffa000dd51 intel_bts_enable_local+0x21 ([kernel.kallsyms])
            swapper 0 [000] 245402.891239: 3084 cycles:ppp: ffffffffa0a0150a end_repeat_nmi+0x48 ([kernel.kallsyms])
      
      After:
      
        % perf script --reltime
      
            swapper 0 [000]     0.000000:    1 cycles:ppp: ffffffffa0068814 native_write_msr+0x4 ([kernel.kallsyms])
            swapper 0 [000]     0.000006:    1 cycles:ppp: ffffffffa0068814 native_write_msr+0x4 ([kernel.kallsyms])
            swapper 0 [000]     0.000010:    5 cycles:ppp: ffffffffa0068814 native_write_msr+0x4 ([kernel.kallsyms])
            swapper 0 [000]     0.000014:   41 cycles:ppp: ffffffffa0068816 native_write_msr+0x6 ([kernel.kallsyms])
            swapper 0 [000]     0.000018:  355 cycles:ppp: ffffffffa000dd51 intel_bts_enable_local+0x21 ([kernel.kallsyms])
            swapper 0 [000]     0.000022: 3084 cycles:ppp: ffffffffa0a0150a end_repeat_nmi+0x48 ([kernel.kallsyms])
      
      Committer notes:
      
      Do not use 'time' as the name of a variable, as this breaks the build on
      older glibcs:
      
        cc1: warnings being treated as errors
        builtin-script.c: In function 'perf_sample__fprintf_start':
        builtin-script.c:691: warning: declaration of 'time' shadows a global declaration
        /usr/include/time.h:187: warning: shadowed declaration is here
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      LPU-Reference: 20190314225002.30108-8-andi@firstfloor.org
      Link: https://lkml.kernel.org/n/tip-bpahyi6pr9r399mvihu65fvc@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      90b10f47
  16. 12 3月, 2019 2 次提交
  17. 11 3月, 2019 2 次提交
    • A
      perf report: Support output in nanoseconds · 52bab886
      Andi Kleen 提交于
      Upcoming changes add timestamp output in perf report. Add a --ns
      argument similar to perf script to support nanoseconds resolution when
      needed.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20190305144758.12397-5-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      52bab886
    • A
      perf script: Support insn output for normal samples · 3ab481a1
      Andi Kleen 提交于
      perf script -F +insn was only working for PT traces because the PT
      instruction decoder was filling in the insn/insn_len sample attributes.
      Support it for non PT samples too on x86 using the existing x86
      instruction decoder.
      
      This adds some extra checking to ensure that we don't try to decode
      instructions when using perf.data from a different architecture.
      
        % perf record -a sleep 1
        % perf script -F ip,sym,insn --xed
         ffffffff811704c9 remote_function               movl  %eax, 0x18(%rbx)
         ffffffff8100bb50 intel_bts_enable_local                retq
         ffffffff81048612 native_apic_mem_write                 movl  %esi, -0xa04000(%rdi)
         ffffffff81048612 native_apic_mem_write                 movl  %esi, -0xa04000(%rdi)
         ffffffff81048612 native_apic_mem_write                 movl  %esi, -0xa04000(%rdi)
         ffffffff810f1f79 generic_exec_single           xor %eax, %eax
         ffffffff811704c9 remote_function               movl  %eax, 0x18(%rbx)
         ffffffff8100bb34 intel_bts_enable_local                movl  0x2000(%rax), %edx
         ffffffff81048610 native_apic_mem_write                 mov %edi, %edi
        ...
      
      Committer testing:
      
      Before:
      
        # perf script -F ip,sym,insn --xed | head -5
         ffffffffa4068804 native_write_msr 		addb  %al, (%rax)
         ffffffffa4068804 native_write_msr 		addb  %al, (%rax)
         ffffffffa4068804 native_write_msr 		addb  %al, (%rax)
         ffffffffa4068806 native_write_msr 		addb  %al, (%rax)
         ffffffffa4068806 native_write_msr 		addb  %al, (%rax)
        # perf script -F ip,sym,insn --xed | grep -v "addb  %al, (%rax)"
        #
      
      After:
      
        # perf script -F ip,sym,insn --xed | head -5
         ffffffffa4068804 native_write_msr 		wrmsr
         ffffffffa4068804 native_write_msr 		wrmsr
         ffffffffa4068804 native_write_msr 		wrmsr
         ffffffffa4068806 native_write_msr 		nopl  %eax, (%rax,%rax,1)
         ffffffffa4068806 native_write_msr 		nopl  %eax, (%rax,%rax,1)
        # perf script -F ip,sym,insn --xed | grep -v "addb  %al, (%rax)" | head -5
         ffffffffa4068804 native_write_msr 		wrmsr
         ffffffffa4068804 native_write_msr 		wrmsr
         ffffffffa4068804 native_write_msr 		wrmsr
         ffffffffa4068806 native_write_msr 		nopl  %eax, (%rax,%rax,1)
         ffffffffa4068806 native_write_msr 		nopl  %eax, (%rax,%rax,1)
        #
      
      More examples:
      
        # perf script -F ip,sym,insn --xed | grep -v native_write_msr | head
         ffffffffa416b90e tick_check_broadcast_expired 		btq  %rax, 0x1a5f42a(%rip)
         ffffffffa4956bd0 nmi_cpu_backtrace 		pushq  %r13
         ffffffffa415b95e __hrtimer_next_event_base 		movq  0x18(%rax), %rdx
         ffffffffa4956bf3 nmi_cpu_backtrace 		popq  %r12
         ffffffffa4171d5c smp_call_function_single 		pause
         ffffffffa4956bdd nmi_cpu_backtrace 		mov %ebp, %r12d
         ffffffffa4797e4d menu_select 		cmp $0x190, %rax
         ffffffffa4171d5c smp_call_function_single 		pause
         ffffffffa405a7d8 nmi_cpu_backtrace_handler 		callq  0xffffffffa4956bd0
         ffffffffa4797f7a menu_select 		shr $0x3, %rax
        #
      
      Which matches the annotate output modulo resolving callqs:
      
        # perf annotate --stdio2 nmi_cpu_backtrace_handler
        Samples: 4  of event 'cycles:ppp', 4000 Hz, Event count (approx.): 35908, [percent: local period]
        nmi_cpu_backtrace_handler() /lib/modules/5.0.0+/build/vmlinux
        Percent
                    Disassembly of section .text:
      
                    ffffffff8105a7d0 <nmi_cpu_backtrace_handler>:
                    nmi_cpu_backtrace_handler():
                            nmi_trigger_cpumask_backtrace(mask, exclude_self,
                                                          nmi_raise_cpu_backtrace);
                    }
      
                    static int nmi_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
                    {
         24.45      → callq  __fentry__
                            if (nmi_cpu_backtrace(regs))
                      mov    %rsi,%rdi
         75.55      → callq  nmi_cpu_backtrace
                                    return NMI_HANDLED;
                      movzbl %al,%eax
      
                            return NMI_DONE;
                    }
                    ← retq
          #
      
        # perf annotate --stdio2 __hrtimer_next_event_base
        Samples: 4  of event 'cycles:ppp', 4000 Hz, Event count (approx.): 767977, [percent: local period]
        __hrtimer_next_event_base() /lib/modules/5.0.0+/build/vmlinux
        Percent
                    Disassembly of section .text:
      
                    ffffffff8115b910 <__hrtimer_next_event_base>:
                    __hrtimer_next_event_base():
      
                    static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base,
                                                             const struct hrtimer *exclude,
                                                             unsigned int active,
                                                             ktime_t expires_next)
                    {
                    → callq  __fentry__
      <SNIP>
                4a:   add    $0x1,%r14
         77.31        mov    0x18(%rax),%rdx
                      shl    $0x6,%r14
                      sub    0x38(%rbx,%r14,1),%rdx
                                    if (expires < expires_next) {
                      cmp    %r12,%rdx
                    ↓ jge    68
      <SNIP>
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20190305144758.12397-3-andi@firstfloor.org
      [ Converted fetch_exe() to use the name it ended up having when merged: thread__memcpy() ]
      [ archinsn.c needs the instruction decoder that is only build when CONFIG_AUXTRACE=y, fix that ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3ab481a1
  18. 01 3月, 2019 1 次提交
    • J
      perf time-utils: Refactor time range parsing code · 284c4e18
      Jin Yao 提交于
      Jiri points out that we don't need any time checking and time string
      parsing if the --time option is not set. That makes sense.
      
      This patch refactors the time range parsing code, move the duplicated
      code from perf report and perf script to time_utils and check if --time
      option is set before parsing the time string. This patch is no logic
      change expected. So the usage of --time is same as before.
      
      For example:
      
      Select the first and second 10% time slices:
        perf report --time 10%/1,10%/2
        perf script --time 10%/1,10%/2
      
      Select the slices from 0% to 10% and from 30% to 40%:
        perf report --time 0%-10%,30%-40%
        perf script --time 0%-10%,30%-40%
      
      Select the time slices from timestamp 3971 to 3973
        perf report --time 3971,3973
        perf script --time 3971,3973
      
      Committer testing:
      
      Using the above examples, check before and after to see if it remains
      the same:
      
        $ perf record -F 10000 -- find . -name "*.[ch]" -exec cat {} + > /dev/null
        [ perf record: Woken up 3 times to write data ]
        [ perf record: Captured and wrote 1.626 MB perf.data (42392 samples) ]
        $
        $ perf report --time 10%/1,10%/2 > /tmp/report.before.1
        $ perf script --time 10%/1,10%/2 > /tmp/script.before.1
        $ perf report --time 0%-10%,30%-40% > /tmp/report.before.2
        $ perf script --time 0%-10%,30%-40% > /tmp/script.before.2
        $ perf report --time 180457.375844,180457.377717 > /tmp/report.before.3
        $ perf script --time 180457.375844,180457.377717 > /tmp/script.before.3
      
      For example, the 3rd test produces this slice:
      
        $ cat /tmp/script.before.3
              cat  3147 180457.375844:   2143 cycles:uppp:      7f79362590d9 cfree@GLIBC_2.2.5+0x9 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.375986:   2245 cycles:uppp:      558b70f3d86e [unknown] (/usr/bin/cat)
              cat  3147 180457.376012:   2164 cycles:uppp:      7f7936257430 _int_malloc+0x8c0 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.376140:   2921 cycles:uppp:      558b70f3a554 [unknown] (/usr/bin/cat)
              cat  3147 180457.376296:   2844 cycles:uppp:      7f7936258abe malloc+0x4e (/usr/lib64/libc-2.28.so)
              cat  3147 180457.376431:   2717 cycles:uppp:      558b70f3b0ca [unknown] (/usr/bin/cat)
              cat  3147 180457.376667:   2630 cycles:uppp:      558b70f3d86e [unknown] (/usr/bin/cat)
              cat  3147 180457.376795:   2442 cycles:uppp:      7f79362bff55 read+0x15 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.376927:   2376 cycles:uppp:  ffffffff9aa00163 [unknown] ([unknown])
              cat  3147 180457.376954:   2307 cycles:uppp:      7f7936257438 _int_malloc+0x8c8 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.377116:   3091 cycles:uppp:      7f7936258a70 malloc+0x0 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.377362:   2945 cycles:uppp:      558b70f3a3b0 [unknown] (/usr/bin/cat)
              cat  3147 180457.377517:   2727 cycles:uppp:      558b70f3a9aa [unknown] (/usr/bin/cat)
        $
      
      Install 'coreutils-debuginfo' to see cat's guts (symbols), but then, the
      above chunk translates into this 'perf report' output:
      
        $ cat /tmp/report.before.3
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 13  of event 'cycles:uppp' (time slices: 180457.375844,180457.377717)
        # Event count (approx.): 33552
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ......................
        #
            17.69%  cat      libc-2.28.so      [.] malloc
            14.53%  cat      cat               [.] 0x000000000000586e
            13.33%  cat      libc-2.28.so      [.] _int_malloc
             8.78%  cat      cat               [.] 0x00000000000023b0
             8.71%  cat      cat               [.] 0x0000000000002554
             8.13%  cat      cat               [.] 0x00000000000029aa
             8.10%  cat      cat               [.] 0x00000000000030ca
             7.28%  cat      libc-2.28.so      [.] read
             7.08%  cat      [unknown]         [k] 0xffffffff9aa00163
             6.39%  cat      libc-2.28.so      [.] cfree@GLIBC_2.2.5
      
        #
        # (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
        #
        $
      
      Now lets see after applying this patch, nothing should change:
      
        $ perf report --time 10%/1,10%/2 > /tmp/report.after.1
        $ perf script --time 10%/1,10%/2 > /tmp/script.after.1
        $ perf report --time 0%-10%,30%-40% > /tmp/report.after.2
        $ perf script --time 0%-10%,30%-40% > /tmp/script.after.2
        $ perf report --time 180457.375844,180457.377717 > /tmp/report.after.3
        $ perf script --time 180457.375844,180457.377717 > /tmp/script.after.3
        $ diff -u /tmp/report.before.1 /tmp/report.after.1
        $ diff -u /tmp/script.before.1 /tmp/script.after.1
        $ diff -u /tmp/report.before.2 /tmp/report.after.2
        --- /tmp/report.before.2	2019-03-01 11:01:53.526094883 -0300
        +++ /tmp/report.after.2	2019-03-01 11:09:18.231770467 -0300
        @@ -352,5 +352,5 @@
      
         #
        -# (Tip: Generate a script for your data: perf script -g <lang>)
        +# (Tip: Treat branches as callchains: perf report --branch-history)
         #
        $ diff -u /tmp/script.before.2 /tmp/script.after.2
        $ diff -u /tmp/report.before.3 /tmp/report.after.3
        --- /tmp/report.before.3	2019-03-01 11:03:08.890045588 -0300
        +++ /tmp/report.after.3	2019-03-01 11:09:40.660224002 -0300
        @@ -22,5 +22,5 @@
      
         #
        -# (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
        +# (Tip: List events using substring match: perf list <keyword>)
         #
        $ diff -u /tmp/script.before.3 /tmp/script.after.3
        $
      
      Cool, just the 'perf report' tips changed, QED.
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1551435186-6008-1-git-send-email-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      284c4e18