1. 08 8月, 2013 2 次提交
    • M
      perf tools: Add support for pinned modifier · e9a7c414
      Michael Ellerman 提交于
      This commit adds support for a new modifier "D", which requests that the
      event, or group of events, be pinned to the PMU.
      
      The "p" modifier is already taken for precise, and "P" may be used in
      future to mean "fully precise".
      
      So we use "D", which stands for pinneD - and looks like a padlock, or if
      you're using the ":D" syntax perf smiles at you.
      
      This is an oft-requested feature from our HW folks, who want to be able
      to run a large number of events, but also want 100% accurate results for
      instructions per cycle.
      
      Comparison of results with and without pinning:
      
      $ perf stat -e '{cycles,instructions}:D' -e cycles,instructions,...
      
        79,590,480,683 cycles         #  0.000 GHz
       166,123,716,524 instructions   #  2.09  insns per cycle
                                      #  0.11  stalled cycles per insn
      
        79,352,134,463 cycles         #  0.000 GHz                     [11.11%]
       165,178,301,818 instructions   #  2.08  insns per cycle
                                      #  0.11  stalled cycles per insn [11.13%]
      
      As you can see although perf does a very good job of scaling the values
      in the non-pinned case, there is some small discrepancy.
      
      The patch is fairly straight forward, the one detail is that we need to
      make sure we only request pinning for the group leader when we have a
      group.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Tested-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1375795686-4226-1-git-send-email-michael@ellerman.id.au
      [ Use perf_evsel__is_group_leader instead of open coded equivalent, as
        suggested by Jiri Olsa ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e9a7c414
    • J
      perf tools: Add 'S' event/group modifier to read sample value · 3c176311
      Jiri Olsa 提交于
      Adding 'S' event/group modifier to specify that the event value/s are
      read by PERF_SAMPLE_READ sample type processing, instead of the period
      value offered by lower layers.
      
      There's additional behaviour change for 'S' modifier being specified on
      event group:
      
      Currently all the events within a group makes samples. If user now
      specifies 'S' within group modifier, only the leader will trigger
      samples. The rest of events in the group will have sampling disabled.
      
      And same as for single events, values of all events within the group
      (including leader) are read by PERF_SAMPLE_READ sample type processing.
      
      Following example will create event group with cycles and cache-misses
      events, setting the cycles as group leader and the only event to
      actually sample. Both cycles and cache-misses event period values are
      read by PERF_SAMPLE_READ sample type processing with PERF_FORMAT_GROUP
      read format.
      
      Example:
      
        $ perf record -e '{cycles,cache-misses}:S' ls
        ...
        $ perf report --group --show-total-period --stdio
        ...
        # Samples: 36  of event 'anon group { cycles, cache-misses }'
        # Event count (approx.): 12585593
        #
        #       Overhead          Period  Command      Shared Object                      Symbol
        # ..............  ..............  .......  .................  ..........................
        #
          19.92%   1.20%  2505936     31       ls  [kernel.kallsyms]  [k] mark_held_locks
          13.74%   0.47%  1729327     12       ls  [kernel.kallsyms]  [k] sched_clock_local
          13.64%  23.72%  1716147    612       ls  ld-2.14.90.so      [.] check_match.10805
          13.12%  23.22%  1650778    599       ls  libc-2.14.90.so    [.] _nl_intern_locale_data
          11.24%  29.19%  1414554    753       ls  [kernel.kallsyms]  [k] sched_clock_cpu
           8.50%   0.35%  1070150      9       ls  [kernel.kallsyms]  [k] check_chain_key
        ...
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-iyoinu3axi11mymwnh2b7fxj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3c176311
  2. 15 11月, 2012 1 次提交
  3. 09 11月, 2012 1 次提交
  4. 11 9月, 2012 1 次提交
    • I
      perf tools: Use __maybe_used for unused variables · 1d037ca1
      Irina Tirdea 提交于
      perf defines both __used and __unused variables to use for marking
      unused variables. The variable __used is defined to
      __attribute__((__unused__)), which contradicts the kernel definition to
      __attribute__((__used__)) for new gcc versions. On Android, __used is
      also defined in system headers and this leads to warnings like: warning:
      '__used__' attribute ignored
      
      __unused is not defined in the kernel and is not a standard definition.
      If __unused is included everywhere instead of __used, this leads to
      conflicts with glibc headers, since glibc has a variables with this name
      in its headers.
      
      The best approach is to use __maybe_unused, the definition used in the
      kernel for __attribute__((unused)). In this way there is only one
      definition in perf sources (instead of 2 definitions that point to the
      same thing: __used and __unused) and it works on both Linux and Android.
      This patch simply replaces all instances of __used and __unused with
      __maybe_unused.
      Signed-off-by: NIrina Tirdea <irina.tirdea@intel.com>
      Acked-by: NPekka Enberg <penberg@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1347315303-29906-7-git-send-email-irina.tirdea@intel.com
      [ committer note: fixed up conflict with a116e05d in builtin-sched.c ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1d037ca1
  5. 23 8月, 2012 1 次提交
  6. 15 8月, 2012 1 次提交
    • J
      perf tools: Add support to parse event group syntax · 89efb029
      Jiri Olsa 提交于
      Adding scanner/parser bits to parse event groups.
      
      The grammar for group is:
        groups:      groups ',' group | group
        group:       group_name '{' events '}' group_mod
        group_name:  name | empty
        group_mod:   ':' group_mods | empty
        group_mods:  event_mod
      
      It's possible to use standard event modifier as a modifier
      for group. It'll be used as an update to existing event
      modifiers.
      
      It's necessary to use quoting ("'\) when specifying group on
      command line, since {} characters are interpreted by most of
      the shells.
      
      It is now possible to specify groups in event syntax like:
      
        '{cycles,faults}'
         - anonymous group
      
        'group1{cycles,faults}
         - group with name 'group1'
      
        '{cycles,faults}:k
         - anonymous group with event modifier 'k'
      
        '{cpu-clock,task-clock},{minor-faults,major-faults}'
         - two anonymous groups
      
      The grouping functionality itself is coming shortly.
      Reviewed-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/n/tip-p4j8bnvo879uokum4k4zk5q6@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      89efb029
  7. 08 8月, 2012 1 次提交
  8. 05 7月, 2012 2 次提交
  9. 30 6月, 2012 1 次提交
  10. 18 6月, 2012 2 次提交
  11. 22 5月, 2012 2 次提交
  12. 17 4月, 2012 1 次提交
  13. 29 3月, 2012 1 次提交
  14. 17 3月, 2012 2 次提交
    • J
      perf tools: Add config options support for event parsing · 8f707d84
      Jiri Olsa 提交于
      Adding a new rule to the event grammar to be able to specify
      values of additional attributes of symbolic event.
      
      The new syntax for event symbolic definition is:
      
      event_legacy_symbol:  PE_NAME_SYM '/' event_config '/' |
                            PE_NAME_SYM sep_slash_dc
      
      event_config:         event_config ',' event_term | event_term
      
      event_term:           PE_NAME '=' PE_NAME |
                            PE_NAME '=' PE_VALUE
                            PE_NAME
      
      sep_slash_dc: '/' | ':' |
      
      At the moment the config options are hardcoded to be used for legacy
      symbol events to define several perf_event_attr fields. It is:
      
        'config'   to define perf_event_attr::config
        'config1'  to define perf_event_attr::config1
        'config2'  to define perf_event_attr::config2
        'period'   to define perf_event_attr::sample_period
      
      Legacy events could be now specified as:
        cycles/period=100000/
      
      If term is specified without the value assignment, then 1 is
      assigned by default.
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/n/tip-mgkavww9790jbt2jdkooyv4q@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8f707d84
    • J
      perf tools: Add parser generator for events parsing · 89812fc8
      Jiri Olsa 提交于
      Changing event parsing to use flex/bison parse generator.
      The event syntax stays as it was.
      
      grammar description:
      
      events: events ',' event | event
      
      event:  event_def PE_MODIFIER_EVENT | event_def
      
      event_def: event_legacy_symbol sep_dc     |
                 event_legacy_cache sep_dc      |
                 event_legacy_breakpoint sep_dc |
                 event_legacy_tracepoint sep_dc |
                 event_legacy_numeric sep_dc    |
                 event_legacy_raw sep_dc
      
      event_legacy_symbol:      PE_NAME_SYM
      
      event_legacy_cache:       PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT |
                                PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT  |
                                PE_NAME_CACHE_TYPE
      
      event_legacy_raw:         PE_SEP_RAW PE_VALUE
      
      event_legacy_numeric:     PE_VALUE ':' PE_VALUE
      
      event_legacy_breakpoint:  PE_SEP_BP ':' PE_VALUE ':' PE_MODIFIER_BP
      
      event_breakpoint_type:    PE_MODIFIER_BPTYPE | empty
      
      PE_NAME_SYM:              cpu-cycles|cycles                              |
                                stalled-cycles-frontend|idle-cycles-frontend   |
                                stalled-cycles-backend|idle-cycles-backend     |
                                instructions                                   |
                                cache-references                               |
                                cache-misses                                   |
                                branch-instructions|branches                   |
                                branch-misses                                  |
                                bus-cycles                                     |
                                cpu-clock                                      |
                                task-clock                                     |
                                page-faults|faults                             |
                                minor-faults                                   |
                                major-faults                                   |
                                context-switches|cs                            |
                                cpu-migrations|migrations                      |
                                alignment-faults                               |
                                emulation-faults
      
      PE_NAME_CACHE_TYPE:       L1-dcache|l1-d|l1d|L1-data             |
                                L1-icache|l1-i|l1i|L1-instruction      |
                                LLC|L2                                 |
                                dTLB|d-tlb|Data-TLB                    |
                                iTLB|i-tlb|Instruction-TLB             |
                                branch|branches|bpu|btb|bpc            |
                                node
      
      PE_NAME_CACHE_OP_RESULT:  load|loads|read                        |
                                store|stores|write                     |
                                prefetch|prefetches                    |
                                speculative-read|speculative-load      |
                                refs|Reference|ops|access              |
                                misses|miss
      
      PE_MODIFIER_EVENT:        [ukhp]{0,5}
      
      PE_MODIFIER_BP:           [rwx]
      
      PE_SEP_BP:                'mem'
      
      PE_SEP_RAW:               'r'
      
      sep_dc:                   ':' |
      
      Added flex/bison files for event grammar parsing. The generated
      parser is part of the patch. Added makefile rule 'event-parser'
      to generate the parser code out of the bison/flex sources.
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/n/tip-u4pfig5waq3ll2bfcdex8fgi@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      89812fc8