1. 12 2月, 2016 1 次提交
  2. 07 1月, 2016 1 次提交
    • J
      perf script: Add stat-cpi.py script · b8a1962d
      Jiri Olsa 提交于
      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: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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/1452077397-31958-4-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b8a1962d
  3. 29 9月, 2015 1 次提交
  4. 29 8月, 2015 1 次提交
    • T
      perf scripts python: Add new compaction-times script · 84e5d89a
      Tony Jones 提交于
      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: NTony 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      84e5d89a
  5. 21 8月, 2015 1 次提交
    • A
      perf tools: Add example call-graph script · 4b715d24
      Adrian Hunter 提交于
      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: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      4b715d24
  6. 12 2月, 2015 1 次提交
  7. 21 1月, 2015 1 次提交
    • W
      perf scripting perl: Force to use stdbool · 75e0b5f0
      Wang Nan 提交于
      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: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      75e0b5f0
  8. 04 11月, 2014 2 次提交
  9. 29 10月, 2014 1 次提交
    • A
      perf script: Add Python script to export to postgresql · 2987e32f
      Adrian Hunter 提交于
      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: NAdrian 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      2987e32f
  10. 17 7月, 2014 1 次提交
  11. 25 6月, 2014 1 次提交
  12. 06 11月, 2013 1 次提交
  13. 11 7月, 2013 1 次提交
  14. 23 5月, 2013 5 次提交
  15. 07 2月, 2013 1 次提交
  16. 25 1月, 2013 1 次提交
  17. 18 9月, 2012 1 次提交
  18. 10 8月, 2012 1 次提交
  19. 08 8月, 2012 2 次提交
    • F
      perf scripts python: Add event_analyzing_sample.py as a sample for general event handling · 0076d546
      Feng Tang 提交于
      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: NFeng 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      0076d546
    • F
      perf scripts python: Add a python library EventClass.py · 02f1c33f
      Feng Tang 提交于
      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: NFeng 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      02f1c33f
  20. 30 9月, 2011 1 次提交
  21. 25 12月, 2010 1 次提交
  22. 17 11月, 2010 1 次提交
  23. 10 11月, 2010 1 次提交
  24. 27 10月, 2010 2 次提交
    • A
      perf python scripting: Add futex-contention script · 00204c33
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      00204c33
    • A
      perf python scripting: Fixup cut'n'paste error in sctop script · 22d0594b
      Arnaldo Carvalho de Melo 提交于
      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>
      22d0594b
  25. 26 10月, 2010 5 次提交
    • A
      perf python scripting: Support fedora 11 (audit 1.7.17) · 7f6c1bd5
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      7f6c1bd5
    • A
      perf python scripting: Improve the syscalls-by-pid script · a64fa198
      Arnaldo Carvalho de Melo 提交于
      . 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      a64fa198
    • A
      perf python scripting: print the syscall name on sctop · 2e7d1e3f
      Arnaldo Carvalho de Melo 提交于
      [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: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e7d1e3f
    • A
      perf python scripting: Improve the syscalls-counts script · 6545aaa5
      Arnaldo Carvalho de Melo 提交于
      . Print message at script start telling how to get te summary
      . Print the syscall name
      
      Now it looks like this:
      
      [root@emilia ~]# perf trace syscall-counts
      Press control+C to stop and show the summary
      ^C
      syscall events:
      
      event                                          count
      ----------------------------------------  -----------
      read                                          102752
      open                                            1293
      close                                            878
      write                                            319
      stat                                             185
      fstat                                            149
      getdents                                         116
      mmap                                              98
      brk                                               80
      rt_sigaction                                      66
      munmap                                            42
      mprotect                                          24
      lseek                                             21
      lstat                                              7
      rt_sigprocmask                                     4
      futex                                              3
      statfs                                             3
      ioctl                                              3
      readlink                                           2
      select                                             2
      getegid                                            1
      geteuid                                            1
      getgid                                             1
      getuid                                             1
      getrlimit                                          1
      fcntl                                              1
      uname                                              1
      [root@emilia ~]#
      
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      6545aaa5
    • A
      perf python scripting: Improve the failed-syscalls-by-pid script · 6cc73614
      Arnaldo Carvalho de Melo 提交于
      . Print message at script start telling how to get te summary
      . Print the syscall name using the audit-lib-python package, if
        installed
      . Print the errno string
      . Accept both pid (if numeric) or COMM name
      
      Now it looks like this:
      
      [root@emilia ~]# perf trace failed-syscalls-by-pid
      Press control+C to stop and show the summary
      ^C
      syscall errors:
      
      comm [pid]                           count
      ------------------------------  ----------
      
      automount [1670]
        syscall: futex
          err = ETIMEDOUT                     39
      
      irqbalance [1462]
        syscall: openat
          err = ENOENT                         4
      
      perf [7888]
        syscall: lseek
          err = ESPIPE                         1
        syscall: open
          err = ENOENT                        24
      
      perf [7889]
        syscall: ioctl
          err = EINVAL                         1
        syscall: readlink
          err = EINVAL                         2
        syscall: open
          err = ENOENT                       389
        syscall: stat
          err = ENOENT                       141
        syscall: lseek
          err = ESPIPE                         3
      [root@emilia ~]#
      
      [root@emilia ~]# perf trace failed-syscalls-by-pid 1670
      Press control+C to stop and show the summary
      ^C
      syscall errors:
      
      comm [pid]                           count
      ------------------------------  ----------
      
      automount [1670]
        syscall: futex
          err = ETIMEDOUT                      2
      [root@emilia ~]#
      [root@emilia ~]#
      [root@emilia ~]#
      [root@emilia ~]# perf trace failed-syscalls-by-pid automount
      Press control+C to stop and show the summary
      ^C
      syscall errors for automount:
      
      comm [pid]                           count
      ------------------------------  ----------
      
      automount [1669]
        syscall: futex
          err = ETIMEDOUT                      1
      
      automount [1670]
        syscall: futex
          err = ETIMEDOUT                      5
      [root@emilia ~]#
      
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      6cc73614
  26. 24 10月, 2010 1 次提交
  27. 08 9月, 2010 1 次提交
    • K
      perf: Add a script to show packets processing · 359d5106
      Koki Sanagi 提交于
      Add a perf script which shows packets processing and processed
      time. It helps us to investigate networking or network devices.
      
      If you want to use it, install perf and record perf.data like
      following.
      
      If you set script, perf gathers records until it ends.
      If not, you must Ctrl-C to stop recording.
      
      And if you want a report from record,
      
      If you use some options, you can limit the output.
      Option is below.
      
      tx: show only tx packets processing
      rx: show only rx packets processing
      dev=: show processing on this device
      debug: work with debug mode. It shows buffer status.
      
      For example, if you want to show received packets processing
      associated with eth4,
      
      106133.171439sec cpu=0
        irq_entry(+0.000msec irq=24:eth4)
               |
        softirq_entry(+0.006msec)
               |
               |---netif_receive_skb(+0.010msec skb=f2d15900 len=100)
               |            |
               |      skb_copy_datagram_iovec(+0.039msec 10291::10291)
               |
        napi_poll_exit(+0.022msec eth4)
      
      This perf script helps us to analyze the processing time of a
      transmit/receive sequence.
      Signed-off-by: NKoki Sanagi <sanagi.koki@jp.fujitsu.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Kaneshige Kenji <kaneshige.kenji@jp.fujitsu.com>
      Cc: Izumo Taku <izumi.taku@jp.fujitsu.com>
      Cc: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Scott Mcmillan <scott.a.mcmillan@intel.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4C72439D.3040001@jp.fujitsu.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      359d5106
  28. 02 8月, 2010 2 次提交