1. 02 Aug, 2016 1 commit
    • Namhyung Kim's avatar
      perf tools: Fix build failure on perl script context · b581c01f
      Namhyung Kim authored
      On my Archlinux machine, perf faild to build like below:
      
          CC       scripts/perl/Perf-Trace-Util/Context.o
        In file included from /usr/lib/perl5/core/perl/CORE/perl.h:3905:0,
                         from Context.xs:23:
        /usr/lib/perl5/core/perl/CORE/inline.h: In function :
        /usr/lib/perl5/core/perl/CORE/cop.h:612:13: warning: declaration of 'av'
                                        shadows a previous local [-Werror-shadow]
                   AV *av =3D GvAV(PL_defgv);
                       ^
        /usr/lib/perl5/core/perl/CORE/inline.h:526:5: note: in expansion of
                                        macro 'CX_POP_SAVEARRAY'
               CX_POP_SAVEARRAY(cx);
               ^~~~~~~~~~~~~~~~
        In file included from /usr/lib/perl5/core/perl/CORE/perl.h:5853:0,
                         from Context.xs:23:
        /usr/lib/perl5/core/perl/CORE/inline.h:518:9: note:
                                        shadowed declaration is here
               AV *av;
                   ^~
      
      What I did to fix is adding '-Wno-shadow' as the error message said it's
      the cause of the failure.  Since it's from the perl (not perf) code
      base, we don't have the control so I just wanted to ignore the warning
      when compiling perl scripting code.
      
      Committer note:
      
      This also fixes the build on Fedora Rawhide.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20160802024317.31725-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b581c01f
  2. 09 Jul, 2016 1 commit
  3. 22 Jun, 2016 1 commit
  4. 21 Jun, 2016 1 commit
  5. 06 May, 2016 1 commit
    • Chris Phlipot's avatar
      perf script: Update export-to-postgresql to support callchain export · 3521f3bc
      Chris Phlipot authored
      Update the export-to-postgresql.py to support the newly introduced
      callchain export.
      
      callchains are added into the existing call_paths table and can now
      be associated with samples when the "callpaths" commandline option
      is used with the script.
      
      Ex.:
      
        $ perf script -s export-to-postgresql.py example_db all callchains
      
      Includes the following changes to enable callchain export via the python export
      APIs:
      
      - Add the "callchains" commandline option, which is used to enable
        callchain export by setting the perf_db_export_callchains global
      - Add perf_db_export_callchains checks for call_path table creation
        and population.
      - Add call_path_id to samples_table to conform with the new API
      
      example usage and output using a small test app:
      
        test_app.c:
      
      	volatile int x = 0;
      	void inc_x_loop()
      	{
      		int i;
      		for(i=0; i<100000000; i++)
      			x++;
      	}
      
      	void a()
      	{
      		inc_x_loop();
      	}
      
      	void b()
      	{
      		inc_x_loop();
      	}
      
      	int main()
      	{
      		a();
      		b();
      		return 0;
      	}
      
      example usage:
      
        $ gcc -g -O0 test_app.c
        $ perf record --call-graph=dwarf ./a.out
        [ perf record: Woken up 77 times to write data ]
        [ perf record: Captured and wrote 19.373 MB perf.data (2404 samples) ]
      
        $ perf script -s scripts/python/export-to-postgresql.py
      	example_db all callchains
      
        $ psql example_db
      
        example_db=#
        SELECT
        (SELECT name FROM symbols WHERE id = cps.symbol_id) as symbol,
        (SELECT name FROM symbols WHERE id =
      	(SELECT symbol_id from call_paths where id = cps.parent_id))
      	as parent_symbol,
        sum(period) as event_count
        FROM samples join call_paths as cps on call_path_id = cps.id
        GROUP BY cps.id,evsel_id
        ORDER BY event_count DESC
        LIMIT 5;
      
              symbol      |      parent_symbol       | event_count
        ------------------+--------------------------+-------------
         inc_x_loop       | a                        |   734250982
         inc_x_loop       | b                        |   731028057
         unknown          | unknown                  |     1335858
         task_tick_fair   | scheduler_tick           |     1238842
         update_wall_time | tick_do_update_jiffies64 |      650373
        (5 rows)
      
      The above data shows total "self time" in cycles for each call path that was
      sampled. It is intended to demonstrate how it accounts separately for the two
      ways to reach the "inc_x_loop" function(via "a" and "b").  Recursive common
      table expressions can be used as well to get cumulative time spent in a
      function as well, but that is beyond the scope of this basic example.
      Signed-off-by: default avatarChris Phlipot <cphlipot0@gmail.com>
      Acked-by: default avatarAdrian 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-7-git-send-email-cphlipot0@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3521f3bc
  6. 19 Apr, 2016 1 commit
  7. 12 Feb, 2016 1 commit
  8. 06 Jan, 2016 1 commit
    • Jiri Olsa's avatar
      perf script: Add stat-cpi.py script · b8a1962d
      Jiri Olsa authored
      Adding stat-cpi.py as an example of how to do stat scripting.
      
      It computes the CPI metrics from cycles and instructions events.
      
      The CPI is based performance metric showing the Cycles Per Instructions
      ratio, which helps to identify cycles-hungry code.
      
      Following stat record/report/script combinations could be used:
      
      - get CPI for given workload
      
          $ perf stat -e cycles,instructions record ls
      
          SNIP
      
           Performance counter stats for 'ls':
      
                   2,904,431      cycles
                   3,346,878      instructions              #    1.15  insns per cycle
      
                 0.001782686 seconds time elapsed
      
          $ perf script -s ./scripts/python/stat-cpi.py
                 0.001783: cpu -1, thread -1 -> cpi 0.867803 (2904431/3346878)
      
          $ perf stat -e cycles,instructions record ls | perf script -s ./scripts/python/stat-cpi.py
      
          SNIP
      
                 0.001730: cpu -1, thread -1 -> cpi 0.869026 (2928292/3369627)
      
      - get CPI systemwide:
      
          $ perf stat -e cycles,instructions -a -I 1000 record sleep 3
          #           time             counts unit events
               1.000158618        594,274,711      cycles                     (100.00%)
               1.000158618        441,898,250      instructions
               2.000350973        567,649,705      cycles                     (100.00%)
               2.000350973        432,669,206      instructions
               3.000559210        561,940,430      cycles                     (100.00%)
               3.000559210        420,403,465      instructions
               3.000670798            780,105      cycles                     (100.00%)
               3.000670798            326,516      instructions
      
          $ perf script -s ./scripts/python/stat-cpi.py
                 1.000159: cpu -1, thread -1 -> cpi 1.344823 (594274711/441898250)
                 2.000351: cpu -1, thread -1 -> cpi 1.311972 (567649705/432669206)
                 3.000559: cpu -1, thread -1 -> cpi 1.336669 (561940430/420403465)
                 3.000671: cpu -1, thread -1 -> cpi 2.389178 (780105/326516)
      
          $ perf stat -e cycles,instructions -a -I 1000 record sleep 3 | perf script -s ./scripts/python/stat-cpi.py
                 1.000202: cpu -1, thread -1 -> cpi 1.035091 (940778881/908885530)
                 2.000392: cpu -1, thread -1 -> cpi 1.442600 (627493992/434974455)
                 3.000545: cpu -1, thread -1 -> cpi 1.353612 (741463930/547766890)
                 3.000622: cpu -1, thread -1 -> cpi 2.642110 (784083/296764)
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarKan 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/1452077397-31958-4-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b8a1962d
  9. 28 Sep, 2015 1 commit
  10. 28 Aug, 2015 1 commit
    • Tony Jones's avatar
      perf scripts python: Add new compaction-times script · 84e5d89a
      Tony Jones authored
      This patch creates a new script (compaction-times) to report time
      spent in mm compaction. It is possible to report times in nanoseconds
      (default) or microseconds (-u).
      
      The option -p will break down results by process id, -pv will further
      decompose by each compaction entry/exit.
      
      For each compaction entry/exit what is reported is controlled by the
      options:
      
        -t   report only timing
        -m   report migration stats
        -ms  report migration scanner stats
        -fs  report free scanner stats
      
      The default is to report all.
      
      Entries may be further filtered by pid, pid-range or comm (regex).
      
      The script is useful when analysing workloads that compact memory. The
      most common example will be THP allocations on systems with a lot of
      uptime that has fragmented memory.
      
      This is an example of using the script to analyse a thpscale from
      mmtests which deliberately fragments memory and allocates THP in 4
      separate threads
      
        # Recording step, one of the following;
        $ perf record -e 'compaction:mm_compaction_*' ./workload
        # or:
        $ perf script record compaction-times
      
        # Reporting: basic
        total: 2444505743ns migration: moved=357738 failed=39275
        free_scanner: scanned=2705578 isolated=387875
        migration_scanner: scanned=414426 isolated=397013
      
        # Reporting: Per task stall times
        $ perf script report compaction-times -- -t -p
        total: 2444505743ns
        6384[thpscale]: 740800017ns
        6385[thpscale]: 274119512ns
        6386[thpscale]: 832961337ns
        6383[thpscale]: 596624877ns
      
        # Reporting: Per-compaction attempts for task 6385
        $ perf script report compaction-times -- -m -pv 6385
        total: 274119512ns migration: moved=14893 failed=24285
        6385[thpscale]: 274119512ns migration: moved=14893 failed=24285
        6385[thpscale].1: 3033277ns migration: moved=511 failed=1
        6385[thpscale].2: 9592094ns migration: moved=1524 failed=12
        6385[thpscale].3: 2495587ns migration: moved=512 failed=0
        6385[thpscale].4: 2561766ns migration: moved=512 failed=0
        6385[thpscale].5: 2523521ns migration: moved=512 failed=0
        ..... output continues ...
      
      Changes since v1:
      - report stats for isolate_migratepages and isolate_freepages
        (Vlastimil Babka)
      - refactor code to achieve above
      - add help text
      - output to stdout/stderr explicitly
      Signed-off-by: default avatarTony Jones <tonyj@suse.com>
      Cc: Mel Gorman <mgorman@suse.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Link: http://lkml.kernel.org/r/1439840932-8933-1-git-send-email-tonyj@suse.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84e5d89a
  11. 21 Aug, 2015 1 commit
    • Adrian Hunter's avatar
      perf tools: Add example call-graph script · 4b715d24
      Adrian Hunter authored
      Add a script to produce a call-graph from data exported to a postgresql
      database and derived from a processor trace event like intel_pt or intel_bts.
      
      Refer to comments in the scripts call-graph-from-postgresql.py and
      export-to-postgresql.py for more details on how to set up the environment,
      install the required packages, etc.
      
      Committer note:
      
      From the scripts, for convenience while reading 'git log':
      
        An example of using this script with Intel PT:
      
        $ perf record -e intel_pt//u ls
        $ perf script -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py pt_example branches calls
        2015-05-29 12:49:23.464364 Creating database...
        2015-05-29 12:49:26.281717 Writing to intermediate files...
        2015-05-29 12:49:27.190383 Copying to database...
        2015-05-29 12:49:28.140451 Removing intermediate files...
        2015-05-29 12:49:28.147451 Adding primary keys
        2015-05-29 12:49:28.655683 Adding foreign keys
        2015-05-29 12:49:29.365350 Done
        $ python tools/perf/scripts/python/call-graph-from-postgresql.py pt_example
        # The result is a GUI window with a tree representing a context-sensitive
        # call-graph.  Expanding a couple of levels of the tree and adjusting column
        # widths to suit will display something like:
      
                                               Call Graph: pt_example
        Call Path                        |Object     |Count|Time(ns)|Time(%)|Branch Count|Branch Count(%)
        v- ls
           v- 2638:2638
               v- _start                  ld-2.19.so    1   10074071  100.0        211135          100.0
                 |- unknown               unknown       1      13198    0.1             1            0.0
                 >- _dl_start             ld-2.19.so    1    1400980   13.9         19637            9.3
                 >- _d_linit_internal     ld-2.19.so    1     448152    4.4         11094            5.3
                 v-__libc_start_main@plt  ls            1    8211741   81.5        180397           85.4
                    >- _dl_fixup          ld-2.19.so    1       7607    0.1           108            0.1
                    >- __cxa_atexit       libc-2.19.so  1      11737    0.1            10            0.0
                    >- __libc_csu_init    ls            1      10354    0.1            10            0.0
                    |- _setjmp            libc-2.19.so  1          0    0.0             4            0.0
                    v- main               ls            1    8182043   99.6        180254           99.9
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-11-git-send-email-adrian.hunter@intel.com
      [ Added 'python-pyside qt-postgresql' to the yum cmdline installing required packages ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4b715d24
  12. 12 Feb, 2015 1 commit
  13. 21 Jan, 2015 1 commit
    • Wang Nan's avatar
      perf scripting perl: Force to use stdbool · 75e0b5f0
      Wang Nan authored
      When building perf for arm64 I hit a warning (and be treated as an
      error) like below:
      
       aarch64-oe-linux-gcc -o .../scripts/perl/Perf-Trace-Util/Context.o -c -Wbad-function-cast \
               ... scripts/perl/Perf-Trace-Util/Context.c
      
       In file included from .../usr/lib64/perl/5.14.3/CORE/perl.h:2464:0,
                        from Context.xs:23:
       /.../usr/lib64/perl/5.14.3/CORE/handy.h:108:0: error: "bool" redefined [-Werror]
        #  define bool char
        ^
       In file included from /.../usr/src/kernel/tools/include/linux/types.h:4:0,
                        from /.../usr/src/kernel/arch/arm64/include/uapi/asm/sigcontext.h:19,
      		  from /.../usr/include/bits/sigcontext.h:27,
      		  from /.../usr/include/signal.h:340,
      		  from /.../usr/include/sys/param.h:28,
      		  from /.../usr/lib64/perl/5.14.3/CORE/perl.h:678,
      		  from Context.xs:23:
        /.../usr/lib/aarch64-oe-linux/gcc/aarch64-oe-linux/4.9.2/include/stdbool.h:33:0: note: this is the location of the previous definition
          #define bool _Bool
      
      Looks like the failure is caused by arm64 uapi/asm/sigcontext.h, which
      includes linux/types.h while other archs not.
      
      Current perl consider this problem:
      
      http://perl5.git.perl.org/perl.git/commit/bd31be4baa3ee68abdb92c0db3200efe0fad903b
      
      However there are users which use old version of perl.
      
      This patch includes stdbool.h before Context.xs and define HAS_BOOL to
      prevent perl'e headers define its own 'bool'. Code is learn from perl's
      git tree.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1421671397-4659-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      75e0b5f0
  14. 03 Nov, 2014 2 commits
  15. 29 Oct, 2014 1 commit
    • Adrian Hunter's avatar
      perf script: Add Python script to export to postgresql · 2987e32f
      Adrian Hunter authored
      Add a Python script to export to a postgresql database.
      
      The script requires the Python pyside module and the Qt PostgreSQL
      driver.  The packages needed are probably named "python-pyside" and
      "libqt4-sql-psql"
      
      The caller of the script must be able to create postgresql databases.
      
      The script takes the database name as a parameter.  The database and
      database tables are created.  Data is written to flat files which are
      then imported using SQL COPY FROM.
      
      Example:
      
        $ perf record ls
        ...
        $ perf script report export-to-postgresql lsdb
        2014-02-14 10:55:38.631431 Creating database...
        2014-02-14 10:55:39.291958 Writing to intermediate files...
        2014-02-14 10:55:39.350280 Copying to database...
        2014-02-14 10:55:39.358536 Removing intermediate files...
        2014-02-14 10:55:39.358665 Adding primary keys
        2014-02-14 10:55:39.658697 Adding foreign keys
        2014-02-14 10:55:39.667412 Done
        $ psql lsdb
        lsdb-# \d
                    List of relations
         Schema |      Name       | Type  | Owner
        --------+-----------------+-------+-------
         public | comm_threads    | table | acme
         public | comms           | table | acme
         public | dsos            | table | acme
         public | machines        | table | acme
         public | samples         | table | acme
         public | samples_view    | view  | acme
         public | selected_events | table | acme
         public | symbols         | table | acme
         public | threads         | table | acme
        (9 rows)
        lsdb-# \d samples
               Table "public.samples"
            Column     |  Type   | Modifiers
        ---------------+---------+-----------
         id            | bigint  | not null
         evsel_id      | bigint  |
         machine_id    | bigint  |
         thread_id     | bigint  |
         comm_id       | bigint  |
         dso_id        | bigint  |
         symbol_id     | bigint  |
         sym_offset    | bigint  |
         ip            | bigint  |
         time          | bigint  |
         cpu           | integer |
         to_dso_id     | bigint  |
         to_symbol_id  | bigint  |
         to_sym_offset | bigint  |
         to_ip         | bigint  |
         period        | bigint  |
         weight        | bigint  |
         transaction   | bigint  |
         data_src      | bigint  |
        Indexes:
            "samples_pkey" PRIMARY KEY, btree (id)
        Foreign-key constraints:
            "commfk" FOREIGN KEY (comm_id) REFERENCES comms(id)
            "dsofk" FOREIGN KEY (dso_id) REFERENCES dsos(id)
            "evselfk" FOREIGN KEY (evsel_id) REFERENCES selected_events(id)
            "machinefk" FOREIGN KEY (machine_id) REFERENCES machines(id)
            "symbolfk" FOREIGN KEY (symbol_id) REFERENCES symbols(id)
            "threadfk" FOREIGN KEY (thread_id) REFERENCES threads(id)
            "todsofk" FOREIGN KEY (to_dso_id) REFERENCES dsos(id)
            "tosymbolfk" FOREIGN KEY (to_symbol_id) REFERENCES symbols(id)
      
        lsdb-# \d samples_view
                       View "public.samples_view"
              Column       |          Type           | Modifiers
        -------------------+-------------------------+-----------
         id                | bigint                  |
         time              | bigint                  |
         cpu               | integer                 |
         pid               | integer                 |
         tid               | integer                 |
         command           | character varying(16)   |
         event             | character varying(80)   |
         ip_hex            | text                    |
         symbol            | character varying(2048) |
         sym_offset        | bigint                  |
         dso_short_name    | character varying(256)  |
         to_ip_hex         | text                    |
         to_symbol         | character varying(2048) |
         to_sym_offset     | bigint                  |
         to_dso_short_name | character varying(256)  |
      
          lsdb=# select * from samples_view;
      
         id| time       |cpu | pid  | tid  |command| event  |   ip_hex      |           symbol    |sym_off| dso_name|to_ip_hex|to_symbol|to_sym_off|to_dso_name
         --+------------+----+------+------+-------+--------+---------------+---------------------+-------+---------+---------+---------+----------+----------
         1 |12202825015 | -1 | 7339 | 7339 |:17339 | cycles | fffff8104d24a |native_write_msr_safe|    10 | [kernel]| 0       | unknown |         0| unknown
         2 |12203258804 | -1 | 7339 | 7339 |:17339 | cycles | fffff8104d24a |native_write_msr_safe|    10 | [kernel]| 0       | unknown |         0| unknown
         3 |12203988119 | -1 | 7339 | 7339 |:17339 | cycles | fffff8104d24a |native_write_msr_safe|    10 | [kernel]| 0       | unknown |         0| unknown
      
      My notes (which may be out-of-date) on setting up postgresql so you can
      create databases:
      
      fedora:
      
              $ sudo yum install postgresql postgresql-server python-pyside qt-postgresql
              $ sudo su - postgres -c initdb
              $ sudo service postgresql start
              $ sudo su - postgres
              $ createuser -s <your username>
      
      I used the the unix user name in createuser.
      
      If it fails, try createuser without -s and answer the following question
      to allow your user to create tables:
      
              Shall the new role be a superuser? (y/n) y
      
      ubuntu:
      
              $ sudo apt-get install postgresql
              $ sudo su - postgres
              $ createuser <your username>
              Shall the new role be a superuser? (y/n) y
      
      You may want to disable automatic startup.  One way is to edit
      /etc/postgresql/9.3/main/start.conf.  Another is to disable the init
      script e.g. sudo update-rc.d postgresql disable
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1414061124-26830-8-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2987e32f
  16. 16 Jul, 2014 1 commit
  17. 25 Jun, 2014 1 commit
  18. 05 Nov, 2013 1 commit
  19. 10 Jul, 2013 1 commit
  20. 22 May, 2013 5 commits
  21. 06 Feb, 2013 1 commit
  22. 24 Jan, 2013 1 commit
  23. 17 Sep, 2012 1 commit
  24. 09 Aug, 2012 1 commit
  25. 08 Aug, 2012 2 commits
    • Feng Tang's avatar
      perf scripts python: Add event_analyzing_sample.py as a sample for general event handling · 0076d546
      Feng Tang authored
      Currently only trace point events are supported in perf/python script,
      the first 3 patches of this serie add the support for all types of
      events. This script is just a simple sample to show how to gather the
      basic information of the events and analyze them.
      
      This script will create one object for each event sample and insert them
      into a table in a database, then leverage the simple SQL commands to
      sort/group them. User can modify or write their brand new functions
      according to their specific requirment.
      
      Here is the sample of how to use the script:
      
       $ perf record -a tree
       $ perf script -s process_event.py
      
      There is 100 records in gen_events table
      Statistics about the general events grouped by thread/symbol/dso:
      
                  comm   number         histgram
      ==========================================
               swapper       56     ######
                  tree       20     #####
                  perf       10     ####
                  sshd        8     ####
           kworker/7:2        4     ###
           ksoftirqd/7        1     #
       plugin-containe        1     #
      
                                symbol   number         histgram
      ==========================================================
                 native_write_msr_safe       40     ######
                        __lock_acquire        8     ####
                   ftrace_graph_caller        4     ###
                 prepare_ftrace_return        4     ###
                            intel_idle        3     ##
                    native_sched_clock        3     ##
                        Unknown_symbol        2     ##
                            do_softirq        2     ##
                          lock_release        2     ##
                 lock_release_holdtime        2     ##
                     trace_graph_entry        2     ##
                              _IO_putc        1     #
                        __d_lookup_rcu        1     #
                            __do_fault        1     #
                            __schedule        1     #
                        _raw_spin_lock        1     #
                             delay_tsc        1     #
                   generic_exec_single        1     #
                      generic_fillattr        1     #
      
                                           dso   number         histgram
      ==================================================================
                             [kernel.kallsyms]       95     #######
                           /lib/libc-2.12.1.so        5     ###
      Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1344419875-21665-6-git-send-email-feng.tang@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0076d546
    • Feng Tang's avatar
      perf scripts python: Add a python library EventClass.py · 02f1c33f
      Feng Tang authored
      This library defines several class types for perf events which could
      help to better analyze the event samples. Currently there are just a few
      classes, PerfEvent is the base class for all perf events,  PebsEvent is
      a HW base Intel x86 PEBS event, and user could add more SW/HW event
      classes based on requriements.
      Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1344419875-21665-5-git-send-email-feng.tang@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      02f1c33f
  26. 29 Sep, 2011 1 commit
  27. 25 Dec, 2010 1 commit
  28. 16 Nov, 2010 1 commit
  29. 10 Nov, 2010 1 commit
  30. 26 Oct, 2010 2 commits
    • Arnaldo Carvalho de Melo's avatar
      perf python scripting: Add futex-contention script · 00204c33
      Arnaldo Carvalho de Melo authored
      The equivalent to this SystemTAP script:
      
      http://sourceware.org/systemtap/wiki/WSFutexContention
      
      [root@doppio ~]# perf trace futex-contention
      Press control+C to stop and show the summary
      ^Cnpviewer.bin[15242] lock 7f0a8be19104 contended 29 times, 72806 avg ns
      npviewer.bin[15242] lock 7f0a8be19130 contended 2 times, 1355 avg ns
      synergyc[17245] lock f127f4 contended 1 times, 1830569 avg ns
      firefox[15116] lock 7f2b7238af0c contended 168 times, 1230390 avg ns
      synergyc[17245] lock f2fc20 contended 1 times, 33149 avg ns
      npviewer.bin[15255] lock 7f0a8be19074 contended 155 times, 73047 avg ns
      npviewer.bin[15255] lock 7f0a8be190a0 contended 127 times, 7088 avg ns
      synergyc[17247] lock f12854 contended 1 times, 46741 avg ns
      synergyc[17245] lock f12610 contended 1 times, 7358 avg ns
      [root@doppio ~]#
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      00204c33
    • Arnaldo Carvalho de Melo's avatar
      perf python scripting: Fixup cut'n'paste error in sctop script · 22d0594b
      Arnaldo Carvalho de Melo authored
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      22d0594b
  31. 25 Oct, 2010 3 commits
    • Arnaldo Carvalho de Melo's avatar
      perf python scripting: Support fedora 11 (audit 1.7.17) · 7f6c1bd5
      Arnaldo Carvalho de Melo authored
      Where we don't have the audit.MACH_ARMEB constant.
      
      Cc: David S. Miller <davem@davemloft.net>
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7f6c1bd5
    • Arnaldo Carvalho de Melo's avatar
      perf python scripting: Improve the syscalls-by-pid script · a64fa198
      Arnaldo Carvalho de Melo authored
      . Print message at script start telling how to get te summary
      . Print the syscall names
      . Accept both pid (if numeric) or COMM name
      
      Now it looks like this:
      
      [root@emilia tmp]# perf trace syscall-counts-by-pid
      Press control+C to stop and show the summary
      ^C
      syscall events by comm/pid:
      
      comm [pid]/syscalls                            count
      ----------------------------------------  ----------
      
      automount [1670]
        futex                                            2
      
      sshd [2322]
        rt_sigprocmask                                   4
        select                                           2
        write                                            1
        read                                             1
      
      perf [15178]
        read                                          2506
        open                                           794
        close                                          769
        write                                          240
        getdents                                       112
        lseek                                           16
        stat                                             9
        perf_counter_open                                5
        fcntl                                            5
        mmap                                             5
        statfs                                           2
      
      perf [15179]
        read                                         56701
        open                                           499
        stat                                           176
        fstat                                          149
        close                                          109
        mmap                                            98
        brk                                             75
        rt_sigaction                                    66
        munmap                                          42
        mprotect                                        24
        lstat                                            7
        lseek                                            5
        getdents                                         4
        ioctl                                            3
        readlink                                         2
        futex                                            1
        statfs                                           1
        getegid                                          1
        geteuid                                          1
        getgid                                           1
        getuid                                           1
        getrlimit                                        1
        fcntl                                            1
        uname                                            1
        write                                            1
      [root@emilia tmp]# fg
      -bash: fg: current: no such job
      [root@emilia tmp]# perf trace syscall-counts-by-pid 2322
      Press control+C to stop and show the summary
      ^C
      syscall events by comm/pid:
      
      comm [pid]/syscalls                            count
      ----------------------------------------  ----------
      
      sshd [2322]
        rt_sigprocmask                                   4
        select                                           2
        write                                            1
        read                                             1
      [root@emilia tmp]# perf trace syscall-counts-by-pid sshd
      Press control+C to stop and show the summary
      ^C
      syscall events for sshd:
      
      comm [pid]/syscalls                            count
      ----------------------------------------  ----------
      
      sshd [2322]
        rt_sigprocmask                                   4
        select                                           2
        write                                            1
        read                                             1
      [root@emilia tmp]#
      
      Cc: David S. Miller <davem@davemloft.net>
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a64fa198
    • Arnaldo Carvalho de Melo's avatar
      perf python scripting: print the syscall name on sctop · 2e7d1e3f
      Arnaldo Carvalho de Melo authored
      [root@emilia tmp]# perf trace sctop 1
      syscall events:
      
      event                                          count
      ----------------------------------------  ----------
      read                                          215400
      futex                                           4029
      write                                            376
      brk                                               33
      rt_sigprocmask                                    24
      select                                            17
      lseek                                              2
      fsync                                              1
      ^C[root@emilia tmp]#
      
      Cc: David S. Miller <davem@davemloft.net>
      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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2e7d1e3f