diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-04 19:09:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-04 19:09:53 -0400 |
commit | ef35ad26f8ff44d2c93e29952cdb336bda729d9d (patch) | |
tree | e2921072b9f4d820b18d6e5bc489b64ef2068668 /tools/perf/util/debug.c | |
parent | 8efb90cf1e80129fad197b916714e1d01ee183d2 (diff) | |
parent | f9b9f812235d53f774a083e88a5a23b517a69752 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf changes from Ingo Molnar:
"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)
Tooling 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)
Tooling 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)
Tooling 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)"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (123 commits)
Revert "perf tools: Fix jump label always changing during tracing"
perf tools: Fix perf usage string leftover
perf: Check permission only for parent tracepoint event
perf record: Store PERF_RECORD_FINISHED_ROUND only for nonempty rounds
perf record: Always force PERF_RECORD_FINISHED_ROUND event
perf inject: Add --kallsyms parameter
perf tools: Expose 'addr' functions so they can be reused
perf session: Fix accounting of ordered samples queue
perf powerpc: Include util/util.h and remove stringify macros
perf tools: Fix build on gcc 4.4.7
perf tools: Add thread parameter to vdso__dso_findnew()
perf tools: Add dso__type()
perf tools: Separate the VDSO map name from the VDSO dso name
perf tools: Add vdso__new()
perf machine: Fix the lifetime of the VDSO temporary file
perf tools: Group VDSO global variables into a structure
perf session: Add ability to skip 4GiB or more
perf session: Add ability to 'skip' a non-piped event stream
perf tools: Pass machine to vdso__dso_findnew()
perf tools: Add dso__data_size()
...
Diffstat (limited to 'tools/perf/util/debug.c')
-rw-r--r-- | tools/perf/util/debug.c | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 299b55586502..71d419362634 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -16,11 +16,11 @@ | |||
16 | int verbose; | 16 | int verbose; |
17 | bool dump_trace = false, quiet = false; | 17 | bool dump_trace = false, quiet = false; |
18 | 18 | ||
19 | static int _eprintf(int level, const char *fmt, va_list args) | 19 | static int _eprintf(int level, int var, const char *fmt, va_list args) |
20 | { | 20 | { |
21 | int ret = 0; | 21 | int ret = 0; |
22 | 22 | ||
23 | if (verbose >= level) { | 23 | if (var >= level) { |
24 | if (use_browser >= 1) | 24 | if (use_browser >= 1) |
25 | ui_helpline__vshow(fmt, args); | 25 | ui_helpline__vshow(fmt, args); |
26 | else | 26 | else |
@@ -30,13 +30,13 @@ static int _eprintf(int level, const char *fmt, va_list args) | |||
30 | return ret; | 30 | return ret; |
31 | } | 31 | } |
32 | 32 | ||
33 | int eprintf(int level, const char *fmt, ...) | 33 | int eprintf(int level, int var, const char *fmt, ...) |
34 | { | 34 | { |
35 | va_list args; | 35 | va_list args; |
36 | int ret; | 36 | int ret; |
37 | 37 | ||
38 | va_start(args, fmt); | 38 | va_start(args, fmt); |
39 | ret = _eprintf(level, fmt, args); | 39 | ret = _eprintf(level, var, fmt, args); |
40 | va_end(args); | 40 | va_end(args); |
41 | 41 | ||
42 | return ret; | 42 | return ret; |
@@ -51,9 +51,9 @@ void pr_stat(const char *fmt, ...) | |||
51 | va_list args; | 51 | va_list args; |
52 | 52 | ||
53 | va_start(args, fmt); | 53 | va_start(args, fmt); |
54 | _eprintf(1, fmt, args); | 54 | _eprintf(1, verbose, fmt, args); |
55 | va_end(args); | 55 | va_end(args); |
56 | eprintf(1, "\n"); | 56 | eprintf(1, verbose, "\n"); |
57 | } | 57 | } |
58 | 58 | ||
59 | int dump_printf(const char *fmt, ...) | 59 | int dump_printf(const char *fmt, ...) |
@@ -105,3 +105,47 @@ void trace_event(union perf_event *event) | |||
105 | } | 105 | } |
106 | printf(".\n"); | 106 | printf(".\n"); |
107 | } | 107 | } |
108 | |||
109 | static struct debug_variable { | ||
110 | const char *name; | ||
111 | int *ptr; | ||
112 | } debug_variables[] = { | ||
113 | { .name = "verbose", .ptr = &verbose }, | ||
114 | { .name = NULL, } | ||
115 | }; | ||
116 | |||
117 | int perf_debug_option(const char *str) | ||
118 | { | ||
119 | struct debug_variable *var = &debug_variables[0]; | ||
120 | char *vstr, *s = strdup(str); | ||
121 | int v = 1; | ||
122 | |||
123 | vstr = strchr(s, '='); | ||
124 | if (vstr) | ||
125 | *vstr++ = 0; | ||
126 | |||
127 | while (var->name) { | ||
128 | if (!strcmp(s, var->name)) | ||
129 | break; | ||
130 | var++; | ||
131 | } | ||
132 | |||
133 | if (!var->name) { | ||
134 | pr_err("Unknown debug variable name '%s'\n", s); | ||
135 | free(s); | ||
136 | return -1; | ||
137 | } | ||
138 | |||
139 | if (vstr) { | ||
140 | v = atoi(vstr); | ||
141 | /* | ||
142 | * Allow only values in range (0, 10), | ||
143 | * otherwise set 0. | ||
144 | */ | ||
145 | v = (v < 0) || (v > 10) ? 0 : v; | ||
146 | } | ||
147 | |||
148 | *var->ptr = v; | ||
149 | free(s); | ||
150 | return 0; | ||
151 | } | ||