1. 03 2月, 2016 4 次提交
  2. 26 1月, 2016 1 次提交
  3. 08 1月, 2016 1 次提交
  4. 07 1月, 2016 11 次提交
    • N
      perf tools: Add all matching dynamic sort keys for field name · 9735be24
      Namhyung Kim 提交于
      When a perf.data file has multiple events, it's likely to be similar
      (tracepoint) events.  In that case, they might have same field name so
      add all of them to sort keys instead of bailing out.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1451991518-25673-2-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9735be24
    • N
      perf tools: Make 'trace' or 'trace_fields' sort key default for tracepoint events · d49dadea
      Namhyung Kim 提交于
      When an evlist contains tracepoint events only, use 'trace' sort key as
      default.  If --raw-trace option was given, use 'trace_fields' instead.
      This will make users more convenient to see trace result.
      Suggested-and-Acked-by: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-14-git-send-email-namhyung@kernel.org
      [ Check evlist in get_default_sort_order() fixing a segfault in 'perf test hists' reported by Jiri Olsa ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d49dadea
    • N
      perf tools: Add 'trace_fields' dynamic sort key · 2e422fd1
      Namhyung Kim 提交于
      The 'trace_fields' sort key is similar as 'trace' sort key, but it shows
      each fields separately.  Each event will get different columns as their
      fields.
      
        $ perf report -s trace_fields --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 20K of event 'kmem:kmalloc'
        # Event count (approx.): 20533
        #
        # Overhead  Command           call_site                 ptr  bytes_req  bytes_alloc            gfp_flags
        # ........  .......  ..................  ..................  .........  ...........  ...................
        #
            99.89%  perf       ffffffffa01d4396  0xffff8803ffb79720         96           96    GFP_NOFS|GFP_ZERO
             0.06%  sleep      ffffffff8114e1cd  0xffff8803d228a000       4096         4096           GFP_KERNEL
             0.03%  perf       ffffffff811d6ae6  0xffff8803f7678f00        240          256  GFP_KERNEL|GFP_ZERO
             0.00%  perf       ffffffff812263c1  0xffff880406172380        128          128           GFP_KERNEL
             0.00%  perf       ffffffff812264b9  0xffff8803ffac1600        504          512           GFP_KERNEL
             0.00%  perf       ffffffff81226634  0xffff880401dc5280         28           32           GFP_KERNEL
             0.00%  sleep      ffffffff81226da9  0xffff8803ffac3a00        392          512           GFP_KERNEL
      
        # Samples: 20K of event 'kmem:kfree'
        # Event count (approx.): 20597
        #
        # Overhead           call_site                 ptr
        # ........  ..................  ..................
        #
            99.58%    ffffffffa01d85ad  0xffff8803ffb79720
             0.07%    ffffffff81443f5c  0xffff8803f7669400
             0.02%    ffffffff811d5753  0xffff8803f7678f00
             0.01%    ffffffff81443f5c  0xffff8803f766be00
             0.01%    ffffffff8114e359  0xffff8803d228a000
             0.01%    ffffffff81443f5c  0xffff8800d156dc00
             0.01%    ffffffff81443f5c  0xffff8803f7669400
             0.01%    ffffffff8114e359  0xffff8803d228a000
             0.01%    ffffffff8114e359  0xffff8803d228a000
             0.01%    ffffffff8114e359  0xffff8803d228a000
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-13-git-send-email-namhyung@kernel.org
      [ Combined with "perf tools: Fix segfault when using -s trace_fields" ]
      Link: http://lkml.kernel.org/r/1451991518-25673-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e422fd1
    • N
      perf tools: Skip dynamic fields not defined for current event · 361459f1
      Namhyung Kim 提交于
      When there are multiple events, each dynamic sort key is defined just
      for one event.  In this case other events will always show "N/A" for
      those fields.  But they are meaningless and consume precious screen
      width.
      
      Let's skip those undefined dynamic fields.
      
        $ perf record -e kmem:kmalloc,kmem:kfree -a sleep 1
      
        $ perf report -s 'comm,kmalloc.*' --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 20K of event 'kmem:kmalloc'
        # Event count (approx.): 20533
        #
        # Overhead  Command           call_site                 ptr  bytes_req  bytes_alloc            gfp_flags
        # ........  .......  ..................  ..................  .........  ...........  ...................
        #
            99.89%  perf       ffffffffa01d4396  0xffff8803ffb79720         96           96    GFP_NOFS|GFP_ZERO
             0.06%  sleep      ffffffff8114e1cd  0xffff8803d228a000       4096         4096           GFP_KERNEL
             0.03%  perf       ffffffff811d6ae6  0xffff8803f7678f00        240          256  GFP_KERNEL|GFP_ZERO
             0.00%  perf       ffffffff812263c1  0xffff880406172380        128          128           GFP_KERNEL
             0.00%  perf       ffffffff812264b9  0xffff8803ffac1600        504          512           GFP_KERNEL
             0.00%  perf       ffffffff81226634  0xffff880401dc5280         28           32           GFP_KERNEL
             0.00%  sleep      ffffffff81226da9  0xffff8803ffac3a00        392          512           GFP_KERNEL
      
        # Samples: 20K of event 'kmem:kfree'
        # Event count (approx.): 20597
        #
        # Overhead  Command
        # ........  ..............
        #
            99.63%  perf
             0.14%  sleep
             0.11%  irq/36-iwlwifi
             0.11%  kworker/u16:0
             0.01%  Xorg
             0.00%  firefox
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-12-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      361459f1
    • N
      perf tools: Support '<event>.*' dynamic sort key · 3b099bf5
      Namhyung Kim 提交于
      Support '*' character for field name to add all (non-common) fields as
      sort keys easily.
      
        $ perf report -s 'switch.*' --stdio
        ...
        # Overhead    prev_comm  prev_pid   prev_prio  prev_state     next_comm  next_pid  next_prio
        # ........  ...........  .........  .........  ..........  ............  ........  .........
        #
             3.82%    swapper/0         0         120           0   netctl-auto     18711        120
             3.75%  netctl-auto     18711         120           1     swapper/0         0        120
             2.24%    swapper/1         0         120           0   netctl-auto     18709        120
             2.24%  netctl-auto     18709         120           1     swapper/1         0        120
             1.80%    swapper/2         0         120           0   rcu_preempt         7        120
             1.80%    swapper/2         0         120           0   netctl-auto     18711        120
             1.80%  rcu_preempt         7         120           1     swapper/2         0        120
             1.80%  netctl-auto     18711         120           1     swapper/2         0        120
        ...
      Suggested-and-acked-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-11-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3b099bf5
    • N
      perf tools: Support shortcuts for events in dynamic sort keys · 5d0cff93
      Namhyung Kim 提交于
      The dynamic sort key requires event name but specifying full event name
      is rather inconvenient.  This patch adds more ways to identify the event
      in a more compact way.
      
        1. If session has just one event, event name can be omitted.
        2. Events can be accessed by index preceded by a percent sign.
        3. A part of the name can be used, if it's not ambiguous.  The partial
           name should not contain ':' in it.
        4. Full system + event name is still used, it should contain ':'.
      
      So in the below example all does same thing:
      
        $ perf record -e sched:sched_switch -a sleep 1
      
        $ perf report -s next_pid,next_comm
        $ perf report -s %1.next_pid,%1.next_comm
        $ perf report -s switch.next_pid,switch.next_comm
        $ perf report -s sched:sched_switch.next_pid,sched:sched_switch.next_comm
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-10-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5d0cff93
    • N
      perf report/top: Add --raw-trace option · 053a3989
      Namhyung Kim 提交于
      The --raw-trace option allows disabling pretty printing by the event's
      print_fmt or plugin.  Besides that, each dynamic sort key now can
      receive a 'raw' suffix separated by '/' to ask for the raw trace of a
      specific field.
      
        $ perf report -s comm,kmem:kmalloc.gfp_flags
        ...
        # Overhead  Command            gfp_flags
        # ........  .......  ...................
        #
            99.89%  perf       GFP_NOFS|GFP_ZERO
             0.06%  sleep             GFP_KERNEL
             0.03%  perf     GFP_KERNEL|GFP_ZERO
             0.01%  perf              GFP_KERNEL
      
      Now
      
        $ perf report -s comm,kmem:kmalloc.gfp_flags --raw-trace
      or
        $ perf report -s comm,kmem:kmalloc.gfp_flags/raw
        ...
        # Overhead  Command   gfp_flags
        # ........  .......  ..........
        #
            99.89%  perf          32848
             0.06%  sleep           208
             0.03%  perf          32976
             0.01%  perf            208
      Suggested-and-Acked-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-9-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      053a3989
    • N
      perf tools: Add 'trace' sort key · a34bb6a0
      Namhyung Kim 提交于
      The 'trace' sort key is to show tracepoint event output using either
      print fmt or plugin.  For example sched_switch event (using plugin) will
      show output like below:
      
        # perf record -e sched:sched_switch -a usleep 10
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.197 MB perf.data (69 samples) ]
        #
      
        $ perf report -s trace --stdio
        ...
        # Overhead  Trace output
        # ........  ...................................................
        #
             9.48%  swapper/0:0 [120] R ==> transmission-gt:17773 [120]
             9.48%  transmission-gt:17773 [120] S ==> swapper/0:0 [120]
             9.04%  swapper/2:0 [120] R ==> transmission-gt:17773 [120]
             8.92%  transmission-gt:17773 [120] S ==> swapper/2:0 [120]
             5.25%  swapper/0:0 [120] R ==> kworker/0:1H:109 [100]
             5.21%  kworker/0:1H:109 [100] S ==> swapper/0:0 [120]
             1.78%  swapper/3:0 [120] R ==> transmission-gt:17773 [120]
             1.78%  transmission-gt:17773 [120] S ==> swapper/3:0 [120]
             1.53%  Xephyr:6524 [120] S ==> swapper/0:0 [120]
             1.53%  swapper/0:0 [120] R ==> Xephyr:6524 [120]
             1.17%  swapper/2:0 [120] R ==> irq/33-iwlwifi:233 [49]
             1.13%  irq/33-iwlwifi:233 [49] S ==> swapper/2:0 [120]
      
      Note that the 'trace' sort key works only for tracepoint events.  If
      it's used to other type of events, just "N/A" will be printed.
      Suggested-and-acked-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-8-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a34bb6a0
    • N
      perf tools: Try to show pretty printed output for dynamic sort keys · 60517d28
      Namhyung Kim 提交于
      Each tracepoint event has format string for print to improve
      readability.  Try to parse the output and match the field name.  If it
      finds one, use that for the result.  If not, fallbacks to the original
      output.
      
      For example, sort on kmem:kmalloc.gfp_flags looks like below:
      (Note: libtraceevent plugins are not installed on my system.  They might
      affect the output below)
      
      Before:
        # Overhead  Command   gfp_flags
        # ........  .......  ..........
        #
            99.89%  perf          32848
             0.06%  sleep           208
             0.03%  perf          32976
             0.01%  perf            208
      
      After:
        # Overhead  Command            gfp_flags
        # ........  .......  ...................
        #
            99.89%  perf       GFP_NOFS|GFP_ZERO
             0.06%  sleep             GFP_KERNEL
             0.03%  perf     GFP_KERNEL|GFP_ZERO
             0.01%  perf              GFP_KERNEL
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-7-git-send-email-namhyung@kernel.org
      [ Fixed clash with earlier, updated patch in this patchkit ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      60517d28
    • N
      perf tools: Add dynamic sort key for tracepoint events · c7c2a5e4
      Namhyung Kim 提交于
      The existing sort keys are less useful for tracepoint events in that
      they are always sampled at the same place, the function where the
      tracepoint is located.
      
      For example, a 'perf report' on sched:sched_switch event looks like the
      following:
      
        # Overhead  Command          Shared Object     Symbol
        # ........  ...............  ................  ..............
        #
            47.22%  swapper          [kernel.vmlinux]  [k] __schedule
            21.67%  transmission-gt  [kernel.vmlinux]  [k] __schedule
             8.23%  netctl-auto      [kernel.vmlinux]  [k] __schedule
             5.53%  kworker/0:1H     [kernel.vmlinux]  [k] __schedule
             1.98%  Xephyr           [kernel.vmlinux]  [k] __schedule
             1.33%  irq/33-iwlwifi   [kernel.vmlinux]  [k] __schedule
             1.17%  wpa_cli          [kernel.vmlinux]  [k] __schedule
             1.13%  rcu_preempt      [kernel.vmlinux]  [k] __schedule
             0.85%  ksoftirqd/0      [kernel.vmlinux]  [k] __schedule
             0.77%  Timer            [kernel.vmlinux]  [k] __schedule
      
      In fact, tracepoints have meaningful information in their fields but
      there's no way to use in 'perf report' currently.  The dynamic sort keys
      are introduced in this patc to overcome this limitation.
      
      The sched:sched_switch events have following fields:
      
        # sudo cat /sys/kernel/debug/tracing/events/sched/sched_switch/format
        name: sched_switch
        ID: 268
        format:
      	field:unsigned short common_type;         offset:0; size:2; signed:0;
      	field:unsigned char common_flags;         offset:2; size:1; signed:0;
      	field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
      	field:int common_pid;                     offset:4; size:4; signed:1;
      
      	field:char prev_comm[16]; offset:8;  size:16; signed:1;
      	field:pid_t prev_pid;     offset:24; size:4;  signed:1;
      	field:int prev_prio;      offset:28; size:4;  signed:1;
      	field:long prev_state;    offset:32; size:8;  signed:1;
      	field:char next_comm[16]; offset:40; size:16; signed:1;
      	field:pid_t next_pid;     offset:56; size:4;  signed:1;
      	field:int next_prio;      offset:60; size:4;  signed:1;
      
        print fmt: "prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==>
                    next_comm=%s next_pid=%d next_prio=%d",
          REC->prev_comm, REC->prev_pid, REC->prev_prio,
          REC->prev_state & (2048-1) ? __print_flags(REC->prev_state & (2048-1),
          "|", { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, { 16, "Z" }, { 32, "X" },
          { 64, "x" }, { 128, "K"}, { 256, "W" }, { 512, "P" }, { 1024, "N" }) : "R",
          REC->prev_state & 2048 ? "+" : "", REC->next_comm, REC->next_pid, REC->next_prio
      
      With dynamic sort keys, you can use <event.field> as a sort key.  Those
      dynamic keys are checked and created on demand.  For instance, below is
      to sort by next_pid field output on the same data file:
      
        $ perf report -s comm,sched:sched_switch.next_pid --stdio
        ...
        # Overhead  Command            next_pid
        # ........  ...............  ..........
        #
            21.23%  transmission-gt           0
            20.86%  swapper               17773
             6.62%  netctl-auto               0
             5.25%  swapper                 109
             5.21%  kworker/0:1H              0
             1.98%  Xephyr                    0
             1.98%  swapper                6524
             1.98%  swapper               27478
             1.37%  swapper               27476
             1.17%  swapper                 233
      
      Multiple dynamic sort keys are also supported:
      
        $ perf report -s comm,sched:sched_switch.next_pid,sched:sched_switch.next_comm --stdio
        ...
        # Overhead  Command            next_pid         next_comm
        # ........  ...............  ..........  ................
        #
            20.86%  swapper               17773   transmission-gt
             9.64%  transmission-gt           0         swapper/0
             9.16%  transmission-gt           0         swapper/2
             5.25%  swapper                 109      kworker/0:1H
             5.21%  kworker/0:1H              0         swapper/0
             2.14%  netctl-auto               0         swapper/2
             1.98%  netctl-auto               0         swapper/0
             1.98%  swapper                6524            Xephyr
             1.98%  swapper               27478       netctl-auto
             1.78%  transmission-gt           0         swapper/3
             1.53%  Xephyr                    0         swapper/0
             1.29%  netctl-auto               0         swapper/1
             1.29%  swapper               27476       netctl-auto
             1.21%  netctl-auto               0         swapper/3
             1.17%  swapper                 233    irq/33-iwlwifi
      
      Note that pid 0 exists for each cpu so have comm of 'swapper/N'.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-6-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c7c2a5e4
    • N
      perf tools: Pass evlist to setup_sorting() · 40184c46
      Namhyung Kim 提交于
      This is a preparation to support dynamic sort keys for tracepoint
      events.  Dynamic sort keys can be created for specific fields in trace
      events so it needs the event information.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1450804030-29193-5-git-send-email-namhyung@kernel.org
      [ Moving the evlist creation earlier in top was split to a previous patch ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      40184c46
  5. 07 10月, 2015 2 次提交
  6. 06 10月, 2015 1 次提交
  7. 14 9月, 2015 1 次提交
    • K
      perf tools: Introduce new sort type "socket" for the processor socket · 2e7ea3ab
      Kan Liang 提交于
      This patch enable perf report to sort by processor socket:
      
        $ perf report --stdio --sort socket,comm,dso,symbol
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 686  of event 'cycles'
        # Event count (approx.): 349215462
        #
        # Overhead SOCKET Command Shared Object    Symbol
        # ........ ...... ....... ................ ............................
        #
          97.05%    000   test    test             [.] plusB_c
           0.98%    000   test    test             [.] plusA_c
           0.93%    001   perf    [kernel.vmlinux] [k] smp_call_function_single
           0.19%    001   perf    [kernel.vmlinux] [k] page_fault
           0.19%    001   swapper [kernel.vmlinux] [k] pm_qos_request
           0.16%    000   test    [kernel.vmlinux] [k] add_mm_counter_fast
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1441377946-44429-2-git-send-email-kan.liang@intel.com
      [ Fix col calc, un-allcapsify col header & read the topology when not using perf.data ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e7ea3ab
  8. 03 9月, 2015 1 次提交
    • A
      perf tools: Always use non inlined file name for 'srcfile' sort key · 2f84b42b
      Andi Kleen 提交于
      When profiling the kernel with the 'srcfile' sort key it's common to
      "get stuck" in include. For example a lot of code uses current or other
      inlines, so they get accounted to some random include file. This is not
      very useful as a high level categorization.
      
      For example just profiling the idle loop usually shows mostly inlines,
      so you never see the actual cpuidle file.
      
      This patch changes the 'srcfile' sort key to always unwind the inline
      stack using BFD/DWARF. So we always account to the base function that
      called the inline.
      
      In a few cases include is still shown (for example for MSR accesses),
      but that is because they get inlining expanded as part of assigning to a
      global function pointer. For the majority it works fine though.
      
      v2: Use simpler while loop. Add maximum iteration count.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/1441133239-31254-1-git-send-email-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2f84b42b
  9. 12 8月, 2015 1 次提交
  10. 11 8月, 2015 1 次提交
    • A
      perf report: Add support for srcfile sort key · 31191a85
      Andi Kleen 提交于
      In some cases it's useful to characterize samples by file. This is
      useful to get a higher level categorization, for example to map cost to
      subsystems.
      
      Add a srcfile sort key to perf report. It builds on top of the existing
      srcline support.
      
      Commiter notes:
      
      E.g.:
      
        # perf record -F 10000 usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.016 MB perf.data (13 samples) ]
        [root@zoo ~]# perf report -s srcfile --stdio
        # Total Lost Samples: 0
        #
        # Samples: 13  of event 'cycles'
        # Event count (approx.): 869878
        #
        # Overhead  Source File
        # ........  ...........
            60.99%  .
            20.62%  paravirt.h
            14.23%  rmap.c
             4.04%  signal.c
             0.11%  msr.h
      
        #
      
      The first line is collecting all the files for which srcfiles couldn't somehow
      get resolved to:
      
        # perf report -s srcfile,dso --stdio
        # Total Lost Samples: 0
        #
        # Samples: 13  of event 'cycles'
        # Event count (approx.): 869878
        #
        # Overhead  Source File  Shared Object
        # ........  ...........  ................
            40.97%  .            ld-2.20.so
            20.62%  paravirt.h   [kernel.vmlinux]
            20.02%  .            libc-2.20.so
            14.23%  rmap.c       [kernel.vmlinux]
             4.04%  signal.c     [kernel.vmlinux]
             0.11%  msr.h        [kernel.vmlinux]
      
        #
      
      XXX: Investigate why that is not resolving on Fedora 21, Andi says he hasn't
           seen this on Fedora 22.
      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/1438988064-21834-1-git-send-email-andi@firstfloor.org
      [ Added column length update, from 0e65bdb3f90f ('perf hists: Update the column width for the "srcline" sort key') ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      31191a85
  11. 07 8月, 2015 2 次提交
  12. 20 6月, 2015 1 次提交
  13. 16 5月, 2015 1 次提交
  14. 27 2月, 2015 1 次提交
    • K
      perf diff: Support for different binaries · 94ba462d
      Kan Liang 提交于
      Currently, the perf diff only works with same binaries. That's because
      it compares the symbol start address. It doesn't work if the perf.data
      comes from different binaries. This patch matches the symbol names.
      
      Actually, perf diff once intended to compare the symbol names.  The
      commit as below can look for a pair by name.
      
      604c5c92 (perf diff: Change the default sort order to "dso,symbol")
      However, at that time, perf diff used a global list of dsos. That means
      the binaries which has same name can only be loaded once. That's a
      problem for comparing different binaries.
      
      For example, we have an old binary and an updated binary. They very
      likely have same name and most of the functions, so only dsos from old
      binary will be loaded. When processing the data from updated binary,
      perf still use the symbol information from old binary. That's wrong.
      
      Then the commit as below used IP to replace symbol name.
      9c443dfd ("perf diff: Fix support for all --sort combinations")
      >From that time, perf diff starts to compare the symbol address.
      
      The global dsos is discarded from a patch in 2010.
      a1645ce1 ("perf: 'perf kvm' tool for monitoring guest performance
      from host")
      However, at that time, perf diff already compared by address. So perf
      diff cannot work for different binaries as well.
      
      This patch actually rolls back the perf diff to original design. The
      document is also changed, so everybody knows the original design is to
      compare the symbol names.
      
      Here are some examples:
      
      The only difference between example_v1.c and example_v2.c is the
      location of f2 and f3. There is no change in behavior, but the previous
      perf diff display the wrong differential profile.
      
      example_v1.c
      noinline void f3(void)
      {
              volatile int i;
              for (i = 0; i < 10000;) {
      
                      if(i%2)
                              i++;
                      else
                              i++;
              }
      }
      
      noinline void f2(void)
      {
              volatile int a = 100, b, c;
              for (b = 0; b < 10000; b++)
                      c = a * b;
      
      }
      
      noinline void f1(void)
      {
                      f2();
                      f3();
      }
      
      int main()
      {
              int i;
              for (i = 0; i < 100000; i++)
                      f1();
      }
      
      example_v2.c
      noinline void f2(void)
      {
              volatile int a = 100, b, c;
              for (b = 0; b < 10000; b++)
                      c = a * b;
      }
      
      noinline void f3(void)
      {
              volatile int i;
              for (i = 0; i < 10000;) {
                      if(i%2)
                              i++;
                      else
                              i++;
              }
      }
      
      noinline void f1(void)
      {
                      f2();
                      f3();
      }
      
      int main()
      {
              int i;
              for (i = 0; i < 100000; i++)
                      f1();
      }
      
      [lk@localhost perf_diff]$ gcc example_v1.c -o example
      [lk@localhost perf_diff]$ perf record -o example_v1.data ./example
      [ perf record: Woken up 4 times to write data ]
      [ perf record: Captured and wrote 0.813 MB example_v1.data (~35522 samples) ]
      
      [lk@localhost perf_diff]$ gcc example_v2.c -o example
      [lk@localhost perf_diff]$ perf record -o example_v2.data ./example
      [ perf record: Woken up 4 times to write data ]
      [ perf record: Captured and wrote 0.824 MB example_v2.data (~36015 samples) ]
      
      Old perf diff result:
      
      [lk@localhost perf_diff]$ perf diff example_v1.data example_v2.data
       Event 'cycles'
       Baseline    Delta  Shared Object     Symbol
       ........  .......  ................  ...............................
      
                           [kernel.vmlinux]  [k] __perf_event_task_sched_out
           0.00%           [kernel.vmlinux]  [k] apic_timer_interrupt
                           [kernel.vmlinux]  [k] idle_cpu
                           [kernel.vmlinux]  [k] intel_pstate_timer_func
                           [kernel.vmlinux]  [k] native_read_msr_safe
           0.00%           [kernel.vmlinux]  [k] native_read_tsc
           0.00%           [kernel.vmlinux]  [k] native_write_msr_safe
                           [kernel.vmlinux]  [k] ntp_tick_length
           0.00%           [kernel.vmlinux]  [k] rb_erase
           0.00%           [kernel.vmlinux]  [k] tick_sched_timer
           0.00%           [kernel.vmlinux]  [k] unmap_single_vma
           0.00%           [kernel.vmlinux]  [k] update_wall_time
           0.00%           example           [.] f1
          46.24%           example           [.] f2
          53.71%   -7.55%  example           [.] f3
                  +53.81%  example           [.] f3
           0.02%           example           [.] main
      
      New perf diff result:
      
      [lk@localhost perf_diff]$ perf diff example_v1.data example_v2.data
                           [kernel.vmlinux]  [k] __perf_event_task_sched_out
           0.00%           [kernel.vmlinux]  [k] apic_timer_interrupt
                           [kernel.vmlinux]  [k] idle_cpu
                           [kernel.vmlinux]  [k] intel_pstate_timer_func
                           [kernel.vmlinux]  [k] native_read_msr_safe
           0.00%           [kernel.vmlinux]  [k] native_read_tsc
           0.00%           [kernel.vmlinux]  [k] native_write_msr_safe
                           [kernel.vmlinux]  [k] ntp_tick_length
           0.00%           [kernel.vmlinux]  [k] rb_erase
           0.00%           [kernel.vmlinux]  [k] tick_sched_timer
           0.00%           [kernel.vmlinux]  [k] unmap_single_vma
           0.00%           [kernel.vmlinux]  [k] update_wall_time
           0.00%           example           [.] f1
          46.24%   -0.08%  example           [.] f2
          53.71%   +0.11%  example           [.] f3
           0.02%           example           [.] main
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/1423460384-11645-1-git-send-email-kan.liang@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      94ba462d
  15. 22 1月, 2015 1 次提交
  16. 25 11月, 2014 1 次提交
  17. 19 11月, 2014 1 次提交
    • A
      perf hists: Fix up srcline histogram key formatting · b2d53671
      Arnaldo Carvalho de Melo 提交于
      Problem introduced in:
      
        commit 5b591669 "perf report: Honor column width setting"
      
      Where the left justification signal was after the width, which ended up,
      when the width was, say, 11, always printing:
      
      	%11.11-s
      
      Instead of src:line left justified and limited to 11 chars.
      
      Resulting in a like:
      
          70.93%  %11.11-s  [.] f2                     tcall
      
      When it should instead be:
      
          70.93%  tcall.c:5    [.] f2                     tcall
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-2xnt0vqkoox52etq2qhyetr0@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b2d53671
  18. 29 10月, 2014 7 次提交
  19. 10 10月, 2014 1 次提交
    • A
      perf evsel: Add hists helper · 4ea062ed
      Arnaldo Carvalho de Melo 提交于
      Not all tools need a hists instance per perf_evsel, so lets pave the way
      to remove evsel->hists while leaving a way to access the hists from a
      specially allocated evsel, one that comes with space at the end where
      lives the evsel.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-qlktkhe31w4mgtbd84035sr2@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4ea062ed