1. 20 4月, 2017 1 次提交
  2. 17 2月, 2017 1 次提交
    • A
      tools perf scripting python: clang doesn't have -spec, remove it · 8bd8c653
      Arnaldo Carvalho de Melo 提交于
      Gcc has a -spec option to override what options to pass to cc, etc, and
      in some distros this is used, like in fedora, where we end up getting
      this passed to gcc that makes clang, that doesn't have this option to
      stop the build:
      
        CC       /tmp/build/perf/util/scripting-engines/trace-event-python.o
      clang-4.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument]
      
      So filter this out when the compiler used is clang, this way we
      can build the python scripting support in tools/perf/.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@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-2gosxoiouf24pnlknp7w7q4z@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8bd8c653
  3. 14 2月, 2017 2 次提交
  4. 26 1月, 2017 2 次提交
  5. 24 8月, 2016 1 次提交
  6. 19 7月, 2016 2 次提交
  7. 13 7月, 2016 1 次提交
    • A
      perf script python: Silence -Werror=maybe-uninitialized on gcc 5.3.0 · 39f54862
      Arnaldo Carvalho de Melo 提交于
      Sounds like a compiler bug, but to silence it, initialize those
      variables to NULL.
      
      Noticed on:
      
      Target: x86_64-alpine-linux-musl
      Configured with: /home/buildozer/aports/main/gcc/src/gcc-5.3.0/configure
      --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
      --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl
      --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 5.3.0'
      --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch
      --disable-multilib --disable-nls --disable-werror --disable-symvers
      --enable-__cxa_atexit --enable-esp --enable-cloog-backend
      --enable-languages=c,c++,objc,java,fortran,ada --disable-libssp
      --disable-libmudflap --disable-libsanitizer --enable-shared
      --enable-threads --enable-tls --with-system-zlib
      Thread model: posix
      gcc version 5.3.0 (Alpine 5.3.0)
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@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-zyvsjvbl45o7hzcuz78wu2xi@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      39f54862
  8. 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
  9. 12 5月, 2016 1 次提交
  10. 11 5月, 2016 1 次提交
  11. 10 5月, 2016 1 次提交
  12. 07 5月, 2016 2 次提交
    • C
      perf script: Expose usage of the callchain db export via the python api · 2c15f5eb
      Chris Phlipot 提交于
      This change allows python scripts to be able to utilize the recent
      changes to the db export api allowing the export of call_paths derived
      from sampled callchains. These call paths are also now associated with
      the samples from which they were derived.
      
      - This feature is enabled by setting "perf_db_export_callchains" to true
      
      - When enabled, samples that have callchain information will have the
        callchains exported via call_path_table
      
      - The call_path_id field is added to sample_table to enable association of
        samples with the corresponding callchain stored in the call paths
        table. A call_path_id of 0 will be exported if there is no
        corresponding callchain.
      
      - When "perf_db_export_callchains" and "perf_db_export_calls" are both
        set to True, the call path root data structure will be shared. This
        prevents duplicating of data and call path ids that would result from
        building two separate call path trees in memory.
      
      - The call_return_processor structure definition was relocated to the header
        file to make its contents visible to db-export.c. This enables the
        sharing of call path trees between the two features, as mentioned
        above.
      
      This change is visible to python scripts using the python db export api.
      
      The change is backwards compatible with scripts written against the
      previous API, assuming that the scripts model the sample_table function
      after the one in export-to-postgresql.py script by allowing for
      additional arguments to be added in the future. ie. using *x as the
      final argument of the sample_table function.
      Signed-off-by: NChris Phlipot <cphlipot0@gmail.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1461831551-12213-6-git-send-email-cphlipot0@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2c15f5eb
    • C
      perf tools: Refactor code to move call path handling out of thread-stack · 451db126
      Chris Phlipot 提交于
      Move the call path handling code out of thread-stack.c and
      thread-stack.h to allow other components that are not part of
      thread-stack to create call paths.
      
      Summary:
      
      - Create call-path.c and call-path.h and add them to the build.
      
      - Move all call path related code out of thread-stack.c and thread-stack.h
        and into call-path.c and call-path.h.
      
      - A small subset of structures and functions are now visible through
        call-path.h, which is required for thread-stack.c to continue to
        compile.
      
      This change is a prerequisite for subsequent patches in this change set
      and by itself contains no user-visible changes.
      Signed-off-by: NChris Phlipot <cphlipot0@gmail.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1461831551-12213-3-git-send-email-cphlipot0@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      451db126
  13. 27 4月, 2016 1 次提交
  14. 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
  15. 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
  16. 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
  17. 03 3月, 2016 1 次提交
  18. 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
  19. 07 1月, 2016 1 次提交
    • J
      perf script: Add python support for stat events · aef90263
      Jiri Olsa 提交于
      Add support to get stat events data in perf python scripts.
      
      The python script shall implement the following new interface to process
      stat data:
      
        def stat__<event_name>_[<modifier>](cpu, thread, time, val, ena, run):
      
          - is called for every stat event for given counter,
            if user monitors 'cycles,instructions:u" following
            callbacks should be defined:
      
            def stat__cycles(cpu, thread, time, val, ena, run):
            def stat__instructions_u(cpu, thread, time, val, ena, run):
      
        def stat__interval(time):
      
          - is called for every interval with its time,
            in non interval mode it's called after last
            stat event with total measured time in ns
      
      The rest of the current interface stays untouched..
      
      Please check example CPI metrics script in following patch
      with command line examples in changelogs.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NKan Liang <kan.liang@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1452028152-26762-8-git-send-email-jolsa@kernel.org
      [ Rename 'time' parameters to 'tstamp', to fix the build in older distros ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aef90263
  20. 29 9月, 2015 1 次提交
  21. 03 9月, 2015 1 次提交
  22. 14 5月, 2015 1 次提交
  23. 03 4月, 2015 3 次提交
  24. 24 3月, 2015 1 次提交
  25. 12 2月, 2015 1 次提交
  26. 22 1月, 2015 1 次提交
  27. 07 11月, 2014 2 次提交
  28. 04 11月, 2014 3 次提交
  29. 29 10月, 2014 2 次提交
  30. 15 10月, 2014 1 次提交