1. 03 Nov, 2014 5 commits
  2. 30 Oct, 2014 2 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 05b2537e
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
       - Don't open the DWARF info multiple times, keeping instead a dwfl handle
         in struct dso, greatly speeding up 'perf report' on powerpc. (Sukadev Bhattiprolu)
      
       - Introduce PARSE_OPT_DISABLED option flag and use it to avoid showing
         undersired options in tools that provides frontends to 'perf record', like
         sched, kvm, etc (Namhyung Kim)
      
      Infrastructure changes:
      
       - More Intel PT work, including a facility to export sample data (comms,
         threads, symbol names, etc) in a database friendly way, with an script to use
         this to create a postgresql database. (Adrian Hunter)
      
       - Use make sure that thread->mg->machine points to the machine where
         the thread exists (it was being set only for the kmaps kernel modules
         case, do it as well for the mmaps) and use it to shorten function
         signatures (Arnaldo Carvalho de Melo)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      05b2537e
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo' of... · d785452c
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
       - Fix report -F (abort, in_tx, mispredict, etc) segfaults for sample.data files
         without branch info (Jiri Olsa)
      
       - Add patch that should have went in a previous patchkit to use global cache
         provided by libunwind (Namhyung Kim)
      
       - Make CPUINFO_PROC an array to support different kernels, problem
         detected when the information reported via /proc/cpuinfo changed on ARM (Wang Nan)
      
       - 'perf probe' --demangle typo fix and a new --quiet option (Masami Hiramatsu)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d785452c
  3. 29 Oct, 2014 33 commits
    • Adrian Hunter's avatar
      perf session: Add perf_session__deliver_synth_event() · a293829d
      Adrian Hunter authored
      Add a function to deliver synthesized events from within a session.
      
      Intel PT decoding works by synthesizing events (primarily branch events)
      that can then be consumed by existing tools.  This function will be used
      to deliver those events.
      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/1414417770-18602-3-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a293829d
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Use evlist__for_each in a few remaining places · cba9b847
      Arnaldo Carvalho de Melo authored
      Where direct use of the longer form using list_for_entry() was being
      used.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-v4fw80flg25nkl8jgeod3ot9@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cba9b847
    • Adrian Hunter's avatar
      perf tools: Add id index · 3c659eed
      Adrian Hunter authored
      Add an index of the event identifiers, in preparation for Intel PT.
      
      The event id (also called the sample id) is a unique number
      allocated by the kernel to the event created by perf_event_open().  Events
      can include the event id by having a sample type including PERF_SAMPLE_ID or
      PERF_SAMPLE_IDENTIFIER.
      
      Currently the main use of the event id is to match an event back to the
      evsel to which it belongs i.e. perf_evlist__id2evsel()
      
      The purpose of this patch is to make it possible to match an event back to
      the mmap from which it was read.  The reason that is useful is because the
      mmap represents a time-ordered context (either for a cpu or for a thread).
      Intel PT decodes trace information on that basis.  In full-trace mode, that
      information can be recorded when the Intel PT trace is read, but in
      sample-mode the Intel PT trace data is embedded in a sample and it is in
      that case that the "id index" is needed.
      
      So the mmaps are numbered (idx) and the cpu and tid recorded against the id
      by perf_evlist__set_sid_idx() which is called by perf_evlist__mmap_per_evsel().
      
      That information is recorded on the perf.data file in the new "id index".
      idx, cpu and tid are added to struct perf_sample_id (which is the node of
      evlist's hash table to match ids to evsels).  The information can be
      retrieved using perf_evlist__id2sid().  Note however this all depends on
      having a sample type including PERF_SAMPLE_ID or PERF_SAMPLE_IDENTIFIER,
      otherwise ids are not recorded.
      
      The "id index" is a synthesized event record which will be created when
      Intel PT sampling is used by calling perf_event__synthesize_id_index().
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      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/1414417770-18602-2-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3c659eed
    • Masami Hiramatsu's avatar
      perf probe: Add --quiet option to suppress output result message · 5e17b28f
      Masami Hiramatsu authored
      Add --quiet(-q) option to suppress output result message for --add, and
      --del options (Note that --lines/funcs/vars are not affected). This
      option is useful if you run the perf probe inside your scripts.
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20141027203131.21219.35170.stgit@localhost.localdomainSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5e17b28f
    • 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
    • Adrian Hunter's avatar
      perf scripting python: Extend interface to export data in a database-friendly way · df919b40
      Adrian Hunter authored
      Use the new db_export facility to export data in a database-friendly
      way.
      
      A Python script selects the db_export mode by setting a global variable
      'perf_db_export_mode' to True.  The script then optionally implements
      functions to receive table rows.  The functions are:
      
      	evsel_table
      	machine_table
      	thread_table
      	comm_table
      	dso_table
      	symbol_table
      	sample_table
      
      An example script is provided in a subsequent patch.
      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-7-git-send-email-adrian.hunter@intel.com
      [ Reserve space for per symbol db_id space when perf_db_export_mode is on ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      df919b40
    • Adrian Hunter's avatar
      perf tools: Add facility to export data in database-friendly way · 0db15b1e
      Adrian Hunter authored
      This patch introduces an abstraction for exporting sample data in a
      database-friendly way.  The abstraction does not implement the actual
      output.  A subsequent patch takes this facility into use for extending
      the script interface.
      
      The abstraction is needed because static data like symbols, dsos, comms
      etc need to be exported only once.  That means allocating them a unique
      identifier and recording it on each structure.  The member 'db_id' is
      used for that.  'db_id' is just a 64-bit sequence number.
      
      Exporting centres around the db_export__sample() function which exports
      the associated data structures if they have not yet been allocated a
      db_id.
      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-6-git-send-email-adrian.hunter@intel.com
      [ committer note: Stash db_id using symbol_conf.priv_size + symbol__priv() and foo->priv areas ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0db15b1e
    • Arnaldo Carvalho de Melo's avatar
      perf pmu: Add proper error handling to print_pmu_events() · 7e4772dc
      Arnaldo Carvalho de Melo authored
      It was silently returning or printing "(null)" when no memory was
      available at various points. Fix it by checking and warning the user
      when that happens.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-835udmf66x9nza504cu6irz9@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e4772dc
    • Adrian Hunter's avatar
      perf tools: Do not attempt to run perf-read-vdso32 if it wasn't built · 46b1fa85
      Adrian Hunter authored
      popen() causes an error message to print if perf-read-vdso32 does not
      run.  Avoid that by not trying to run it if it was not built.  Ditto
      perf-read-vdsox32.
      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-17-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      46b1fa85
    • Adrian Hunter's avatar
      perf tools: Add support for 32-bit compatibility VDSOs · f6832e17
      Adrian Hunter authored
      'perf record' post-processes the event stream  to create a list of
      build-ids for object files for which sample events have been recorded.
      That results in those object files being recorded in the build-id cache.
      
      In the case of VDSO, perf tools reads it from memory and copies it into
      a temporary file, which as decribed above, gets added to the build-id
      cache.
      
      Then when the perf.data file is processed by other tools, the build-id
      of VDSO is listed in the perf.data file and the VDSO can be read from
      the build-id cache.  In that case the name of the map, the short name of
      the DSO, and the entry in the build-id cache are all "[vdso]".
      
      However, in the 64-bit case, there also can be 32-bit compatibility
      VDSOs.
      
      A previous patch added programs "perf-read-vdso32" and "perf
      read-vdsox32".
      
      This patch uses those programs to read the correct VDSO for a thread and
      create a temporary file just as for the 64-bit VDSO.
      
      The map name and the entry in the build-id cache are still "[vdso]" but
      the DSO short name becomes "[vdso32]" and "[vdsox32]" respectively.
      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-16-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f6832e17
    • Adrian Hunter's avatar
      perf tools: Build programs to copy 32-bit compatibility · e477f3f0
      Adrian Hunter authored
      perf tools copy VDSO out of memory.  However, on 64-bit machines there
      may be 32-bit compatibility VDOs also.  To copy those requires separate
      32-bit executables.
      
      This patch adds to the build additional programs perf-read-vdso32 and
      perf-read-vdsox32 for 32-bit and x32 respectively.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      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: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1414061124-26830-15-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e477f3f0
    • Adrian Hunter's avatar
      perf pmu: Let pmu's with no events show up on perf list · 42634bc7
      Adrian Hunter authored
      perf list only lists PMUs with events.  Add a flag to cause a PMU to be
      also listed separately.
      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-3-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      42634bc7
    • Wang Nan's avatar
      perf tools: Ensure return negative value when write header error · ed307758
      Wang Nan authored
      When 'perf record' write headers, it calls write_xxx in
      tools/perf/util/header.c, and check return value. It rolls back all
      working only when return value is negative.
      
      This patch ensures write_cpudesc() and write_total_mem() return negative number
      when error. Without this patch, headers reported by 'perf report' header is
      error in some platform. Following output is caputured on ARM, which doesn't
      contain "Processor" field in /proc/cpuinfo. See "cpudesc", "total memory" and
      "cmdline" field.
      
         bash-4.2# perf record ls
         ...
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.001 MB perf.data (~36 samples) ]
         bash-4.2# perf report --stdio --header
         Error:
         The perf.data file has no samples!
         # ========
         # captured on: Fri Sep 12 10:09:10 2014
         # hostname : arma15el
         # os release : 3.17.0+
         # perf version : 3.10.53
         # arch : armv7l
         # nrcpus online : 4
         # nrcpus avail : 1
         # cpudesc : (null)
         # total memory : 0 kB
         # cmdline :
         # event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, excl_host = 0, excl_guest = 1, precise_ip = 0
         # pmu mappings: not available
         # ========
         #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Waiman Long <Waiman.Long@hp.com>
      Link: http://lkml.kernel.org/r/1413428909-80017-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ed307758
    • Namhyung Kim's avatar
      perf probe: Use PARSE_OPT_EXCLUSIVE flag · 13dcbbc0
      Namhyung Kim authored
      The perf probe command has some exclusive options.  Use new PARSE_OPT_EXCLUSIVE
      flag to simplify the code and show more compact usage.
      
        $ perf probe -l -a foo
          Error: switch `a' cannot be used with switch `l'
      
         usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
            or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
            or: perf probe [<options>] --del '[GROUP:]EVENT' ...
            or: perf probe --list
            or: perf probe [<options>] --line 'LINEDESC'
            or: perf probe [<options>] --vars 'PROBEPOINT'
      
            -a, --add <[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT [[NAME=]ARG ...]>
                                  probe point definition, where
      		GROUP:	Group name (optional)
      		EVENT:	Event name
      		FUNC:	Function name
      		OFF:	Offset from function entry (in byte)
      		%return:	Put the probe at function return
      		SRC:	Source code path
      		RL:	Relative line number from function entry.
      		AL:	Absolute line number in file.
      		PT:	Lazy expression of line code.
      		ARG:	Probe argument (local variable name or
      			kprobe-tracer argument format.)
      
            -l, --list            list up current probe events
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1413990949-13953-6-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      13dcbbc0
    • Namhyung Kim's avatar
      perf tools: Add support for exclusive option · 42bd71d0
      Namhyung Kim authored
      Some options cannot be used at the same time.  To handle such options
      add a new PARSE_OPT_EXCLUSIVE flag and show error message if more than
      one of them is used.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Acked-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1413990949-13953-5-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      42bd71d0
    • Namhyung Kim's avatar
      perf kvm: Print kvm specific --help output · f45d20ff
      Namhyung Kim authored
      The 'perf kvm stat record' tool is an alias of 'perf record' with
      predefined kvm related options. All options that passed to 'perf kvm
      stat record' are processed by the 'perf record' tool. So, 'perf kvm
      stat record --help' prints help of usage for the 'perf record'
      command. There are a few options useful for 'perf kvm stat record',
      the rest either break kvm related output or don't change it.
      
      Let's print safe for 'perf kvm stat record' options in addition to
      general 'perf record' --help output.
      
      With this patch, new output looks like below:
      
        $ perf kvm stat record -h
      
         usage: perf kvm stat record [<options>]
      
            -p, --pid <pid>       record events on existing process id
            -t, --tid <tid>       record events on existing thread id
            -r, --realtime <n>    collect data with this RT SCHED_FIFO priority
                --no-buffering    collect data without buffering
            -a, --all-cpus        system-wide collection from all CPUs
            -C, --cpu <cpu>       list of cpus to monitor
            -c, --count <n>       event period to sample
            -o, --output <file>   output file name
            -i, --no-inherit      child tasks do not inherit counters
            -m, --mmap-pages <pages>
                                  number of mmap data pages
            -v, --verbose         be more verbose (show counter open errors, etc)
            -q, --quiet           don't print any message
            -s, --stat            per thread counts
            -D, --delay <n>       ms to wait before starting measurement after program start
            -u, --uid <user>      user to profile
                --per-thread      use per-thread mmaps
      
        $ perf kvm stat record -n sleep 1
          Error: switch `n' is not usable
      
         usage: perf kvm stat record [<options>]
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1413990949-13953-4-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f45d20ff
    • Namhyung Kim's avatar
      perf tools: Export usage string and option table of perf record · e5b2c207
      Namhyung Kim authored
      Those are shared with other builtin commands like kvm, script.  So
      make it accessable from them.  This is a preparation of later change
      that limiting possible options.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1413990949-13953-3-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e5b2c207
    • Namhyung Kim's avatar
      perf tools: Add PARSE_OPT_DISABLED flag · d152d1be
      Namhyung Kim authored
      In some cases, we need to reuse exising options with some of them
      disabled.  To do that, add PARSE_OPT_DISABLED flag and
      set_option_flag() function.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarHemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1413990949-13953-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d152d1be
    • Arnaldo Carvalho de Melo's avatar
      perf tests: Use thread->mg->machine · 29f9e521
      Arnaldo Carvalho de Melo authored
      Instead of passing both thread and machine.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-y2nl2v7p7of0dzuyc3tppxoo@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      29f9e521
    • Arnaldo Carvalho de Melo's avatar
      perf tests: Remove misplaced __maybe_unused · f498784c
      Arnaldo Carvalho de Melo authored
      The 'machine' parameter is used in this function, ditch the
      __maybe_unused annotation, not needed.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-dme1nsu07a0spkmcl401srec@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f498784c
    • Arnaldo Carvalho de Melo's avatar
      perf callchains: Use thread->mg->machine · dd8c17a5
      Arnaldo Carvalho de Melo authored
      The unwind__get_entries() already receives the thread parameter, from where it can
      obtain the matching machine structure, shorten the signature.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-isjc6bm8mv4612mhi6af64go@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd8c17a5
    • Arnaldo Carvalho de Melo's avatar
      perf thread: Adopt resolve_callchain method from machine · cc8b7c2b
      Arnaldo Carvalho de Melo authored
      Shortening function signature lenght too, since a thread's machine can be
      obtained from thread->mg->machine, no need to pass thread, machine.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-5wb6css280ty0cel5p0zo2b1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cc8b7c2b
    • Arnaldo Carvalho de Melo's avatar
      perf tools: A thread's machine can be found via thread->mg->machine · bb871a9c
      Arnaldo Carvalho de Melo authored
      So stop passing both machine and thread to several thread methods,
      reducing function signature length.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bb871a9c
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Set thread->mg.machine in all places · 11246c70
      Arnaldo Carvalho de Melo authored
      We were setting this only in machine__init(), i.e. for the map_groups that
      holds the kernel module maps, not for the one used for a thread's executable
      mmaps.
      
      Now we are sure that we can obtain the machine where a thread is by going
      via thread->mg->machine, thus we can, in the following patch, make all
      codepaths that receive machine _and_ thread, drop the machine one.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-y6zgaqsvhrf04v57u15e4ybm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      11246c70
    • Sukadev Bhattiprolu's avatar
      perf tools powerpc: Cache the DWARF debug info · 7d073b33
      Sukadev Bhattiprolu authored
      Cache the DWARF debug info for DSO so we don't have to rebuild it for each
      address in the DSO.
      
      Note that dso__new() uses calloc() so don't need to set dso->dwfl to NULL.
      
      	$ /tmp/perf.orig --version
      	perf version 3.18.rc1.gc2661b80
      	$ /tmp/perf.new --version
      	perf version 3.18.rc1.g402d62
      	$ perf stat -e cycles,instructions /tmp/perf.orig report -g > orig
      
      	 Performance counter stats for '/tmp/perf.orig report -g':
      
      	     6,428,177,183 cycles                    #    0.000 GHz
      	     4,176,288,391 instructions              #    0.65  insns per cycle
      
      	       1.840666132 seconds time elapsed
      
      	$ perf stat -e cycles,instructions /tmp/perf.new report -g > new
      
      	 Performance counter stats for '/tmp/perf.new report -g':
      
      	       305,773,142 cycles                    #    0.000 GHz
      	       276,048,272 instructions              #    0.90  insns per cycle
      
      	       0.087693543 seconds time elapsed
      	$ diff orig new
      	$
      
      Changelog[v2]:
      
      [Arnaldo Carvalho] Cache in existing global objects rather than create
                         new static/globals in functions.
      Reported-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Anton Blanchard <anton@au1.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20141022000958.GB2228@us.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7d073b33
    • Masami Hiramatsu's avatar
      perf probe: Trivial typo fix for --demangle · 4cdcc33d
      Masami Hiramatsu authored
      Replace "Disable" with "Enable", since --demangle option enables symbol
      demangling, not disable it.
      
      perf probe has --demangle and --no-demangle options, but the
      command-line help (--help) shows only --demangle option. So it should
      explain about --demangle.
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20141027203124.21219.68278.stgit@localhost.localdomainSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4cdcc33d
    • Jiri Olsa's avatar
      perf tools: Fix report -F dso_from for data without branch info · 288a4b91
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F dso_from
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-8-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      288a4b91
    • Jiri Olsa's avatar
      perf tools: Fix report -F dso_to for data without branch info · 8b62fa59
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F dso_to
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-7-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8b62fa59
    • Jiri Olsa's avatar
      perf tools: Fix report -F symbol_from for data without branch info · 1b9e97a2
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F symbol_from
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-6-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1b9e97a2
    • Jiri Olsa's avatar
      perf tools: Fix report -F symbol_to for data without branch info · 38cdbd39
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F symbol_to
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-5-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      38cdbd39
    • Jiri Olsa's avatar
      perf tools: Fix report -F mispredict for data without branch info · 428560e7
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F mispredict
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-4-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      428560e7
    • Jiri Olsa's avatar
      perf tools: Fix report -F in_tx for data without branch info · 0199d244
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F in_tx
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-3-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0199d244
    • Jiri Olsa's avatar
      perf tools: Fix report -F abort for data without branch info · 49f47443
      Jiri Olsa authored
      The branch field sorting code assumes hist_entry::branch_info is
      allocated, which is wrong and following perf session ends up with report
      segfault.
      
        $ perf record ls
        $ perf report -F abort
        perf: Segmentation fault
      
      Checking that hist_entry::branch_info is valid and display "N/A" string
      in snprint callback if it's not.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1413468427-31049-2-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49f47443