1. 26 1月, 2017 1 次提交
  2. 24 8月, 2016 1 次提交
  3. 20 5月, 2016 1 次提交
    • A
      perf tools: Fix usage of max_stack sysctl · fe176085
      Arnaldo Carvalho de Melo 提交于
      We cannot limit processing stacks from the current value of the sysctl,
      as we may be processing perf.data files, possibly from other machines.
      
      Instead use the old PERF_MAX_STACK_DEPTH, the sysctl default, that can
      be overriden using --max-stack or equivalent.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Fixes: 4cb93446 ("perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack")
      Link: http://lkml.kernel.org/n/tip-eqeutsr7n7wy0c36z24ytvii@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fe176085
  4. 27 4月, 2016 1 次提交
  5. 15 4月, 2016 1 次提交
    • A
      perf callchain: Start moving away from global per thread cursors · 91d7b2de
      Arnaldo Carvalho de Melo 提交于
      The recent perf_evsel__fprintf_callchain() move to evsel.c added several
      new symbol requirements to the python binding, for instance:
      
        # perf test -v python
        16: Try 'import perf' in python, checking link problems      :
        --- start ---
        test child forked, pid 18030
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        ImportError: /tmp/build/perf/python/perf.so: undefined symbol:
        callchain_cursor
        test child finished with -1
        ---- end ----
        Try 'import perf' in python, checking link problems: FAILED!
        #
      
      This would require linking against callchain.c to access to the global
      callchain_cursor variables.
      
      Since lots of functions already receive as a parameter a
      callchain_cursor struct pointer, make that be the case for some more
      function so that we can start phasing out usage of yet another global
      variable.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-djko3097eyg2rn66v2qcqfvn@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      91d7b2de
  6. 06 4月, 2016 1 次提交
    • A
      perf script perl: Do error checking on new backtrace routine · 76e20522
      Arnaldo Carvalho de Melo 提交于
      This ended up triggering these warnings when building on Ubuntu 12.04.5:
      
        util/scripting-engines/trace-event-perl.c: In function 'perl_process_callchain':
        util/scripting-engines/trace-event-perl.c:293:4: error: value computed is not used [-Werror=unused-value]
        util/scripting-engines/trace-event-perl.c:294:4: error: value computed is not used [-Werror=unused-value]
        util/scripting-engines/trace-event-perl.c:295:4: error: value computed is not used [-Werror=unused-value]
        util/scripting-engines/trace-event-perl.c:297:4: error: value computed is not used [-Werror=unused-value]
        util/scripting-engines/trace-event-perl.c:309:4: error: value computed is not used [-Werror=unused-value]
        cc1: all warnings being treated as errors
        mv: cannot stat `/tmp/build/perf/util/scripting-engines/.trace-event-perl.o.tmp': No such file or directory
        make[4]: *** [/tmp/build/perf/util/scripting-engines/trace-event-perl.o] Error 1
      
      Fix it by doing error checking when building the perl data structures
      related to callchains.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Dima Kogan <dima@secretsauce.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Fixes: f7380c12 ("perf script perl: Perl scripts now get a backtrace, like the python ones")
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      76e20522
  7. 30 3月, 2016 1 次提交
    • D
      perf script perl: Perl scripts now get a backtrace, like the python ones · f7380c12
      Dima Kogan 提交于
      We have some infrastructure to use perl or python to analyze logs
      generated by perf.  Prior to this patch, only the python tools had
      access to backtrace information.  This patch makes this information
      available to perl scripts as well.  Example:
      
        Let's look at malloc() calls made by the seq utility.  First we
        create a probe point:
      
            $ perf probe -x /lib/x86_64-linux-gnu/libc.so.6 malloc
            Added new events:
            ...
      
        Now we run seq, while monitoring malloc() calls with perf
      
            $ perf record --call-graph=dwarf -e probe_libc:malloc seq 5
            1
            2
            3
            4
            5
            [ perf record: Woken up 1 times to write data ]
            [ perf record: Captured and wrote 0.064 MB perf.data (6 samples) ]
      
        We can use perf to look at its log to see the malloc calls and the backtrace
      
            $ perf script
            seq 14195 [000] 1927993.748254: probe_libc:malloc: (7f9ff8edd320) bytes=0x22
                        7f9ff8edd320 malloc (/lib/x86_64-linux-gnu/libc-2.22.so)
                        7f9ff8e8eab0 set_binding_values.part.0 (/lib/x86_64-linux-gnu/libc-2.22.so)
                        7f9ff8e8eda1 __bindtextdomain (/lib/x86_64-linux-gnu/libc-2.22.so)
                              401b22 main (/usr/bin/seq)
                        7f9ff8e82610 __libc_start_main (/lib/x86_64-linux-gnu/libc-2.22.so)
                              402799 _start (/usr/bin/seq)
            ...
      
        We can also use the scripting facilities.  We create a skeleton perl
        script that simply prints out the events
      
            $ perf script -g perl
            generated Perl script: perf-script.pl
      
        We can then use this script to see the malloc() calls with a
        backtrace.  Prior to this patch, the backtrace was not available to
        the perl scripts.
      
            $ perf script -s perf-script.pl
            probe_libc::malloc  0 1927993.748254260  14195 seq   __probe_ip=140325052863264, bytes=34
                    [7f9ff8edd320] malloc
                    [7f9ff8e8eab0] set_binding_values.part.0
                    [7f9ff8e8eda1] __bindtextdomain
                    [401b22] main
                    [7f9ff8e82610] __libc_start_main
                    [402799] _start
            ...
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/r/87mvphzld0.fsf@secretsauce.netSigned-off-by: NDima Kogan <dima@secretsauce.net>
      f7380c12
  8. 25 2月, 2016 1 次提交
    • T
      perf script: Exception handling when the print fmt is empty · 8579aca3
      Taeung Song 提交于
      After collecting samples for events 'syscalls:', perf-script with python
      script doesn't occasionally work generating a segmentation fault.
      
      The reason is that the print fmt is empty and a value of
      event->print_fmt.args is NULL, so dereferencing the null pointer results
      in a segmentation fault i.e.:
      
          # perf record -e syscalls:*
          # perf script -g python
          # perf script -s perf-script.py
      
          in trace_begin
          syscalls__sys_enter_brk  3 79841.832099154  3777 test.sh  syscall_nr=12, brk=0
      
          ... (omitted) ...
      
          Segmentation fault (core dumped)
      
      For example, a format of sys_enter_getuid() hasn't
      print fmt as below.
      
          # cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_getuid/format
          name: sys_enter_getuid
          ID: 188
          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:int syscall_nr;                     offset:8; size:4; signed:1;
      
          print fmt: ""
      
      So add exception handling to avoid this problem.
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1456413179-12331-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8579aca3
  9. 03 9月, 2015 1 次提交
  10. 14 5月, 2015 1 次提交
  11. 03 4月, 2015 1 次提交
  12. 24 3月, 2015 1 次提交
  13. 07 11月, 2014 1 次提交
  14. 23 8月, 2014 1 次提交
  15. 17 7月, 2014 1 次提交
  16. 08 6月, 2014 1 次提交
  17. 27 12月, 2013 1 次提交
  18. 20 12月, 2013 2 次提交
  19. 04 11月, 2013 1 次提交
  20. 18 10月, 2013 1 次提交
  21. 15 10月, 2013 1 次提交
  22. 22 7月, 2013 1 次提交
  23. 25 1月, 2013 1 次提交
  24. 20 9月, 2012 1 次提交
  25. 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
  26. 06 9月, 2012 1 次提交
  27. 08 8月, 2012 3 次提交
  28. 30 6月, 2012 1 次提交
  29. 28 6月, 2012 1 次提交
    • A
      perf tools: Stop using a global trace events description list · da378962
      Arnaldo Carvalho de Melo 提交于
      The pevent thing is per perf.data file, so I made it stop being static
      and become a perf_session member, so tools processing perf.data files
      use perf_session and _there_ we read the trace events description into
      session->pevent and then change everywhere to stop using that single
      global pevent variable and use the per session one.
      
      Note that it _doesn't_ fall backs to trace__event_id, as we're not
      interested at all in what is present in the
      /sys/kernel/debug/tracing/events in the workstation doing the analysis,
      just in what is in the perf.data file.
      
      This patch also introduces perf_session__set_tracepoints_handlers that
      is the perf perf.data/session way to associate handlers to tracepoint
      events by resolving their IDs using the events descriptions stored in a
      perf.data file. Make 'perf sched' use it.
      Reported-by: NDmitry Antipov <dmitry.antipov@linaro.org>
      Tested-by: NDmitry Antipov <dmitry.antipov@linaro.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linaro-dev@lists.linaro.org
      Cc: patches@linaro.org
      Link: http://lkml.kernel.org/r/20120625232016.GA28525@infradead.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      da378962
  30. 22 5月, 2012 2 次提交
    • F
      perf script: Rename struct event to struct event_format in perl engine · 8784eb74
      Frederic Weisbecker 提交于
      While migrating to the libtraceevent, the perl scripting engine
      missed this structure rename.
      
      This fixes:
      
           util/scripting-engines/trace-event-perl.c: In function "find_cache_event":
           util/scripting-engines/trace-event-perl.c:244: error: assignment from incompatible pointer type
           util/scripting-engines/trace-event-perl.c:248: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:248: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:250: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c: In function "perl_process_tracepoint":
           util/scripting-engines/trace-event-perl.c:286: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:286: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:307: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c: In function "perl_generate_script":
           util/scripting-engines/trace-event-perl.c:498: error: passing argument 1 of "trace_find_next_event" from incompatible pointer type
           util/scripting-engines/../trace-event.h:56: note: expected "struct event_format *" but argument is of type "struct event *"
           util/scripting-engines/trace-event-perl.c:498: error: assignment from incompatible pointer type
           util/scripting-engines/trace-event-perl.c:499: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:499: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:513: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:532: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:556: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:569: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:570: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:579: error: dereferencing pointer to incomplete type
           util/scripting-engines/trace-event-perl.c:580: error: dereferencing pointer to incomplete type
      Reported-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Link: http://lkml.kernel.org/r/1337697049-30251-2-git-send-email-fweisbec@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8784eb74
    • F
      perf script: Explicitly handle known default print arg type · e326e752
      Frederic Weisbecker 提交于
      Handle the print argument types brought by the new libparsevent in perl
      scripting engine.
      
      PRINT_BSTRING and PRINT_DYNAMIC_ARRAY are treated just like strings
      and thus don't require specific processing.
      
      But PRINT_FUNC need specific plugins which are not yet handled, lets
      warn if we meet this case.
      
      This fixes:
      
           util/scripting-engines/trace-event-perl.c: In function define_event_symbol:
           util/scripting-engines/trace-event-perl.c:188: error: enumeration value PRINT_BSTRING not handled in switch
           util/scripting-engines/trace-event-perl.c:188: error: enumeration value PRINT_DYNAMIC_ARRAY not handled in switch
           util/scripting-engines/trace-event-perl.c:188: error: enumeration value PRINT_FUNC not handled in switch
      Reported-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Link: http://lkml.kernel.org/r/1337697049-30251-1-git-send-email-fweisbec@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e326e752
  31. 24 12月, 2011 1 次提交
    • R
      perf script: Add generic perl handler to process events · 37a058ea
      Robert Richter 提交于
      The current perf scripting facility only supports tracepoints. This
      patch implements a generic perl handler to support other events than
      tracepoints too.
      
      This patch introduces a function process_event() that is called by perf
      for each sample. The function is called with byte streams as arguments
      containing information about the event, its attributes, the sample and
      raw data. Perl's unpack() function can easily be used for byte decoding.
      The following is the default implementation for process_event() that can
      also be generated with perf script:
      
       # Packed byte string args of process_event():
       #
       # $event:       union perf_event        util/event.h
       # $attr:        struct perf_event_attr  linux/perf_event.h
       # $sample:      struct perf_sample      util/event.h
       # $raw_data:    perf_sample->raw_data   util/event.h
      
       sub process_event
       {
               my ($event, $attr, $sample, $raw_data) = @_;
      
               my @event       = unpack("LSS", $event);
               my @attr        = unpack("LLQQQQQLLQQ", $attr);
               my @sample      = unpack("QLLQQQQQLL", $sample);
               my @raw_data    = unpack("C*", $raw_data);
      
               use Data::Dumper;
               print Dumper \@event, \@attr, \@sample, \@raw_data;
       }
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1323969824-9711-4-git-send-email-robert.richter@amd.comSigned-off-by: NRobert Richter <robert.richter@amd.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      37a058ea
  32. 28 11月, 2011 1 次提交
  33. 24 3月, 2011 1 次提交
    • A
      perf session: Pass evsel in event_ops->sample() · 9e69c210
      Arnaldo Carvalho de Melo 提交于
      Resolving the sample->id to an evsel since the most advanced tools,
      report and annotate, and the others will too when they evolve to
      properly support multi-event perf.data files.
      
      Good also because it does an extra validation, checking that the ID is
      valid when present. When that is not the case, the overhead is just a
      branch + function call (perf_evlist__id2evsel).
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9e69c210
  34. 15 3月, 2011 1 次提交
  35. 17 11月, 2010 1 次提交
  36. 11 5月, 2010 1 次提交