perf changes for v3.17
Subsystems (10)
Linus,
Please pull the latest perf-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-core-for-linus
# HEAD: f9b9f812235d53f774a083e88a5a23b517a69752 Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core
Kernel side changes:
* Consolidate the PMU interrupt-disabled code amongst architectures (Vince Weaver)
* misc fixes
Tooling changes:
- New features, user visible changes:
* Add support for pagefault tracing in 'trace', please see multiple examples in the changeset messages (Stanislav Fomichev).
* Add pagefault statistics in 'trace' (Stanislav Fomichev)
* Add header for columns in 'top' and 'report' TUI browsers (Jiri Olsa)
* Add pagefault statistics in 'trace' (Stanislav Fomichev)
* Add IO mode into timechart command (Stanislav Fomichev)
* Fallback to syscalls:* when raw_syscalls:* is not available in the perl and python perf scripts. (Daniel Bristot de Oliveira)
* Add --repeat global option to 'perf bench' to be used in benchmarks such as the existing 'futex' one, that was modified to use it instead of a local option. (Davidlohr Bueso)
* Fix fd -> pathname resolution in 'trace', be it using /proc or a vfs_getname probe point. (Arnaldo Carvalho de Melo)
* Add suggestion of how to set perf_event_paranoid sysctl, to help non-root users trying tools like 'trace' to get a working environment. (Arnaldo Carvalho de Melo)
* Updates from trace-cmd for traceevent plugin_kvm plus args cleanup (Steven Rostedt, Jan Kiszka)
* Support S/390 in 'perf kvm stat' (Alexander Yarygin)
- Infrastructure changes:
* Allow reserving a row for header purposes in the hists browser (Arnaldo Carvalho de Melo)
* Various fixes and prep work related to supporting Intel PT (Adrian Hunter)
* Introduce multiple debug variables control (Jiri Olsa)
* Add callchain and additional sample information for python scripts (Joseph Schuchart)
* More prep work to support Intel PT: (Adrian Hunter)
- Polishing 'script' BTS output
- 'inject' can specify --kallsym
- VDSO is per machine, not a global var
- Expose data addr lookup functions previously private to 'script'
- Large mmap fixes in events processing
* Include standard stringify macros in power pc code (Sukadev Bhattiprolu)
- Cleanups:
* Convert open coded equivalents to asprintf() (Andy Shevchenko)
* Remove needless reassignments in 'trace' (Arnaldo Carvalho de Melo)
* Cache the is_exit syscall test in 'trace) (Arnaldo Carvalho de Melo)
* No need to reimplement err() in 'perf bench sched-messaging', drop barf(). (Davidlohr Bueso).
* Remove ev_name argument from perf_evsel__hists_browse, can be obtained from the other parameters. (Jiri Olsa)
- Fixes:
* Fix memory leak in the 'sched-messaging' perf bench test. (Davidlohr Bueso)
* The -o and -n 'perf bench mem' options are mutually exclusive, emit error when both are specified. (Davidlohr Bueso)
* Fix scrollbar refresh row index in the ui browser, problem exposed now that headers will be added and will be allowed to be switched on/off. (Jiri Olsa)
* Handle the num array type in python properly (Sebastian Andrzej Siewior)
* Fix wrong condition for allocation failure (Jiri Olsa)
* Adjust callchain based on DWARF debug info on powerpc (Sukadev Bhattiprolu)
* Fix a risk for doing free on uninitialized pointer in traceevent lib (Rickard Strandqvist)
* Update attr test with PERF_FLAG_FD_CLOEXEC flag (Jiri Olsa)
* Enable close-on-exec flag on perf file descriptor (Yann Droneaud)
* Fix build on gcc 4.4.7 (Arnaldo Carvalho de Melo)
* Event ordering fixes (Jiri Olsa)
Thanks,
Ingo
------------------>
Adrian Hunter (43):
perf machine: Fix the value used for unknown pids perf script: Display PERF_RECORD_MISC_COMM_EXEC flag perf record: Select comm_exec flag if supported
perf tools: Fix missing kernel map load
perf symbols: Fix missing GNU IFUNC symbols
perf inject: Fix build id injection
perf callchain: Fix appending a callchain from a previous sample perf buildid-cache: Apply force option to copying kcore perf symbols: Record whether a dso is 64-bit
perf symbols: Do not attempt to read data from kallsyms perf symbols: Add ability to iterate over a dso's symbols perf session: Flag if the event stream is entirely in memory perf evlist: Pass mmap parameters in a struct
perf tools: Add feature test for __sync_val_compare_and_swap perf tools: Add option macro OPT_CALLBACK_OPTARG
perf evsel: Add 'no_aux_samples' option
perf evsel: Add 'immediate' option
perf machine: Fix map groups of threads with unknown pids perf thread: Allow deletion of a thread with no map groups perf machine: Fix leak of 'struct thread' on error path perf tools: Allow TSC conversion on any arch
perf tools: Fix incorrect fd error comparison
perf tools: Fix jump label always changing during tracing perf script: Improve srcline display for BTS
perf script: Do not print dangling '=>' for BTS
perf tools: Record whether a dso has data
perf tools: Add dso__data_status_seen()
perf tools: Add dsos__hit_all()
perf tools: Add cpu to struct thread
perf machine: Add ability to record the current tid for each cpu perf tools: Move rdtsc() function
perf tools: Add dso__data_size()
perf tools: Pass machine to vdso__dso_findnew()
perf session: Add ability to 'skip' a non-piped event stream perf session: Add ability to skip 4GiB or more
perf tools: Group VDSO global variables into a structure perf machine: Fix the lifetime of the VDSO temporary file perf tools: Add vdso__new()
perf tools: Separate the VDSO map name from the VDSO dso name perf tools: Add dso__type()
perf tools: Add thread parameter to vdso__dso_findnew() perf tools: Expose 'addr' functions so they can be reused perf inject: Add --kallsyms parameter
Alexander Yarygin (8):
perf kvm: Introduce HAVE_KVM_STAT_SUPPORT flag perf kvm: Simplify exit reasons tables definitions perf kvm: Refactoring of cpu_isa_config() perf tools: Allow to use cpuinfo on s390 perf kvm: Use defines of kvm events
perf kvm: Move arch specific code into arch/ perf kvm: Add skip_event() for --duration option perf kvm: Add stat support on s390
Andy Shevchenko (1):
perf tools: Convert open coded equivalents to asprintf()
Arnaldo Carvalho de Melo (13):
perf trace: Fix up fd -> pathname resolution
perf evlist: Add suggestion of how to set perf_event_paranoid sysctl perf trace: Remove needless reassignments
perf trace: Cache the is_exit syscall test
perf ui browser: Add ->rows to disambiguate from ->height perf ui browser: Allow overriding refresh_dimensions method perf hists browser: Introduce gotorc method
perf hists browser: Override ui_browser refresh_dimensions method perf hists browser: Add support for showing columns header perf hists browser: Left justify column headers
perf tools: Suggest using -f to override perf.data file ownership message perf trace: Fix build on 32-bit systems
perf tools: Fix build on gcc 4.4.7
Daniel Bristot de Oliveira (1):
perf scripts: Fallback to syscalls:* when raw_syscalls:* is not available
Davidlohr Bueso (5):
perf bench sched-messaging: Plug memleak
perf bench: Add --repeat option
perf bench futex: Use global --repeat option
perf bench mem: The -o and -n options are mutually exclusive perf bench sched-messaging: Drop barf()
Jan Kiszka (3):
tools lib traceevent: Report unknown VMX exit reasons with code tools lib traceevent: Factor out print_exit_reason in kvm plugin tools lib traceevent: Fix and cleanup kvm_nested_vmexit tracepoints
Jiri Olsa (19):
perf hists browser: Remove ev_name argument from perf_evsel__hists_browse perf ui browser: Fix scrollbar refresh row index
perf tools: Fix wrong condition for allocation failure
perf: Make perf_event_init_context() function static
perf hists browser: Display columns header text on 'H' press perf hists browser: Add ui.show-headers config file option
perf: Add vm_ops->name call for mmap event name retrieval perf tools: Remove verbose from functions prototypes
perf tools: Move pr_* debug macros into debug object
perf tools: Factor eprintf to allow different debug variables perf tools: Add --debug optionto set debug variable
perf tools: Remove needless getopt.h includes
perf tests: Update attr test with PERF_FLAG_FD_CLOEXEC flag perf session: Fix accounting of ordered samples queue
perf record: Always force PERF_RECORD_FINISHED_ROUND event perf record: Store PERF_RECORD_FINISHED_ROUND only for nonempty rounds
perf: Check permission only for parent tracepoint event
perf tools: Fix perf usage string leftover
Revert "perf tools: Fix jump label always changing during tracing"
Joseph Schuchart (3):
perf script: Add missing calls to Py_DECREF for return values perf script: Add callchain to generic and tracepoint events perf script: Provide additional sample information on generic events
Rasmus Villemoes (1):
perf/x86: Micro-optimize nhmex_rbox_get_constraint()
Rickard Strandqvist (1):
tools lib traceevent: Fix a risk for doing free on uninitialized pointer
Sebastian Andrzej Siewior (2):
perf script: Move the number processing into its own function perf script: Handle the num array type in python properly
Stanislav Fomichev (9):
perf trace: Add perf_event parameter to tracepoint_handler perf trace: Add support for pagefault tracing perf trace: Add pagefaults record and replay support perf trace: Add possibility to switch off syscall events perf trace: Add pagefault statistics
perf timechart: Fix rendering in Firefox
perf timechart: Implement IO mode
perf timechart: Conditionally update start_time on fork perf timechart: Add more options to IO mode
Steven Rostedt (3):
tools lib traceevent: Fix format in plugin_kvm
tools lib traceevent: Clean up format of args in cfg80211 plugin tools lib traceevent: Clean up format of args in jbd2 plugin
Steven Rostedt (Red Hat) (1):
tools lib traceevent: Add back in kvm plugins nested_vmexit events
Sukadev Bhattiprolu (2):
perf tools powerpc: Adjust callchain based on DWARF debug info perf powerpc: Include util/util.h and remove stringify macros
Vince Weaver (6):
arc, perf: Use common PMU interrupt disabled code blackfin, perf: Use common PMU interrupt disabled code metag, perf: Use common PMU interrupt disabled code s390, perf: Use common PMU interrupt disabled code sh, perf: Use common PMU interrupt disabled code powerpc, perf: Use common PMU interrupt disabled code
Yann Droneaud (1):
perf tools: Enable close-on-exec flag on perf file descriptor
Zhouyi Zhou (1):
perf/x86/amd: Try to fix some mem allocation failure handling
arch/arc/kernel/perf_event.c | 7 +- arch/blackfin/kernel/perf_event.c | 15 +- arch/metag/kernel/perf/perf_event.c | 19 +- arch/powerpc/perf/hv-24x7.c | 6 +- arch/powerpc/perf/hv-gpci.c | 6 +- arch/s390/include/uapi/asm/Kbuild | 1 + arch/s390/include/uapi/asm/kvm_perf.h | 25 + arch/s390/kernel/perf_cpum_cf.c | 12 +- arch/sh/kernel/perf_event.c | 15 +- arch/x86/include/uapi/asm/Kbuild | 1 + arch/x86/include/uapi/asm/kvm_perf.h | 16 + arch/x86/kernel/cpu/perf_event_amd_uncore.c | 111 +++- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 5 +- kernel/events/core.c | 8 +- kernel/trace/trace_event_perf.c | 12 + tools/lib/traceevent/event-parse.c | 6 +- tools/lib/traceevent/plugin_cfg80211.c | 3 +- tools/lib/traceevent/plugin_jbd2.c | 6 +- tools/lib/traceevent/plugin_kvm.c | 64 +- tools/perf/Documentation/perf-bench.txt | 4 + tools/perf/Documentation/perf-inject.txt | 3 + tools/perf/Documentation/perf-kvm.txt | 16 +- tools/perf/Documentation/perf-timechart.txt | 38 +- tools/perf/Documentation/perf-trace.txt | 46 ++ tools/perf/Documentation/perf.txt | 10 +- tools/perf/MANIFEST | 3 + tools/perf/Makefile.perf | 4 + tools/perf/arch/powerpc/Makefile | 1 + tools/perf/arch/powerpc/util/header.c | 4 +- tools/perf/arch/powerpc/util/skip-callchain-idx.c | 266 ++++++++ tools/perf/arch/s390/Makefile | 3 + tools/perf/arch/s390/util/header.c | 28 + tools/perf/arch/s390/util/kvm-stat.c | 105 ++++ tools/perf/arch/x86/Makefile | 2 + tools/perf/arch/x86/tests/dwarf-unwind.c | 1 + tools/perf/arch/x86/util/kvm-stat.c | 156 +++++ tools/perf/arch/x86/util/tsc.c | 31 +- tools/perf/arch/x86/util/tsc.h | 3 - tools/perf/arch/x86/util/unwind-libunwind.c | 1 + tools/perf/bench/bench.h | 1 + tools/perf/bench/futex-requeue.c | 10 +- tools/perf/bench/futex-wake.c | 12 +- tools/perf/bench/mem-memcpy.c | 9 +- tools/perf/bench/mem-memset.c | 9 +- tools/perf/bench/sched-messaging.c | 47 +- tools/perf/builtin-bench.c | 7 + tools/perf/builtin-buildid-cache.c | 8 +- tools/perf/builtin-evlist.c | 1 + tools/perf/builtin-help.c | 1 + tools/perf/builtin-inject.c | 5 + tools/perf/builtin-kvm.c | 414 ++++-------- tools/perf/builtin-record.c | 7 +- tools/perf/builtin-sched.c | 16 +- tools/perf/builtin-script.c | 60 +- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-timechart.c | 694 ++++++++++++++++++++- tools/perf/builtin-trace.c | 266 ++++++-- tools/perf/config/Makefile | 14 + tools/perf/config/feature-checks/Makefile | 4 + tools/perf/config/feature-checks/test-all.c | 5 + .../feature-checks/test-sync-compare-and-swap.c | 14 + tools/perf/perf-sys.h | 1 + tools/perf/perf.c | 13 +- tools/perf/scripts/perl/bin/failed-syscalls-record | 3 +- tools/perf/scripts/perl/failed-syscalls.pl | 5 + .../python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 3 +- .../python/bin/failed-syscalls-by-pid-record | 3 +- tools/perf/scripts/python/bin/sctop-record | 3 +- .../python/bin/syscall-counts-by-pid-record | 3 +- .../perf/scripts/python/bin/syscall-counts-record | 3 +- tools/perf/scripts/python/check-perf-trace.py | 4 +- .../perf/scripts/python/failed-syscalls-by-pid.py | 7 +- tools/perf/scripts/python/futex-contention.py | 4 +- tools/perf/scripts/python/net_dropmonitor.py | 2 +- tools/perf/scripts/python/netdev-times.py | 26 +- tools/perf/scripts/python/sched-migration.py | 41 +- tools/perf/scripts/python/sctop.py | 7 +- tools/perf/scripts/python/syscall-counts-by-pid.py | 7 +- tools/perf/scripts/python/syscall-counts.py | 7 +- tools/perf/tests/attr/base-record | 3 +- tools/perf/tests/attr/base-stat | 3 +- tools/perf/tests/bp_signal.c | 4 +- tools/perf/tests/bp_signal_overflow.c | 4 +- tools/perf/tests/dso-data.c | 1 + tools/perf/tests/evsel-roundtrip-name.c | 1 + tools/perf/tests/evsel-tp-sched.c | 1 + tools/perf/tests/open-syscall-tp-fields.c | 1 + tools/perf/tests/parse-events.c | 1 + tools/perf/tests/parse-no-sample-id-all.c | 1 + tools/perf/tests/perf-time-to-tsc.c | 12 +- tools/perf/tests/rdpmc.c | 4 +- tools/perf/tests/sample-parsing.c | 1 + tools/perf/tests/thread-mg-share.c | 1 + tools/perf/ui/browser.c | 39 +- tools/perf/ui/browser.h | 3 +- tools/perf/ui/browsers/hists.c | 153 ++++- tools/perf/ui/stdio/hist.c | 2 +- tools/perf/util/callchain.c | 2 +- tools/perf/util/callchain.h | 13 + tools/perf/util/cloexec.c | 57 ++ tools/perf/util/cloexec.h | 6 + tools/perf/util/config.c | 13 + tools/perf/util/data.c | 3 +- tools/perf/util/debug.c | 56 +- tools/perf/util/debug.h | 22 + tools/perf/util/dso.c | 71 ++- tools/perf/util/dso.h | 26 + tools/perf/util/event.c | 52 +- tools/perf/util/event.h | 10 + tools/perf/util/evlist.c | 51 +- tools/perf/util/evsel.c | 26 +- tools/perf/util/evsel.h | 2 + tools/perf/util/header.c | 51 +- tools/perf/util/header.h | 2 + tools/perf/util/include/linux/kernel.h | 21 - tools/perf/util/kvm-stat.h | 140 +++++ tools/perf/util/machine.c | 139 ++++- tools/perf/util/machine.h | 8 + tools/perf/util/map.c | 47 +- tools/perf/util/map.h | 15 +- tools/perf/util/parse-options.h | 5 + tools/perf/util/probe-finder.c | 1 - tools/perf/util/pstack.c | 1 + tools/perf/util/python.c | 4 +- tools/perf/util/record.c | 27 +- .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 197 +++++- tools/perf/util/session.c | 39 +- tools/perf/util/session.h | 3 + tools/perf/util/sort.c | 2 +- tools/perf/util/svghelper.c | 168 +++-- tools/perf/util/svghelper.h | 6 +- tools/perf/util/symbol-elf.c | 41 +- tools/perf/util/symbol-minimal.c | 43 ++ tools/perf/util/symbol.c | 21 +- tools/perf/util/symbol.h | 9 +- tools/perf/util/thread.c | 13 +- tools/perf/util/thread.h | 1 + tools/perf/util/trace-event-info.c | 13 +- tools/perf/util/trace-event-read.c | 2 +- tools/perf/util/tsc.c | 30 + tools/perf/util/tsc.h | 12 + tools/perf/util/unwind-libdw.c | 1 + tools/perf/util/unwind-libunwind.c | 1 + tools/perf/util/util.c | 10 +- tools/perf/util/vdso.c | 97 ++- tools/perf/util/vdso.h | 13 +- 147 files changed, 3699 insertions(+), 941 deletions(-) create mode 100644 arch/s390/include/uapi/asm/kvm_perf.h create mode 100644 arch/x86/include/uapi/asm/kvm_perf.h create mode 100644 tools/perf/arch/powerpc/util/skip-callchain-idx.c create mode 100644 tools/perf/arch/s390/util/header.c create mode 100644 tools/perf/arch/s390/util/kvm-stat.c create mode 100644 tools/perf/arch/x86/util/kvm-stat.c create mode 100644 tools/perf/config/feature-checks/test-sync-compare-and-swap.c create mode 100644 tools/perf/util/cloexec.c create mode 100644 tools/perf/util/cloexec.h create mode 100644 tools/perf/util/kvm-stat.h create mode 100644 tools/perf/util/tsc.c create mode 100644 tools/perf/util/tsc.h
arch/arc/kernel/perf_event.c +3 -4
@@ -99,10 +99,6 @@ static int arc_pmu_event_init(struct perf_event *event)struct hw_perf_event *hwc = &event->hw;int ret; -/* ARC 700 PMU does not support sampling events */ -if (is_sampling_event (event)) -return -ENOENT ; -switch (event->attr.type) {case PERF_TYPE_HARDWARE :if (event->attr.config >=PERF_COUNT_HW_MAX )
@@ -298,6 +294,9 @@ static int arc_pmu_device_probe(struct platform_device *pdev) .read = arc_pmu_read, }; +/* ARC 700 PMU does not support sampling events */ + arc_pmu->pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + ret =perf_pmu_register (&arc_pmu->pmu, pdev->name,PERF_TYPE_RAW );return ret;
arch/blackfin/kernel/perf_event.c +7 -8
@@ -389,14 +389,6 @@ static int bfin_pmu_event_init(struct perf_event *event)if (attr->exclude_hv || attr->exclude_idle)return -EPERM ; -/* -* All of the on-chip counters are "limited", in that they have -* no interrupts, and are therefore unable to do sampling without -* further work and timer assistance. -*/ -if (hwc->sample_period) -return -EINVAL ; - ret =0 ;switch (attr->type) {case PERF_TYPE_RAW :
@@ -490,6 +482,13 @@ static int __init bfin_pmu_init(void) {int ret; +/* +* All of the on-chip counters are "limited", in that they have +* no interrupts, and are therefore unable to do sampling without +* further work and timer assistance. +*/ + pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + ret =perf_pmu_register (&pmu,"cpu" ,PERF_TYPE_RAW );if (!ret)perf_cpu_notifier (bfin_pmu_notifier);
arch/metag/kernel/perf/perf_event.c +9 -10
@@ -568,16 +568,6 @@ static int _hw_perf_event_init(struct perf_event *event)return -EINVAL ;/* -* Early cores have "limited" counters - they have no overflow -* interrupts - and so are unable to do sampling without extra work -* and timer assistance. -*/ -if (metag_pmu->max_period ==0 ) { -if (hwc->sample_period) -return -EINVAL ; - } - -/* * Don't assign an index until the event is placed into the hardware. * -1 signifies that we're still deciding where to put it. On SMP * systems each core has its own set of counters, so we can't do any
@@ -866,6 +856,15 @@ static int __init init_hw_perf_events(void)pr_info ("enabled with %s PMU driver, %d counters available\n" , metag_pmu->name, metag_pmu->max_events); +/* +* Early cores have "limited" counters - they have no overflow +* interrupts - and so are unable to do sampling without extra work +* and timer assistance. +*/ +if (metag_pmu->max_period ==0 ) { + metag_pmu->pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + } +/* Initialise the active events and reservation mutex */ atomic_set (&metag_pmu->active_events,0 );mutex_init (&metag_pmu->reserve_mutex);
arch/powerpc/perf/hv-24x7.c +4 -2
@@ -387,8 +387,7 @@ static int h_24x7_event_init(struct perf_event *event) event->attr.exclude_hv || event->attr.exclude_idle || event->attr.exclude_host || - event->attr.exclude_guest || - is_sampling_event(event)) /* no sampling */ + event->attr.exclude_guest) return -EINVAL;/* no branch sampling */
@@ -513,6 +512,9 @@ static int hv_24x7_init(void)if (!hv_page_cache)return -ENOMEM ; +/* sampling not supported */ + h_24x7_pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + r =perf_pmu_register (&h_24x7_pmu, h_24x7_pmu.name,-1 );if (r)return r;
arch/powerpc/perf/hv-gpci.c +4 -2
@@ -210,8 +210,7 @@ static int h_gpci_event_init(struct perf_event *event) event->attr.exclude_hv || event->attr.exclude_idle || event->attr.exclude_host || - event->attr.exclude_guest || - is_sampling_event(event)) /* no sampling */ + event->attr.exclude_guest) return -EINVAL;/* no branch sampling */
@@ -284,6 +283,9 @@ static int hv_gpci_init(void)return -ENODEV ; } +/* sampling not supported */ + h_gpci_pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + r =perf_pmu_register (&h_gpci_pmu, h_gpci_pmu.name,-1 );if (r)return r;
arch/s390/include/uapi/asm/Kbuild +1 -0
@@ -16,6 +16,7 @@ header-y += ioctls.h header-y += ipcbuf.h header-y += kvm.h header-y += kvm_para.h +header-y += kvm_perf.h header-y += kvm_virtio.h header-y += mman.h header-y += monwriter.h
arch/s390/include/uapi/asm/kvm_perf.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Definitions for perf-kvm on s390 +* +* Copyright 2014 IBM Corp. +* Author(s): Alexander Yarygin <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License (version 2 only) +* as published by the Free Software Foundation. +*/ + +#ifndef __LINUX_KVM_PERF_S390_H +#define __LINUX_KVM_PERF_S390_H + +#include <asm/sie.h> + +#define DECODE_STR_LEN 40 + +#define VCPU_ID "id" + +#define KVM_ENTRY_TRACE "kvm:kvm_s390_sie_enter" +#define KVM_EXIT_TRACE "kvm:kvm_s390_sie_exit" +#define KVM_EXIT_REASON "icptcode" + +#endif
arch/s390/kernel/perf_cpum_cf.c +6 -6
@@ -411,12 +411,6 @@ static int cpumf_pmu_event_init(struct perf_event *event)case PERF_TYPE_HARDWARE :case PERF_TYPE_HW_CACHE :case PERF_TYPE_RAW : -/* The CPU measurement counter facility does not have overflow -* interrupts to do sampling. Sampling must be provided by -* external means, for example, by timers. -*/ -if (is_sampling_event (event)) -return -ENOENT ; err =__hw_perf_event_init (event);break ;default :
@@ -681,6 +675,12 @@ static int __init cpumf_pmu_init(void) goto out; } +/* The CPU measurement counter facility does not have overflow +* interrupts to do sampling. Sampling must be provided by +* external means, for example, by timers. +*/ + cpumf_pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; + cpumf_pmu.attr_groups =cpumf_cf_event_group (); rc =perf_pmu_register (&cpumf_pmu,"cpum_cf" ,PERF_TYPE_RAW );if (rc) {
arch/sh/kernel/perf_event.c +7 -8
@@ -129,14 +129,6 @@ static int __hw_perf_event_init(struct perf_event *event)return -ENODEV ;/* -* All of the on-chip counters are "limited", in that they have -* no interrupts, and are therefore unable to do sampling without -* further work and timer assistance. -*/ -if (hwc->sample_period) -return -EINVAL ; - -/* * See if we need to reserve the counter. * * If no events are currently in use, then we have to take a
@@ -392,6 +384,13 @@ int register_sh_pmu(struct sh_pmu *_pmu)pr_info ("Performance Events: %s support registered\n" , _pmu->name); +/* +* All of the on-chip counters are "limited", in that they have +* no interrupts, and are therefore unable to do sampling without +* further work and timer assistance. +*/ + pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; +WARN_ON (_pmu->num_events >MAX_HWEVENTS );perf_pmu_register (&pmu,"cpu" ,PERF_TYPE_RAW );
arch/x86/include/uapi/asm/Kbuild +1 -0
@@ -22,6 +22,7 @@ header-y += ipcbuf.h header-y += ist.h header-y += kvm.h header-y += kvm_para.h +header-y += kvm_perf.h header-y += ldt.h header-y += mce.h header-y += mman.h
arch/x86/include/uapi/asm/kvm_perf.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifndef _ASM_X86_KVM_PERF_H +#define _ASM_X86_KVM_PERF_H + +#include <asm/svm.h> +#include <asm/vmx.h> +#include <asm/kvm.h> + +#define DECODE_STR_LEN 20 + +#define VCPU_ID "vcpu_id" + +#define KVM_ENTRY_TRACE "kvm:kvm_entry" +#define KVM_EXIT_TRACE "kvm:kvm_exit" +#define KVM_EXIT_REASON "exit_reason" + +#endif /* _ASM_X86_KVM_PERF_H */
arch/x86/kernel/cpu/perf_event_amd_uncore.c +84 -27
174 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -4
@@ -2947,10 +2947,7 @@ again:* extra registers. If we failed to take an extra * register, try the alternative. */ -if (idx %2 ) - idx--; -else - idx++; + idx ^=1 ;if (idx != reg1->idx %6 ) {if (idx ==2 ) config1 >>=8 ;
kernel/events/core.c +7 -1
@@ -5266,6 +5266,12 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) goto got_name; }else { +if (vma->vm_ops && vma->vm_ops->name) { + name = (char *) vma->vm_ops->name (vma); +if (name) + goto cpy_name; + } + name = (char *)arch_vma_name (vma);if (name) goto cpy_name;
@@ -7804,7 +7810,7 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,/* * Initialize the perf_event context in task_struct */ -int perf_event_init_context (struct task_struct *child,int ctxn) +static int perf_event_init_context (struct task_struct *child,int ctxn) {struct perf_event_context *child_ctx, *parent_ctx;struct perf_event_context *cloned_ctx;
kernel/trace/trace_event_perf.c +12 -0
@@ -30,6 +30,18 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event,return ret; } +/* +* We checked and allowed to create parent, +* allow children without checking. +*/ +if (p_event->parent) +return 0 ; + +/* +* It's ok to check current process (owner) permissions in here, +* because code below is called only via perf_event_open syscall. +*/ +/* The ftrace function trace is allowed only for root. */ if (ftrace_event_is_function (tp_event)) {if (perf_paranoid_tracepoint_raw () && !capable (CAP_SYS_ADMIN ))
tools/lib/traceevent/event-parse.c +3 -3
@@ -2395,7 +2395,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok) {struct print_arg *field;enum event_type type; -char *token; +char *token =NULL ;memset (arg,0 ,sizeof (*arg)); arg->type =PRINT_FLAGS ;
@@ -2448,7 +2448,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok) {struct print_arg *field;enum event_type type; -char *token; +char *token =NULL ;memset (arg,0 ,sizeof (*arg)); arg->type =PRINT_SYMBOL ;
@@ -2487,7 +2487,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) {struct print_arg *field;enum event_type type; -char *token; +char *token =NULL ;memset (arg,0 ,sizeof (*arg)); arg->type =PRINT_HEX ;
tools/lib/traceevent/plugin_cfg80211.c +1 -2
@@ -5,8 +5,7 @@#include "event-parse.h" static unsigned long long -process___le16_to_cpup (struct trace_seq *s, -unsigned long long *args) +process___le16_to_cpup (struct trace_seq *s,unsigned long long *args) {uint16_t *val = (uint16_t *) (unsigned long ) args[0 ];return val ? (long long )le16toh (*val) :0 ;
tools/lib/traceevent/plugin_jbd2.c +2 -4
@@ -30,8 +30,7 @@#define MINOR (dev) ((unsigned int) ((dev) & MINORMASK))static unsigned long long -process_jbd2_dev_to_name (struct trace_seq *s, -unsigned long long *args) +process_jbd2_dev_to_name (struct trace_seq *s,unsigned long long *args) {unsigned int dev = args[0 ];
@@ -40,8 +39,7 @@ process_jbd2_dev_to_name(struct trace_seq *s, }static unsigned long long -process_jiffies_to_msecs (struct trace_seq *s, -unsigned long long *args) +process_jiffies_to_msecs (struct trace_seq *s,unsigned long long *args) {unsigned long long jiffies = args[0 ];
tools/lib/traceevent/plugin_kvm.c +56 -8
99 lines not on this page · raw message
tools/perf/Documentation/perf-bench.txt +4 -0
@@ -16,6 +16,10 @@ This 'perf bench' command is a general framework for benchmark suites. COMMON OPTIONS -------------- +-r:: +--repeat=:: +Specify amount of times to repeat the run (default 10). + -f:: --format=:: Specify format style.
tools/perf/Documentation/perf-inject.txt +3 -0
@@ -41,6 +41,9 @@ OPTIONS tasks slept. sched_switch contains a callchain where a task slept and sched_stat contains a timeslice how long a task slept. +--kallsyms=<file>:: + kallsyms pathname + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-archive[1]
tools/perf/Documentation/perf-kvm.txt +9 -7
@@ -51,9 +51,9 @@ There are a couple of variants of perf kvm: 'perf kvm stat <command>' to run a command and gather performance counter statistics. Especially, perf 'kvm stat record/report' generates a statistical analysis - of KVM events. Currently, vmexit, mmio and ioport events are supported. - 'perf kvm stat record <command>' records kvm events and the events between - start and end <command>. + of KVM events. Currently, vmexit, mmio (x86 only) and ioport (x86 only) + events are supported. 'perf kvm stat record <command>' records kvm events + and the events between start and end <command>. And this command produces a file which contains tracing results of kvm events.
@@ -103,8 +103,8 @@ STAT REPORT OPTIONS analyze events which occures on this vcpu. (default: all vcpus) --event=<value>:: - event to be analyzed. Possible values: vmexit, mmio, ioport. - (default: vmexit) + event to be analyzed. Possible values: vmexit, mmio (x86 only), + ioport (x86 only). (default: vmexit) -k:: --key=<value>:: Sorting key. Possible values: sample (default, sort by samples
@@ -138,7 +138,8 @@ STAT LIVE OPTIONS --event=<value>:: - event to be analyzed. Possible values: vmexit, mmio, ioport. + event to be analyzed. Possible values: vmexit, + mmio (x86 only), ioport (x86 only). (default: vmexit) -k::
@@ -147,7 +148,8 @@ STAT LIVE OPTIONS number), time (sort by average time). --duration=<value>:: - Show events other than HLT that take longer than duration usecs. + Show events other than HLT (x86 only) or Wait state (s390 only) + that take longer than duration usecs. SEE ALSO --------
tools/perf/Documentation/perf-timechart.txt +36 -2
@@ -15,10 +15,20 @@ DESCRIPTION There are two variants of perf timechart: 'perf timechart record <command>' to record the system level events - of an arbitrary workload. + of an arbitrary workload. By default timechart records only scheduler + and CPU events (task switches, running times, CPU power states, etc), + but it's possible to record IO (disk, network) activity using -I argument. 'perf timechart' to turn a trace into a Scalable Vector Graphics file, - that can be viewed with popular SVG viewers such as 'Inkscape'. + that can be viewed with popular SVG viewers such as 'Inkscape'. Depending + on the events in the perf.data file, timechart will contain scheduler/cpu + events or IO events. + + In IO mode, every bar has two charts: upper and lower. + Upper bar shows incoming events (disk reads, ingress network packets). + Lower bar shows outgoing events (disk writes, egress network packets). + There are also poll bars which show how much time application spent + in poll/epoll/select syscalls. TIMECHART OPTIONS -----------------
@@ -54,6 +64,19 @@ TIMECHART OPTIONS duration or tasks with given name. If number is given it's interpreted as number of nanoseconds. If non-numeric string is given it's interpreted as task name. +--io-skip-eagain:: + Don't draw EAGAIN IO events. +--io-min-time=<nsecs>:: + Draw small events as if they lasted min-time. Useful when you need + to see very small and fast IO. It's possible to specify ms or us + suffix to specify time in milliseconds or microseconds. + Default value is 1ms. +--io-merge-dist=<nsecs>:: + Merge events that are merge-dist nanoseconds apart. + Reduces number of figures on the SVG and makes it more render-friendly. + It's possible to specify ms or us suffix to specify time in + milliseconds or microseconds. + Default value is 1us. RECORD OPTIONS --------------
@@ -63,6 +86,9 @@ RECORD OPTIONS -T:: --tasks-only:: Record only tasks-related events +-I:: +--io-only:: + Record only io-related events -g:: --callchain:: Do call-graph (stack chain/backtrace) recording
@@ -87,6 +113,14 @@ Record system-wide timechart: $ perf timechart --highlight gcc +Record system-wide IO events: + + $ perf timechart record -I + + then generate timechart: + + $ perf timechart + SEE ALSO -------- linkperf:perf-record[1]
tools/perf/Documentation/perf-trace.txt +46 -0
52 lines not on this page · raw message
tools/perf/Documentation/perf.txt +9 -1
@@ -8,7 +8,15 @@ perf - Performance analysis tools for Linux SYNOPSIS -------- [verse] -'perf' [--version] [--help] COMMAND [ARGS] +'perf' [--version] [--help] [OPTIONS] COMMAND [ARGS] + +OPTIONS +------- +--debug:: + Setup debug variable (just verbose for now) in value + range (0, 10). Use like: + --debug verbose # sets verbose = 1 + --debug verbose=2 # sets verbose = 2 DESCRIPTION -----------
tools/perf/MANIFEST +3 -0
@@ -37,3 +37,6 @@ arch/x86/include/asm/kvm_host.h arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/vmx.h arch/x86/include/uapi/asm/kvm.h +arch/x86/include/uapi/asm/kvm_perf.h +arch/s390/include/uapi/asm/sie.h +arch/s390/include/uapi/asm/kvm_perf.h
tools/perf/Makefile.perf +4 -0
@@ -295,11 +295,13 @@ LIB_H += util/intlist.h LIB_H += util/perf_regs.h LIB_H += util/unwind.h LIB_H += util/vdso.h +LIB_H += util/tsc.h LIB_H += ui/helpline.h LIB_H += ui/progress.h LIB_H += ui/util.h LIB_H += ui/ui.h LIB_H += util/data.h +LIB_H += util/kvm-stat.h LIB_OBJS += $(OUTPUT)util/abspath.o LIB_OBJS += $(OUTPUT)util/alias.o
@@ -373,6 +375,8 @@ LIB_OBJS += $(OUTPUT)util/stat.o LIB_OBJS += $(OUTPUT)util/record.o LIB_OBJS += $(OUTPUT)util/srcline.o LIB_OBJS += $(OUTPUT)util/data.o +LIB_OBJS += $(OUTPUT)util/tsc.o +LIB_OBJS += $(OUTPUT)util/cloexec.o LIB_OBJS += $(OUTPUT)ui/setup.o LIB_OBJS += $(OUTPUT)ui/helpline.o
tools/perf/arch/powerpc/Makefile +1 -0
@@ -3,3 +3,4 @@ PERF_HAVE_DWARF_REGS := 1 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
tools/perf/arch/powerpc/util/header.c +1 -3
@@ -5,9 +5,7 @@#include <string.h> #include "../../util/header.h" - -#define __stringify_1 (x) #x -#define __stringify (x) __stringify_1(x) +#include "../../util/util.h" #define mfspr (rn) ({unsigned long rval; \ asm volatile("mfspr %0," __stringify(rn) \
tools/perf/arch/powerpc/util/skip-callchain-idx.c new file +266 -0
266 lines not on this page · raw message
tools/perf/arch/s390/Makefile +3 -0
@@ -2,3 +2,6 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o +HAVE_KVM_STAT_SUPPORT := 1 +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
tools/perf/arch/s390/util/header.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Implementation of get_cpuid(). +* +* Copyright 2014 IBM Corp. +* Author(s): Alexander Yarygin <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License (version 2 only) +* as published by the Free Software Foundation. +*/ + +#include <sys/types.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> + +#include "../../util/header.h" + +int get_cpuid (char *buffer,size_t sz) +{ +const char *cpuid ="IBM/S390" ; + +if (strlen (cpuid) +1 > sz) +return -1 ; + +strcpy (buffer, cpuid); +return 0 ; +}
tools/perf/arch/s390/util/kvm-stat.c new file +105 -0
105 lines not on this page · raw message
tools/perf/arch/x86/Makefile +2 -0
@@ -15,3 +15,5 @@ endif LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o LIB_H += arch/$(ARCH)/util/tsc.h +HAVE_KVM_STAT_SUPPORT := 1 +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
tools/perf/arch/x86/tests/dwarf-unwind.c +1 -0
@@ -3,6 +3,7 @@#include "thread.h" #include "map.h" #include "event.h" +#include "debug.h" #include "tests/tests.h" #define STACK_SIZE 8192
tools/perf/arch/x86/util/kvm-stat.c new file +156 -0
156 lines not on this page · raw message
tools/perf/arch/x86/util/tsc.c +10 -21
@@ -6,29 +6,9 @@#include "../../perf.h" #include <linux/types.h> #include "../../util/debug.h" +#include "../../util/tsc.h" #include "tsc.h" -u64 perf_time_to_tsc (u64 ns,struct perf_tsc_conversion *tc) -{ -u64 t, quot, rem; - - t = ns - tc->time_zero; - quot = t / tc->time_mult; - rem = t % tc->time_mult; -return (quot << tc->time_shift) + - (rem << tc->time_shift) / tc->time_mult; -} - -u64 tsc_to_perf_time (u64 cyc,struct perf_tsc_conversion *tc) -{ -u64 quot, rem; - - quot = cyc >> tc->time_shift; - rem = cyc & ((1 << tc->time_shift) -1 ); -return tc->time_zero + quot * tc->time_mult + - ((rem * tc->time_mult) >> tc->time_shift); -} -int perf_read_tsc_conversion (const struct perf_event_mmap_page *pc,struct perf_tsc_conversion *tc) {
@@ -57,3 +37,12 @@ int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,return 0 ; } + +u64 rdtsc (void ) +{ +unsigned int low, high; + + asmvolatile ("rdtsc" :"=a" (low),"=d" (high)); + +return low | ((u64 )high) <<32 ; +}
tools/perf/arch/x86/util/tsc.h +0 -3
@@ -14,7 +14,4 @@ struct perf_event_mmap_page;int perf_read_tsc_conversion (const struct perf_event_mmap_page *pc,struct perf_tsc_conversion *tc); -u64 perf_time_to_tsc (u64 ns,struct perf_tsc_conversion *tc); -u64 tsc_to_perf_time (u64 cyc,struct perf_tsc_conversion *tc); -#endif /* TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ */
tools/perf/arch/x86/util/unwind-libunwind.c +1 -0
@@ -3,6 +3,7 @@#include <libunwind.h> #include "perf_regs.h" #include "../../util/unwind.h" +#include "../../util/debug.h" #ifdef HAVE_ARCH_X86_64_SUPPORT int libunwind__arch_reg_id (int regnum)
tools/perf/bench/bench.h +1 -0
@@ -43,5 +43,6 @@ extern int bench_futex_requeue(int argc, const char **argv, const char *prefix);#define BENCH_FORMAT_UNKNOWN -1extern int bench_format; +extern unsigned int bench_repeat;#endif
tools/perf/bench/futex-requeue.c +1 -9
@@ -29,13 +29,6 @@ static u_int32_t futex1 = 0, futex2 = 0;*/ static unsigned int nrequeue =1 ; -/* -* There can be significant variance from run to run, -* the more repeats, the more exact the overall avg and -* the better idea of the futex latency. -*/ -static unsigned int repeat =10 ; -static pthread_t *worker;static bool done =0 , silent =0 ;static pthread_mutex_t thread_lock;
@@ -46,7 +39,6 @@ static unsigned int ncpus, threads_starting, nthreads = 0;static const struct option options[] = {OPT_UINTEGER ('t' ,"threads" , &nthreads,"Specify amount of threads" ),OPT_UINTEGER ('q' ,"nrequeue" , &nrequeue,"Specify amount of threads to requeue at once" ), -OPT_UINTEGER ('r' ,"repeat" , &repeat,"Specify amount of times to repeat the run" ),OPT_BOOLEAN ('s' ,"silent" , &silent,"Silent mode: do not display data/details" ),OPT_END () };
@@ -146,7 +138,7 @@ int bench_futex_requeue(int argc, const char **argv,pthread_cond_init (&thread_parent,NULL );pthread_cond_init (&thread_worker,NULL ); -for (j =0 ; j < repeat && !done; j++) { +for (j =0 ; j < bench_repeat && !done; j++) {unsigned int nrequeued =0 ;struct timeval start, end, runtime;
tools/perf/bench/futex-wake.c +2 -10
@@ -30,15 +30,8 @@ static u_int32_t futex1 = 0;*/ static unsigned int nwakes =1 ; -/* -* There can be significant variance from run to run, -* the more repeats, the more exact the overall avg and -* the better idea of the futex latency. -*/ -static unsigned int repeat =10 ; -pthread_t *worker; -static bool done =0 , silent =0 ; +static bool done = false, silent = false;static pthread_mutex_t thread_lock;static pthread_cond_t thread_parent, thread_worker;static struct stats waketime_stats, wakeup_stats;
@@ -47,7 +40,6 @@ static unsigned int ncpus, threads_starting, nthreads = 0;static const struct option options[] = {OPT_UINTEGER ('t' ,"threads" , &nthreads,"Specify amount of threads" ),OPT_UINTEGER ('w' ,"nwakes" , &nwakes,"Specify amount of threads to wake at once" ), -OPT_UINTEGER ('r' ,"repeat" , &repeat,"Specify amount of times to repeat the run" ),OPT_BOOLEAN ('s' ,"silent" , &silent,"Silent mode: do not display data/details" ),OPT_END () };
@@ -149,7 +141,7 @@ int bench_futex_wake(int argc, const char **argv,pthread_cond_init (&thread_parent,NULL );pthread_cond_init (&thread_worker,NULL ); -for (j =0 ; j < repeat && !done; j++) { +for (j =0 ; j < bench_repeat && !done; j++) {unsigned int nwoken =0 ;struct timeval start, end, runtime;
tools/perf/bench/mem-memcpy.c +8 -1
@@ -10,6 +10,7 @@#include "../util/util.h" #include "../util/parse-options.h" #include "../util/header.h" +#include "../util/cloexec.h" #include "bench.h" #include "mem-memcpy-arch.h"
@@ -83,7 +84,8 @@ static struct perf_event_attr cycle_attr = {static void init_cycle (void ) { - cycle_fd =sys_perf_event_open (&cycle_attr,getpid (),-1 ,-1 ,0 ); + cycle_fd =sys_perf_event_open (&cycle_attr,getpid (),-1 ,-1 , +perf_event_open_cloexec_flag ());if (cycle_fd <0 && errno ==ENOSYS )die ("No CONFIG_PERF_EVENTS=y kernel support configured?\n" );
@@ -189,6 +191,11 @@ int bench_mem_memcpy(int argc, const char **argv, argc =parse_options (argc, argv, options, bench_mem_memcpy_usage,0 ); +if (no_prefault && only_prefault) { +fprintf (stderr,"Invalid options: -o and -n are mutually exclusive\n" ); +return 1 ; + } +if (use_cycle)init_cycle ();
tools/perf/bench/mem-memset.c +8 -1
@@ -10,6 +10,7 @@#include "../util/util.h" #include "../util/parse-options.h" #include "../util/header.h" +#include "../util/cloexec.h" #include "bench.h" #include "mem-memset-arch.h"
@@ -83,7 +84,8 @@ static struct perf_event_attr cycle_attr = {static void init_cycle (void ) { - cycle_fd =sys_perf_event_open (&cycle_attr,getpid (),-1 ,-1 ,0 ); + cycle_fd =sys_perf_event_open (&cycle_attr,getpid (),-1 ,-1 , +perf_event_open_cloexec_flag ());if (cycle_fd <0 && errno ==ENOSYS )die ("No CONFIG_PERF_EVENTS=y kernel support configured?\n" );
@@ -181,6 +183,11 @@ int bench_mem_memset(int argc, const char **argv, argc =parse_options (argc, argv, options, bench_mem_memset_usage,0 ); +if (no_prefault && only_prefault) { +fprintf (stderr,"Invalid options: -o and -n are mutually exclusive\n" ); +return 1 ; + } +if (use_cycle)init_cycle ();
tools/perf/bench/sched-messaging.c +21 -26
143 lines not on this page · raw message
tools/perf/builtin-bench.c +7 -0
@@ -104,9 +104,11 @@ static const char *bench_format_str;/* Output/formatting style, exported to benchmark modules: */ int bench_format =BENCH_FORMAT_DEFAULT ; +unsigned int bench_repeat =10 ;/* default number of times to repeat the run */ static const struct option bench_options[] = {OPT_STRING ('f' ,"format" , &bench_format_str,"default" ,"Specify format style" ), +OPT_UINTEGER ('r' ,"repeat" , &bench_repeat,"Specify amount of times to repeat the run" ),OPT_END () };
@@ -226,6 +228,11 @@ int cmd_bench(int argc, const char **argv, const char *prefix __maybe_unused) goto end; } +if (bench_repeat ==0 ) { +printf ("Invalid repeat option: Must specify a positive value\n" ); + goto end; + } +if (argc <1 ) {print_usage (); goto end;
tools/perf/builtin-buildid-cache.c +5 -3
@@ -125,7 +125,8 @@ static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir,return ret; } -static int build_id_cache__add_kcore (const char *filename,const char *debugdir) +static int build_id_cache__add_kcore (const char *filename,const char *debugdir, +bool force) {char dir[32 ], sbuildid[BUILD_ID_SIZE *2 +1 ];char from_dir[PATH_MAX ], to_dir[PATH_MAX ];
@@ -144,7 +145,8 @@ static int build_id_cache__add_kcore(const char *filename, const char *debugdir)scnprintf (to_dir,sizeof (to_dir),"%s/[kernel.kcore]/%s" , debugdir, sbuildid); -if (!build_id_cache__kcore_existing (from_dir, to_dir,sizeof (to_dir))) { +if (!force && + !build_id_cache__kcore_existing (from_dir, to_dir,sizeof (to_dir))) {pr_debug ("same kcore found in %s\n" , to_dir);return 0 ; }
@@ -389,7 +391,7 @@ int cmd_buildid_cache(int argc, const char **argv, }if (kcore_filename && -build_id_cache__add_kcore (kcore_filename, debugdir)) +build_id_cache__add_kcore (kcore_filename, debugdir, force))pr_warning ("Couldn't add %s\n" , kcore_filename);return ret;
tools/perf/builtin-evlist.c +1 -0
@@ -15,6 +15,7 @@#include "util/parse-options.h" #include "util/session.h" #include "util/data.h" +#include "util/debug.h" static int __cmd_evlist (const char *file_name,struct perf_attr_details *details) {
tools/perf/builtin-help.c +1 -0
@@ -11,6 +11,7 @@#include "util/parse-options.h" #include "util/run-command.h" #include "util/help.h" +#include "util/debug.h" static struct man_viewer_list { struct man_viewer_list *next;
tools/perf/builtin-inject.c +5 -0
@@ -389,6 +389,9 @@ static int __cmd_inject(struct perf_inject *inject) ret =perf_session__process_events (session, &inject->tool);if (!file_out->is_pipe) { +if (inject->build_ids) +perf_header__set_feat (&session->header, +HEADER_BUILD_ID ); session->header.data_size = inject->bytes_written;perf_session__write_header (session, session->evlist, file_out->fd, true); }
@@ -436,6 +439,8 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) "where and how long tasks slept"),OPT_INCR ('v' ,"verbose" , &verbose,"be more verbose (show build ids, etc)" ), +OPT_STRING (0 ,"kallsyms" , &symbol_conf.kallsyms_name,"file" , +"kallsyms pathname" ),OPT_END () }; const char * const inject_usage[] = {
tools/perf/builtin-kvm.c +121 -293
609 lines not on this page · raw message
tools/perf/builtin-record.c +6 -1
@@ -238,6 +238,7 @@ static struct perf_event_header finished_round_event = {static int record__mmap_read_all (struct record *rec) { +u64 bytes_written = rec->bytes_written;int i;int rc =0 ;
@@ -250,7 +251,11 @@ static int record__mmap_read_all(struct record *rec) } } -if (perf_header__has_feat (&rec->session->header,HEADER_TRACING_DATA )) +/* +* Mark the round finished in case we wrote +* at least one event. +*/ +if (bytes_written != rec->bytes_written) rc =record__write (rec, &finished_round_event,sizeof (finished_round_event)); out:
tools/perf/builtin-sched.c +9 -7
@@ -10,6 +10,7 @@#include "util/header.h" #include "util/session.h" #include "util/tool.h" +#include "util/cloexec.h" #include "util/parse-options.h" #include "util/trace-event.h"
@@ -434,7 +435,8 @@ static int self_open_counters(void) attr.type =PERF_TYPE_SOFTWARE ; attr.config =PERF_COUNT_SW_TASK_CLOCK ; - fd =sys_perf_event_open (&attr,0 ,-1 ,-1 ,0 ); + fd =sys_perf_event_open (&attr,0 ,-1 ,-1 , +perf_event_open_cloexec_flag ());if (fd <0 ) pr_err("Error: sys_perf_event_open() syscall returned "
@@ -935,8 +937,8 @@ static int latency_switch_event(struct perf_sched *sched,return -1 ; } - sched_out =machine__findnew_thread (machine,0 , prev_pid); - sched_in =machine__findnew_thread (machine,0 , next_pid); + sched_out =machine__findnew_thread (machine,-1 , prev_pid); + sched_in =machine__findnew_thread (machine,-1 , next_pid); out_events =thread_atoms_search (&sched->atom_root, sched_out, &sched->cmp_pid);if (!out_events) {
@@ -979,7 +981,7 @@ static int latency_runtime_event(struct perf_sched *sched, {const u32 pid =perf_evsel__intval (evsel, sample,"pid" );const u64 runtime =perf_evsel__intval (evsel, sample,"runtime" ); -struct thread *thread =machine__findnew_thread (machine,0 , pid); +struct thread *thread =machine__findnew_thread (machine,-1 , pid);struct work_atoms *atoms =thread_atoms_search (&sched->atom_root, thread, &sched->cmp_pid);u64 timestamp = sample->time;int cpu = sample->cpu;
@@ -1012,7 +1014,7 @@ static int latency_wakeup_event(struct perf_sched *sched,struct thread *wakee;u64 timestamp = sample->time; - wakee =machine__findnew_thread (machine,0 , pid); + wakee =machine__findnew_thread (machine,-1 , pid); atoms =thread_atoms_search (&sched->atom_root, wakee, &sched->cmp_pid);if (!atoms) {if (thread_atoms_insert (sched, wakee))
@@ -1072,7 +1074,7 @@ static int latency_migrate_task_event(struct perf_sched *sched,if (sched->profile_cpu ==-1 )return 0 ; - migrant =machine__findnew_thread (machine,0 , pid); + migrant =machine__findnew_thread (machine,-1 , pid); atoms =thread_atoms_search (&sched->atom_root, migrant, &sched->cmp_pid);if (!atoms) {if (thread_atoms_insert (sched, migrant))
@@ -1290,7 +1292,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel,return -1 ; } - sched_in =machine__findnew_thread (machine,0 , next_pid); + sched_in =machine__findnew_thread (machine,-1 , next_pid); sched->curr_thread[this_cpu] = sched_in;
tools/perf/builtin-script.c +19 -41
95 lines not on this page · raw message
tools/perf/builtin-stat.c +1 -1
@@ -184,7 +184,7 @@ static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)static int perf_evsel__alloc_stat_priv (struct perf_evsel *evsel) { evsel->priv =zalloc (sizeof (struct perf_stat )); -if (evsel ==NULL ) +if (evsel->priv ==NULL )return -ENOMEM ;perf_evsel__reset_stat_priv (evsel);return 0 ;
tools/perf/builtin-timechart.c +675 -19
417 lines not on this page · raw message
tools/perf/builtin-trace.c +222 -44
266 lines not on this page · raw message
tools/perf/config/feature-checks/Makefile +4 -0
Lines of this file are not shown. View the raw message.
tools/perf/config/feature-checks/test-all.c +5 -0
Lines of this file are not shown. View the raw message.
tools/perf/config/feature-checks/test-sync-compare-and-swap.c new file +14 -0
Lines of this file are not shown. View the raw message.
tools/perf/scripts/perl/bin/failed-syscalls-record +2 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/perl/failed-syscalls.pl +5 -0
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py +2 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/bin/failed-syscalls-by-pid-record +2 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/bin/sctop-record +2 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/bin/syscall-counts-by-pid-record +2 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/bin/syscall-counts-record +2 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/check-perf-trace.py +2 -2
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/failed-syscalls-by-pid.py +6 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/futex-contention.py +2 -2
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/net_dropmonitor.py +1 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/netdev-times.py +13 -13
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/sched-migration.py +20 -21
41 lines not on this page · raw message
tools/perf/scripts/python/syscall-counts-by-pid.py +6 -1
Lines of this file are not shown. View the raw message.
tools/perf/scripts/python/syscall-counts.py +6 -1
Lines of this file are not shown. View the raw message.
tools/perf/tests/evsel-roundtrip-name.c +1 -0
Lines of this file are not shown. View the raw message.
tools/perf/tests/open-syscall-tp-fields.c +1 -0
Lines of this file are not shown. View the raw message.
tools/perf/tests/parse-no-sample-id-all.c +1 -0
Lines of this file are not shown. View the raw message.
tools/perf/ui/browsers/hists.c +122 -31
153 lines not on this page · raw message
tools/perf/util/cloexec.c new file +57 -0
57 lines not on this page · raw message
tools/perf/util/debug.c +50 -6
56 lines not on this page · raw message
tools/perf/util/dso.c +62 -9
71 lines not on this page · raw message
tools/perf/util/event.c +51 -1
52 lines not on this page · raw message
tools/perf/util/evlist.c +29 -22
51 lines not on this page · raw message
tools/perf/util/header.c +46 -5
51 lines not on this page · raw message
tools/perf/util/include/linux/kernel.h +0 -21
Lines of this file are not shown. View the raw message.
tools/perf/util/kvm-stat.h new file +140 -0
140 lines not on this page · raw message
tools/perf/util/machine.c +125 -14
139 lines not on this page · raw message
tools/perf/util/map.c +31 -16
47 lines not on this page · raw message
tools/perf/util/scripting-engines/trace-event-perl.c +1 -0
Lines of this file are not shown. View the raw message.
tools/perf/util/scripting-engines/trace-event-python.c +174 -23
197 lines not on this page · raw message
tools/perf/util/svghelper.c +130 -38
168 lines not on this page · raw message
tools/perf/util/symbol-elf.c +39 -2
41 lines not on this page · raw message
tools/perf/util/symbol-minimal.c +43 -0
43 lines not on this page · raw message
tools/perf/util/vdso.c +77 -20
97 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.