perf/core improvements and fixes
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit c0edb7467c3d21b213ff734bfe810d81d2c6ed61:
Merge tag 'perf-core-for-mingo-20160505' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-05-06 08:35:14 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160506
for you to fetch changes up to d5d71e86d226abe7e08df5763127ed2bd07649a1:
perf trace: Move futex_op beautifier to tools/perf/trace/beauty/ (2016-05-06 13:00:59 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- Fix ordering of kernel/user entries in 'caller' mode, where the kernel and user parts were being correctly inverted but kept in place wrt each other, i.e. 'callee' (k1, k2, u3, u4) became 'caller' (k2, k1, u4, u3) when it should be 'caller' (u4, u3, k2, k1) (Chris Phlipot)
- In 'perf trace' don't print the raw arg syscall args for a syscall that has no arguments, like gettid(). This was happening because just checking if the syscall args list is NULL may mean that there are no args (e.g.: gettid) or that there is no tracepoint info (e.g.: clone) (Arnaldo Carvalho de Melo)
- Add extra output of counter values with 'perf stat -vv' (Andi Kleen)
Infrastructure:
- Expose callchain db export via the python API (Chris Phlipot)
Code reorganization:
- Move some more syscall arg beautifiers from the 'perf trace' main file to separate files in tools/perf/trace/beauty/, to reduce the main file line count (Arnaldo Carvalho de Melo)
----------------------------------------------------------------
Andi Kleen (1):
perf stat: Add extra output of counter values with -vv
Arnaldo Carvalho de Melo (4):
perf trace: Do not print raw args list for syscalls with no args perf trace: Move signum beautifier to tools/perf/trace/beauty/ perf trace: Move open_flags beautifier to tools/perf/trace/beauty/ perf trace: Move futex_op beautifier to tools/perf/trace/beauty/
Chris Phlipot (6):
perf callchain: Fix incorrect ordering of entries
perf tools: Refactor code to move call path handling out of thread-stack perf script: Enable db export to output sampled callchains perf script: Add call path id to exported sample in db export perf script: Expose usage of the callchain db export via the python api perf script: Update export-to-postgresql to support callchain export
tools/perf/builtin-stat.c | 8 + tools/perf/builtin-trace.c | 165 ++------------------- tools/perf/scripts/python/export-to-postgresql.py | 47 +++--- tools/perf/trace/beauty/futex_op.c | 44 ++++++ tools/perf/trace/beauty/open_flags.c | 56 +++++++ tools/perf/trace/beauty/signum.c | 53 +++++++ tools/perf/util/Build | 1 + tools/perf/util/call-path.c | 122 +++++++++++++++ tools/perf/util/call-path.h | 77 ++++++++++ tools/perf/util/db-export.c | 85 +++++++++++ tools/perf/util/db-export.h | 3 + tools/perf/util/machine.c | 56 +++++-- .../util/scripting-engines/trace-event-python.c | 36 ++++- tools/perf/util/thread-stack.c | 139 +---------------- tools/perf/util/thread-stack.h | 31 ++-- 15 files changed, 575 insertions(+), 348 deletions(-) create mode 100644 tools/perf/trace/beauty/futex_op.c create mode 100644 tools/perf/trace/beauty/open_flags.c create mode 100644 tools/perf/trace/beauty/signum.c create mode 100644 tools/perf/util/call-path.c create mode 100644 tools/perf/util/call-path.h
Arnaldo Carvalho de Melo
maintainerPATCH 1/11 perf trace: Do not print raw args list for syscalls with no args
From: Arnaldo Carvalho de Melo <[email protected]>
The test to check if the arg format had been read from the syscall:sys_enter_name/format file was looking at the list of non-commom fields, and if that is empty, it would think it had failed to read it, because it doesn't exist, for instance, for the clone() syscall.
So instead before dumping the raw syscall args list check IS_ERR(sc->tp_format), if that is true, then an attempt was made to read the format file and failed, in which case dump the raw arg list values.
--- tools/perf/builtin-trace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +6 -1
@@ -1606,7 +1606,12 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size, "%ld", val); } } - }else { + }else if (IS_ERR (sc->tp_format)) { +/* +* If we managed to read the tracepoint /format file, then we +* may end up not having any args, like with gettid(), so only +* print the raw args when we didn't manage to read it. +*/ int i =0 ;while (i <6 ) {
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 2/11 perf callchain: Fix incorrect ordering of entries
In reply to Arnaldo Carvalho de MeloFrom: Chris Phlipot <[email protected]>
The existing implementation of thread__resolve_callchain, under certain circumstances, can assemble callchain entries in the incorrect order.
The callchain entries are resolved incorrectly for a sample when all of the following conditions are met:
1. callchain_param.order is set to ORDER_CALLER
2. thread__resolve_callchain_sample is able to resolve callchain entries for the sample.
3. unwind__get_entries is also able to resolve callchain entries for the sample.
The fix is accomplished by reversing the order in which thread__resolve_callchain_sample and unwind__get_entries are called when callchain_param.order is set to ORDER_CALLER.
Unwind specific code from thread__resolve_callchain is also moved into a new static function to improve readability of the fix.
How to Reproduce the Existing Bug:
Modifying perf script to print call trees in the opposite order or applying the remaining patches from this series and comparing the results output from export-to-postgtresql.py are the easiest ways to see the bug, however it can still be seen in current builds using perf report.
Here is how i can reproduce the bug using perf report:
# perf record --call-graph=dwarf stress -c 1 -t 5
when i run this command:
# perf report --call-graph=flat,0,0,callee
This callchain, containing kernel (handle_irq_event, etc) and userspace samples (__libc_start_main, etc) is contained in the output, which looks correct (callee order):
gen8_irq_handler
handle_irq_event_percpu
handle_irq_event
handle_edge_irq
handle_irq
do_IRQ
ret_from_intr
__random
rand
0x558f2a04dded
0x558f2a04c774
__libc_start_main
0x558f2a04dcd9Now run this command using caller order:
# perf report --call-graph=flat,0,0,caller
It is expected to see the exact reverse of the above when using caller order (with "0x558f2a04dcd9" at the top and "gen8_irq_handler" at the bottom) in the output, but it is nowhere to be found.
instead you see this:
ret_from_intr
do_IRQ
handle_irq
handle_edge_irq
handle_irq_event
handle_irq_event_percpu
gen8_irq_handler
0x558f2a04dcd9
__libc_start_main
0x558f2a04c774
0x558f2a04dded
rand
__randomNotice how internally the kernel symbols are reversed and the user space symbols are reversed, but the kernel symbols still appear above the user space symbols.
if this patch is applied and perf script is re-run, you will see the expected output (with "0x558f2a04dcd9" at the top and "gen8_irq_handler" at the bottom):
0x558f2a04dcd9
__libc_start_main
0x558f2a04c774
0x558f2a04dded
rand
__random
ret_from_intr
do_IRQ
handle_irq
handle_edge_irq
handle_irq_event
handle_irq_event_percpu
gen8_irq_handler--- tools/perf/util/machine.c | 56 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 15 deletions(-)
tools/perf/util/machine.c +41 -15
@@ -1817,8 +1817,6 @@ static int thread__resolve_callchain_sample(struct thread *thread,int skip_idx =-1 ;int first_call =0 ; -callchain_cursor_reset (cursor); -if (perf_evsel__has_branch_callstack (evsel)) { err =resolve_lbr_callchain_sample (thread, cursor, sample, parent, root_al, max_stack);
@@ -1929,20 +1927,12 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) entry->map, entry->sym); } -int thread__resolve_callchain (struct thread *thread, -struct callchain_cursor *cursor, -struct perf_evsel *evsel, -struct perf_sample *sample, -struct symbol **parent, -struct addr_location *root_al, -int max_stack) +static int thread__resolve_callchain_unwind (struct thread *thread, +struct callchain_cursor *cursor, +struct perf_evsel *evsel, +struct perf_sample *sample, +int max_stack) { -int ret =thread__resolve_callchain_sample (thread, cursor, evsel, - sample, parent, - root_al, max_stack); -if (ret) -return ret; -/* Can we do dwarf post unwind? */ if (!((evsel->attr.sample_type &PERF_SAMPLE_REGS_USER ) && (evsel->attr.sample_type &PERF_SAMPLE_STACK_USER )))
@@ -1955,7 +1945,43 @@ int thread__resolve_callchain(struct thread *thread,return unwind__get_entries (unwind_entry, cursor, thread, sample, max_stack); +} +int thread__resolve_callchain (struct thread *thread, +struct callchain_cursor *cursor, +struct perf_evsel *evsel, +struct perf_sample *sample, +struct symbol **parent, +struct addr_location *root_al, +int max_stack) +{ +int ret =0 ; + +callchain_cursor_reset (&callchain_cursor); + +if (callchain_param.order ==ORDER_CALLEE ) { + ret =thread__resolve_callchain_sample (thread, cursor, + evsel, sample, + parent, root_al, + max_stack); +if (ret) +return ret; + ret =thread__resolve_callchain_unwind (thread, cursor, + evsel, sample, + max_stack); + }else { + ret =thread__resolve_callchain_unwind (thread, cursor, + evsel, sample, + max_stack); +if (ret) +return ret; + ret =thread__resolve_callchain_sample (thread, cursor, + evsel, sample, + parent, root_al, + max_stack); + } + +return ret; } int machine__for_each_thread(struct machine *machine,
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 3/11 perf tools: Refactor code to move call path handling out of thread-stack
In reply to Arnaldo Carvalho de MeloFrom: Chris Phlipot <[email protected]>
Move the call path handling code out of thread-stack.c and thread-stack.h to allow other components that are not part of thread-stack to create call paths.
Summary:
- Create call-path.c and call-path.h and add them to the build.
- Move all call path related code out of thread-stack.c and thread-stack.h and into call-path.c and call-path.h.
- A small subset of structures and functions are now visible through call-path.h, which is required for thread-stack.c to continue to compile.
This change is a prerequisite for subsequent patches in this change set and by itself contains no user-visible changes.
--- tools/perf/util/Build | 1 + tools/perf/util/call-path.c | 122 ++++++++++++++++++++ tools/perf/util/call-path.h | 77 +++++++++++++ tools/perf/util/db-export.c | 1 + .../util/scripting-engines/trace-event-python.c | 1 + tools/perf/util/thread-stack.c | 126 +-------------------- tools/perf/util/thread-stack.h | 25 +--- 7 files changed, 204 insertions(+), 149 deletions(-) create mode 100644 tools/perf/util/call-path.c create mode 100644 tools/perf/util/call-path.h
tools/perf/util/Build +1 -0
@@ -74,6 +74,7 @@ libperf-y += srcline.o libperf-y += data.o libperf-y += tsc.o libperf-y += cloexec.o +libperf-y += call-path.o libperf-y += thread-stack.o libperf-$(CONFIG_AUXTRACE) += auxtrace.o libperf-$(CONFIG_AUXTRACE) += intel-pt-decoder/
tools/perf/util/call-path.c new file +122 -0
122 lines not on this page · raw message
tools/perf/util/call-path.h new file +77 -0
77 lines not on this page · raw message
tools/perf/util/db-export.c +1 -0
@@ -23,6 +23,7 @@#include "event.h" #include "util.h" #include "thread-stack.h" +#include "call-path.h" #include "db-export.h" struct deferred_export {
tools/perf/util/scripting-engines/trace-event-python.c +1 -0
@@ -41,6 +41,7 @@#include "../thread-stack.h" #include "../trace-event.h" #include "../machine.h" +#include "../call-path.h" #include "thread_map.h" #include "cpumap.h" #include "stat.h"
tools/perf/util/thread-stack.c +1 -125
140 lines not on this page · raw message
tools/perf/util/thread-stack.h +1 -24
@@ -19,7 +19,6 @@#include <sys/types.h> #include <linux/types.h> -#include <linux/rbtree.h> struct thread ;struct comm ;
@@ -30,6 +29,7 @@ struct call_return_processor;struct comm ;struct perf_sample ;struct addr_location ; +struct call_path ;/* * Call/Return flags.
@@ -68,29 +68,6 @@ struct call_return {u32 flags; }; -/** -* struct call_path - node in list of calls leading to a function call. -* @parent: call path to the parent function call -* @sym: symbol of function called -* @ip: only if sym is null, the ip of the function -* @db_id: id used for db-export -* @in_kernel: whether function is a in the kernel -* @rb_node: node in parent's tree of called functions -* @children: tree of call paths of functions called -* -* In combination with the call_return structure, the call_path structure -* defines a context-sensitve call-graph. -*/ -struct call_path { -struct call_path *parent; -struct symbol *sym; -u64 ip; -u64 db_id; -bool in_kernel; -struct rb_node rb_node; -struct rb_root children; -}; -int thread_stack__event (struct thread *thread,u32 flags,u64 from_ip,u64 to_ip,u16 insn_len,u64 trace_nr);void thread_stack__set_trace_nr (struct thread *thread,u64 trace_nr);
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 4/11 perf script: Enable db export to output sampled callchains
In reply to Arnaldo Carvalho de MeloFrom: Chris Phlipot <[email protected]>
This change enables the db export api to export callchains. This is accomplished by adding callchains obtained from samples to the call_path_root structure and exporting them via the current call path export API.
While the current API does support exporting call paths, this is not supported when sampling. This commit addresses that missing feature by allowing the export of call paths when callchains are present in samples.
Summary:
- This feature is activated by initializing the call_path_root member inside the db_export structure to a non-null value.
- Callchains are resolved with thread__resolve_callchain() and then stored and exported by adding a call path under call path root.
- Symbol and DSO for each callchain node are exported via db_ids_from_al()
This commit puts in place infrastructure to be used by subsequent commits, and by itself, does not introduce any user-visible changes.
--- tools/perf/util/db-export.c | 82 +++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/db-export.h | 2 ++ 2 files changed, 84 insertions(+)
tools/perf/util/db-export.c +82 -0
@@ -23,6 +23,7 @@#include "event.h" #include "util.h" #include "thread-stack.h" +#include "callchain.h" #include "call-path.h" #include "db-export.h"
@@ -277,6 +278,79 @@ static int db_ids_from_al(struct db_export *dbe, struct addr_location *al,return 0 ; } +static struct call_path *call_path_from_sample (struct db_export *dbe, +struct machine *machine, +struct thread *thread, +struct perf_sample *sample, +struct perf_evsel *evsel) +{ +u64 kernel_start =machine__kernel_start (machine); +struct call_path *current = &dbe->cpr->call_path; +enum chain_order saved_order = callchain_param.order; +int err; + +if (!symbol_conf.use_callchain || !sample->callchain) +return NULL ; + +/* +* Since the call path tree must be built starting with the root, we +* must use ORDER_CALL for call chain resolution, in order to process +* the callchain starting with the root node and ending with the leaf. +*/ + callchain_param.order =ORDER_CALLER ; + err =thread__resolve_callchain (thread, &callchain_cursor, evsel, + sample,NULL ,NULL , + sysctl_perf_event_max_stack); +if (err) { + callchain_param.order = saved_order; +return NULL ; + } +callchain_cursor_commit (&callchain_cursor); + +while (1 ) { +struct callchain_cursor_node *node; +struct addr_location al; +u64 dso_db_id =0 , sym_db_id =0 , offset =0 ; + +memset (&al,0 ,sizeof (al)); + + node =callchain_cursor_current (&callchain_cursor); +if (!node) +break ; +/* +* Handle export of symbol and dso for this node by +* constructing an addr_location struct and then passing it to +* db_ids_from_al() to perform the export. +*/ + al.sym = node->sym; + al.map = node->map; + al.machine = machine; +if (al.map) + al.addr = al.map->map_ip (al.map, node->ip); +else + al.addr = node->ip; + +db_ids_from_al (dbe, &al, &dso_db_id, &sym_db_id, &offset); + +/* add node to the call path tree if it doesn't exist */ + current =call_path__findnew (dbe->cpr, current, + al.sym, node->ip, + kernel_start); + +callchain_cursor_advance (&callchain_cursor); + } + +/* Reset the callchain order to its prior value. */ + callchain_param.order = saved_order; + +if (current == &dbe->cpr->call_path) { +/* Bail because the callchain was empty. */ +return NULL ; + } + +return current; +} +int db_export__branch_type (struct db_export *dbe,u32 branch_type,const char *name) {
@@ -330,6 +404,14 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,if (err) goto out_put; +if (dbe->cpr) { +struct call_path *cp =call_path_from_sample (dbe, al->machine, + thread, sample, + evsel); +if (cp) +db_export__call_path (dbe, cp); + } +if ((evsel->attr.sample_type &PERF_SAMPLE_ADDR ) &&sample_addr_correlates_sym (&evsel->attr)) {struct addr_location addr_al;
tools/perf/util/db-export.h +2 -0
@@ -27,6 +27,7 @@ struct dso;struct perf_sample ;struct addr_location ;struct call_return_processor ; +struct call_path_root ;struct call_path ;struct call_return ;
@@ -64,6 +65,7 @@ struct db_export {int (*export_call_return)(struct db_export *dbe,struct call_return *cr);struct call_return_processor *crp; +struct call_path_root *cpr;u64 evsel_last_db_id;u64 machine_last_db_id;u64 thread_last_db_id;
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 5/11 perf script: Add call path id to exported sample in db export
In reply to Arnaldo Carvalho de MeloFrom: Chris Phlipot <[email protected]>
The exported sample now contains a reference to the call_path_id that represents its callchain.
While callchains themselves are nice to have, being able to associate them with samples makes them much more useful, and can allow for such things as determining how much cumulative time is spent in a particular function. This information is normally possible to get from the call return processor. However, when doing normal sampling, call/return information is not available, thus necessitating the need for associating samples directly with call paths.
This commit include changes to db-export layer to make this information available for subsequent patches in this change set, but by itself, does not make any changes visible to the user.
--- tools/perf/util/db-export.c | 4 +++- tools/perf/util/db-export.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/db-export.c +3 -1
@@ -408,8 +408,10 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,struct call_path *cp =call_path_from_sample (dbe, al->machine, thread, sample, evsel); -if (cp) +if (cp) {db_export__call_path (dbe, cp); + es.call_path_id = cp->db_id; + } } if ((evsel->attr.sample_type & PERF_SAMPLE_ADDR) &&
tools/perf/util/db-export.h +1 -0
@@ -44,6 +44,7 @@ struct export_sample {u64 addr_dso_db_id;u64 addr_sym_db_id;u64 addr_offset;/* addr offset from symbol start */ +u64 call_path_id; };struct db_export {
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 6/11 perf script: Expose usage of the callchain db export via the python api
In reply to Arnaldo Carvalho de MeloFrom: Chris Phlipot <[email protected]>
This change allows python scripts to be able to utilize the recent changes to the db export api allowing the export of call_paths derived from sampled callchains. These call paths are also now associated with the samples from which they were derived.
- This feature is enabled by setting "perf_db_export_callchains" to true
- When enabled, samples that have callchain information will have the callchains exported via call_path_table
- The call_path_id field is added to sample_table to enable association of samples with the corresponding callchain stored in the call paths table. A call_path_id of 0 will be exported if there is no corresponding callchain.
- When "perf_db_export_callchains" and "perf_db_export_calls" are both set to True, the call path root data structure will be shared. This prevents duplicating of data and call path ids that would result from building two separate call path trees in memory.
- The call_return_processor structure definition was relocated to the header file to make its contents visible to db-export.c. This enables the sharing of call path trees between the two features, as mentioned above.
This change is visible to python scripts using the python db export api.
The change is backwards compatible with scripts written against the previous API, assuming that the scripts model the sample_table function after the one in export-to-postgresql.py script by allowing for additional arguments to be added in the future. ie. using *x as the final argument of the sample_table function.
--- .../util/scripting-engines/trace-event-python.c | 35 ++++++++++++++++++++-- tools/perf/util/thread-stack.c | 13 -------- tools/perf/util/thread-stack.h | 14 ++++++++- 3 files changed, 46 insertions(+), 16 deletions(-)
tools/perf/util/scripting-engines/trace-event-python.c +33 -2
@@ -682,7 +682,7 @@ static int python_export_sample(struct db_export *dbe, struct tables *tables = container_of(dbe, struct tables, dbe);PyObject *t; - t =tuple_new (21 ); + t =tuple_new (22 );tuple_set_u64 (t,0 , es->db_id);tuple_set_u64 (t,1 , es->evsel->db_id);
@@ -705,6 +705,7 @@ static int python_export_sample(struct db_export *dbe,tuple_set_u64 (t,18 , es->sample->data_src);tuple_set_s32 (t,19 , es->sample->flags &PERF_BRANCH_MASK );tuple_set_s32 (t,20 , !!(es->sample->flags &PERF_IP_FLAG_IN_TX )); +tuple_set_u64 (t,21 , es->call_path_id);call_object (tables->sample_handler, t,"sample_table" );
@@ -999,8 +1000,10 @@ static void set_table_handlers(struct tables *tables) {const char *perf_db_export_mode ="perf_db_export_mode" ;const char *perf_db_export_calls ="perf_db_export_calls" ; -PyObject *db_export_mode, *db_export_calls; +const char *perf_db_export_callchains ="perf_db_export_callchains" ; +PyObject *db_export_mode, *db_export_calls, *db_export_callchains;bool export_calls = false; +bool export_callchains = false;int ret;memset (tables,0 ,sizeof (struct tables ));
@@ -1017,6 +1020,7 @@ static void set_table_handlers(struct tables *tables)if (!ret)return ; +/* handle export calls */ tables->dbe.crp =NULL ; db_export_calls =PyDict_GetItemString (main_dict, perf_db_export_calls);if (db_export_calls) {
@@ -1034,6 +1038,33 @@ static void set_table_handlers(struct tables *tables)Py_FatalError ("failed to create calls processor" ); } +/* handle export callchains */ + tables->dbe.cpr =NULL ; + db_export_callchains =PyDict_GetItemString (main_dict, + perf_db_export_callchains); +if (db_export_callchains) { + ret =PyObject_IsTrue (db_export_callchains); +if (ret ==-1 ) +handler_call_die (perf_db_export_callchains); + export_callchains = !!ret; + } + +if (export_callchains) { +/* +* Attempt to use the call path root from the call return +* processor, if the call return processor is in use. Otherwise, +* we allocate a new call path root. This prevents exporting +* duplicate call path ids when both are in use simultaniously. +*/ +if (tables->dbe.crp) + tables->dbe.cpr = tables->dbe.crp->cpr; +else + tables->dbe.cpr =call_path_root__new (); + +if (!tables->dbe.cpr) +Py_FatalError ("failed to create calls processor" ); + } + tables->db_export_mode = true;/* * Reserve per symbol space for symbol->db_id via symbol__priv()
tools/perf/util/thread-stack.c +0 -13
@@ -25,19 +25,6 @@#include "call-path.h" #include "thread-stack.h" -/** -* struct call_return_processor - provides a call-back to consume call-return -* information. -* @cpr: call path root -* @process: call-back that accepts call/return information -* @data: anonymous data for call-back -*/ -struct call_return_processor { -struct call_path_root *cpr; -int (*process)(struct call_return *cr,void *data); -void *data; -}; -#define STACK_GROWTH 2048/**
tools/perf/util/thread-stack.h +13 -1
@@ -25,7 +25,6 @@ struct comm;struct ip_callchain ;struct symbol ;struct dso ; -struct call_return_processor ;struct comm ;struct perf_sample ;struct addr_location ;
@@ -68,6 +67,19 @@ struct call_return {u32 flags; }; +/** +* struct call_return_processor - provides a call-back to consume call-return +* information. +* @cpr: call path root +* @process: call-back that accepts call/return information +* @data: anonymous data for call-back +*/ +struct call_return_processor { +struct call_path_root *cpr; +int (*process)(struct call_return *cr,void *data); +void *data; +}; +int thread_stack__event (struct thread *thread,u32 flags,u64 from_ip,u64 to_ip,u16 insn_len,u64 trace_nr);void thread_stack__set_trace_nr (struct thread *thread,u64 trace_nr);
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 7/11 perf script: Update export-to-postgresql to support callchain export
In reply to Arnaldo Carvalho de MeloFrom: Chris Phlipot <[email protected]>
Update the export-to-postgresql.py to support the newly introduced callchain export.
callchains are added into the existing call_paths table and can now be associated with samples when the "callpaths" commandline option is used with the script.
Ex.:
$ perf script -s export-to-postgresql.py example_db all callchains
Includes the following changes to enable callchain export via the python export APIs:
- Add the "callchains" commandline option, which is used to enable callchain export by setting the perf_db_export_callchains global
- Add perf_db_export_callchains checks for call_path table creation and population.
- Add call_path_id to samples_table to conform with the new API
example usage and output using a small test app:
test_app.c:
volatile int x = 0;
void inc_x_loop()
{
int i;
for(i=0; i<100000000; i++)
x++;
}
void a()
{
inc_x_loop();
}
void b()
{
inc_x_loop();
}
int main()
{
a();
b();
return 0;
}example usage:
$ gcc -g -O0 test_app.c $ perf record --call-graph=dwarf ./a.out [ perf record: Woken up 77 times to write data ] [ perf record: Captured and wrote 19.373 MB perf.data (2404 samples) ]
$ perf script -s scripts/python/export-to-postgresql.py example_db all callchains
$ psql example_db
example_db=#
SELECT
(SELECT name FROM symbols WHERE id = cps.symbol_id) as symbol, (SELECT name FROM symbols WHERE id =
(SELECT symbol_id from call_paths where id = cps.parent_id)) as parent_symbol,
sum(period) as event_count
FROM samples join call_paths as cps on call_path_id = cps.id GROUP BY cps.id,evsel_id
ORDER BY event_count DESC
LIMIT 5;
symbol | parent_symbol | event_count
------------------+--------------------------+-------------
inc_x_loop | a | 734250982 inc_x_loop | b | 731028057 unknown | unknown | 1335858 task_tick_fair | scheduler_tick | 1238842 update_wall_time | tick_do_update_jiffies64 | 650373
(5 rows)
The above data shows total "self time" in cycles for each call path that was sampled. It is intended to demonstrate how it accounts separately for the two ways to reach the "inc_x_loop" function(via "a" and "b"). Recursive common table expressions can be used as well to get cumulative time spent in a function as well, but that is beyond the scope of this basic example.
--- tools/perf/scripts/python/export-to-postgresql.py | 47 +++++++++++++++-------- 1 file changed, 30 insertions(+), 17 deletions(-)
tools/perf/scripts/python/export-to-postgresql.py +30 -17
@@ -223,11 +223,14 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \ perf_db_export_mode = True perf_db_export_calls = False +perf_db_export_callchains = False + def usage(): - print >> sys.stderr, "Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>]" + print >> sys.stderr, "Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>]" print >> sys.stderr, "where: columns 'all' or 'branches'" - print >> sys.stderr, " calls 'calls' => create calls table" + print >> sys.stderr, " calls 'calls' => create calls and call_paths table" + print >> sys.stderr, " callchains 'callchains' => create call_paths table" raise Exception("Too few arguments") if (len(sys.argv) < 2):
@@ -245,9 +248,11 @@ if columns not in ("all", "branches"): branches = (columns == "branches") -if (len(sys.argv) >= 4): - if (sys.argv[3] == "calls"): +for i in range(3,len(sys.argv)): + if (sys.argv[i] == "calls"): perf_db_export_calls = True + elif (sys.argv[i] == "callchains"): + perf_db_export_callchains = True else: usage()
@@ -358,14 +363,16 @@ else: 'transaction bigint,' 'data_src bigint,' 'branch_type integer,' - 'in_tx boolean)') + 'in_tx boolean,' + 'call_path_id bigint)') -if perf_db_export_calls: +if perf_db_export_calls or perf_db_export_callchains: do_query(query, 'CREATE TABLE call_paths (' 'id bigint NOT NULL,' 'parent_id bigint,' 'symbol_id bigint,' 'ip bigint)') +if perf_db_export_calls: do_query(query, 'CREATE TABLE calls (' 'id bigint NOT NULL,' 'thread_id bigint,'
@@ -427,7 +434,7 @@ do_query(query, 'CREATE VIEW comm_threads_view AS ' '(SELECT tid FROM threads WHERE id = thread_id) AS tid' ' FROM comm_threads') -if perf_db_export_calls: +if perf_db_export_calls or perf_db_export_callchains: do_query(query, 'CREATE VIEW call_paths_view AS ' 'SELECT ' 'c.id,'
@@ -443,6 +450,7 @@ if perf_db_export_calls: '(SELECT dso_id FROM symbols WHERE id = p.symbol_id) AS parent_dso_id,' '(SELECT dso FROM symbols_view WHERE id = p.symbol_id) AS parent_dso_short_name' ' FROM call_paths c INNER JOIN call_paths p ON p.id = c.parent_id') +if perf_db_export_calls: do_query(query, 'CREATE VIEW calls_view AS ' 'SELECT ' 'calls.id,'
@@ -540,8 +548,9 @@ dso_file = open_output_file("dso_table.bin") symbol_file = open_output_file("symbol_table.bin") branch_type_file = open_output_file("branch_type_table.bin") sample_file = open_output_file("sample_table.bin") -if perf_db_export_calls: +if perf_db_export_calls or perf_db_export_callchains: call_path_file = open_output_file("call_path_table.bin") +if perf_db_export_calls: call_file = open_output_file("call_table.bin") def trace_begin():
@@ -553,8 +562,8 @@ def trace_begin(): comm_table(0, "unknown") dso_table(0, 0, "unknown", "unknown", "") symbol_table(0, 0, 0, 0, 0, "unknown") - sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - if perf_db_export_calls: + sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + if perf_db_export_calls or perf_db_export_callchains: call_path_table(0, 0, 0, 0) unhandled_count = 0
@@ -570,8 +579,9 @@ def trace_end(): copy_output_file(symbol_file, "symbols") copy_output_file(branch_type_file, "branch_types") copy_output_file(sample_file, "samples") - if perf_db_export_calls: + if perf_db_export_calls or perf_db_export_callchains: copy_output_file(call_path_file, "call_paths") + if perf_db_export_calls: copy_output_file(call_file, "calls") print datetime.datetime.today(), "Removing intermediate files..."
@@ -584,8 +594,9 @@ def trace_end(): remove_output_file(symbol_file) remove_output_file(branch_type_file) remove_output_file(sample_file) - if perf_db_export_calls: + if perf_db_export_calls or perf_db_export_callchains: remove_output_file(call_path_file) + if perf_db_export_calls: remove_output_file(call_file) os.rmdir(output_dir_name) print datetime.datetime.today(), "Adding primary keys"
@@ -598,8 +609,9 @@ def trace_end(): do_query(query, 'ALTER TABLE symbols ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE branch_types ADD PRIMARY KEY (id)') do_query(query, 'ALTER TABLE samples ADD PRIMARY KEY (id)') - if perf_db_export_calls: + if perf_db_export_calls or perf_db_export_callchains: do_query(query, 'ALTER TABLE call_paths ADD PRIMARY KEY (id)') + if perf_db_export_calls: do_query(query, 'ALTER TABLE calls ADD PRIMARY KEY (id)') print datetime.datetime.today(), "Adding foreign keys"
@@ -622,10 +634,11 @@ def trace_end(): 'ADD CONSTRAINT symbolfk FOREIGN KEY (symbol_id) REFERENCES symbols (id),' 'ADD CONSTRAINT todsofk FOREIGN KEY (to_dso_id) REFERENCES dsos (id),' 'ADD CONSTRAINT tosymbolfk FOREIGN KEY (to_symbol_id) REFERENCES symbols (id)') - if perf_db_export_calls: + if perf_db_export_calls or perf_db_export_callchains: do_query(query, 'ALTER TABLE call_paths ' 'ADD CONSTRAINT parentfk FOREIGN KEY (parent_id) REFERENCES call_paths (id),' 'ADD CONSTRAINT symbolfk FOREIGN KEY (symbol_id) REFERENCES symbols (id)') + if perf_db_export_calls: do_query(query, 'ALTER TABLE calls ' 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id),' 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),'
@@ -693,11 +706,11 @@ def branch_type_table(branch_type, name, *x): value = struct.pack(fmt, 2, 4, branch_type, n, name) branch_type_file.write(value) -def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, *x): +def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, call_path_id, *x): if branches: - value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiiiB", 17, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 4, branch_type, 1, in_tx) + value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiiiBiq", 18, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 4, branch_type, 1, in_tx, 8, call_path_id) else: - value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiqiqiqiqiiiB", 21, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 8, period, 8, weight, 8, transaction, 8, data_src, 4, branch_type, 1, in_tx) + value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiqiqiqiqiiiBiq", 22, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 8, period, 8, weight, 8, transaction, 8, data_src, 4, branch_type, 1, in_tx, 8, call_path_id) sample_file.write(value) def call_path_table(cp_id, parent_id, symbol_id, ip, *x):
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 8/11 perf stat: Add extra output of counter values with -vv
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add debug output of raw counter values per CPU when perf stat -v is specified, together with their cpu numbers. This is very useful to debug problems with per core counters, where we can normally only see aggregated values.
v2: Make it depend on -vv, not -v
--- tools/perf/builtin-stat.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/builtin-stat.c +8 -0
@@ -298,6 +298,14 @@ static int read_counter(struct perf_evsel *counter)return -1 ; } } + +if (verbose >1 ) { +fprintf (stat_config.output, +"%s: %d: %" PRIu64" %" PRIu64" %" PRIu64"\n" , +perf_evsel__name (counter), + cpu, + count->val, count->ena, count->run); + } } }
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 9/11 perf trace: Move signum beautifier to tools/perf/trace/beauty/
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To reduce the size of builtin-trace.c.
--- tools/perf/builtin-trace.c | 54 +--------------------------------------- tools/perf/trace/beauty/signum.c | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 tools/perf/trace/beauty/signum.c
tools/perf/builtin-trace.c +1 -53
@@ -621,59 +621,6 @@ static size_t syscall_arg__scnprintf_pipe_flags(char *bf, size_t size,#define SCA_PIPE_FLAGS syscall_arg__scnprintf_pipe_flags -static size_t syscall_arg__scnprintf_signum (char *bf,size_t size,struct syscall_arg *arg) -{ -int sig = arg->val; - -switch (sig) { -#define P_SIGNUM (n) case SIG##n: return scnprintf(bf, size, #n) -P_SIGNUM (HUP ); -P_SIGNUM (INT ); -P_SIGNUM (QUIT ); -P_SIGNUM (ILL ); -P_SIGNUM (TRAP ); -P_SIGNUM (ABRT ); -P_SIGNUM (BUS ); -P_SIGNUM (FPE ); -P_SIGNUM (KILL ); -P_SIGNUM (USR1 ); -P_SIGNUM (SEGV ); -P_SIGNUM (USR2 ); -P_SIGNUM (PIPE ); -P_SIGNUM (ALRM ); -P_SIGNUM (TERM ); -P_SIGNUM (CHLD ); -P_SIGNUM (CONT ); -P_SIGNUM (STOP ); -P_SIGNUM (TSTP ); -P_SIGNUM (TTIN ); -P_SIGNUM (TTOU ); -P_SIGNUM (URG ); -P_SIGNUM (XCPU ); -P_SIGNUM (XFSZ ); -P_SIGNUM (VTALRM ); -P_SIGNUM (PROF ); -P_SIGNUM (WINCH ); -P_SIGNUM (IO ); -P_SIGNUM (PWR ); -P_SIGNUM (SYS ); -#ifdef SIGEMT -P_SIGNUM (EMT ); -#endif -#ifdef SIGSTKFLT -P_SIGNUM (STKFLT ); -#endif -#ifdef SIGSWI -P_SIGNUM (SWI ); -#endif -default :break ; - } - -return scnprintf (bf, size,"%#x" , sig); -} - -#define SCA_SIGNUM syscall_arg__scnprintf_signum -#if defined(__i386__) || defined(__x86_64__)/* * FIXME: Make this available to all arches.
@@ -793,6 +740,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,#include "trace/beauty/msg_flags.c" #include "trace/beauty/perf_event_open.c" #include "trace/beauty/sched_policy.c" +#include "trace/beauty/signum.c" #include "trace/beauty/socket_type.c" #include "trace/beauty/waitid_options.c"
tools/perf/trace/beauty/signum.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 10/11 perf trace: Move open_flags beautifier to tools/perf/trace/beauty/
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To reduce the size of builtin-trace.c.
--- tools/perf/builtin-trace.c | 57 +----------------------------------- tools/perf/trace/beauty/open_flags.c | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 56 deletions(-) create mode 100644 tools/perf/trace/beauty/open_flags.c
tools/perf/builtin-trace.c +1 -56
@@ -542,62 +542,6 @@ static size_t syscall_arg__scnprintf_filename(char *bf, size_t size,#define SCA_FILENAME syscall_arg__scnprintf_filename -static size_t syscall_arg__scnprintf_open_flags (char *bf,size_t size, -struct syscall_arg *arg) -{ -int printed =0 , flags = arg->val; - -if (!(flags &O_CREAT )) - arg->mask |=1 << (arg->idx +1 );/* Mask the mode parm */ - -if (flags ==0 ) -return scnprintf (bf, size,"RDONLY" ); -#define P_FLAG (n) \ - if (flags & O_##n) { \ - printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ - flags &= ~O_##n; \ - } - -P_FLAG (APPEND ); -P_FLAG (ASYNC ); -P_FLAG (CLOEXEC ); -P_FLAG (CREAT ); -P_FLAG (DIRECT ); -P_FLAG (DIRECTORY ); -P_FLAG (EXCL ); -P_FLAG (LARGEFILE ); -P_FLAG (NOATIME ); -P_FLAG (NOCTTY ); -#ifdef O_NONBLOCK -P_FLAG (NONBLOCK ); -#elif O_NDELAY -P_FLAG (NDELAY ); -#endif -#ifdef O_PATH -P_FLAG (PATH ); -#endif -P_FLAG (RDWR ); -#ifdef O_DSYNC -if ((flags &O_SYNC ) ==O_SYNC ) - printed +=scnprintf (bf + printed, size - printed,"%s%s" , printed ?"|" :"" ,"SYNC" ); -else { -P_FLAG (DSYNC ); - } -#else -P_FLAG (SYNC ); -#endif -P_FLAG (TRUNC ); -P_FLAG (WRONLY ); -#undef P_FLAG - -if (flags) - printed +=scnprintf (bf + printed, size - printed,"%s%#x" , printed ?"|" :"" , flags); - -return printed; -} - -#define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags -static size_t syscall_arg__scnprintf_pipe_flags (char *bf,size_t size,struct syscall_arg *arg) {
@@ -738,6 +682,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,#include "trace/beauty/mmap.c" #include "trace/beauty/mode_t.c" #include "trace/beauty/msg_flags.c" +#include "trace/beauty/open_flags.c" #include "trace/beauty/perf_event_open.c" #include "trace/beauty/sched_policy.c" #include "trace/beauty/signum.c"
tools/perf/trace/beauty/open_flags.c new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 11/11 perf trace: Move futex_op beautifier to tools/perf/trace/beauty/
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To reduce the size of builtin-trace.c.
--- tools/perf/builtin-trace.c | 47 ++------------------------------------ tools/perf/trace/beauty/futex_op.c | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 tools/perf/trace/beauty/futex_op.c
tools/perf/builtin-trace.c +2 -45
@@ -40,7 +40,6 @@#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */ #include <stdlib.h> -#include <linux/futex.h> #include <linux/err.h> #include <linux/seccomp.h> #include <linux/filter.h>
@@ -401,49 +400,6 @@ static size_t syscall_arg__scnprintf_flock(char *bf, size_t size,#define SCA_FLOCK syscall_arg__scnprintf_flock -static size_t syscall_arg__scnprintf_futex_op (char *bf,size_t size,struct syscall_arg *arg) -{ -enum syscall_futex_args { -SCF_UADDR = (1 <<0 ), -SCF_OP = (1 <<1 ), -SCF_VAL = (1 <<2 ), -SCF_TIMEOUT = (1 <<3 ), -SCF_UADDR2 = (1 <<4 ), -SCF_VAL3 = (1 <<5 ), - }; -int op = arg->val; -int cmd = op &FUTEX_CMD_MASK ; -size_t printed =0 ; - -switch (cmd) { -#define P_FUTEX_OP (n) case FUTEX_##n: printed = scnprintf(bf, size, #n); -P_FUTEX_OP (WAIT ); arg->mask |=SCF_VAL3 |SCF_UADDR2 ;break ; -P_FUTEX_OP (WAKE ); arg->mask |=SCF_VAL3 |SCF_UADDR2 |SCF_TIMEOUT ;break ; -P_FUTEX_OP (FD ); arg->mask |=SCF_VAL3 |SCF_UADDR2 |SCF_TIMEOUT ;break ; -P_FUTEX_OP (REQUEUE ); arg->mask |=SCF_VAL3 |SCF_TIMEOUT ;break ; -P_FUTEX_OP (CMP_REQUEUE ); arg->mask |=SCF_TIMEOUT ;break ; -P_FUTEX_OP (CMP_REQUEUE_PI ); arg->mask |=SCF_TIMEOUT ;break ; -P_FUTEX_OP (WAKE_OP );break ; -P_FUTEX_OP (LOCK_PI ); arg->mask |=SCF_VAL3 |SCF_UADDR2 |SCF_TIMEOUT ;break ; -P_FUTEX_OP (UNLOCK_PI ); arg->mask |=SCF_VAL3 |SCF_UADDR2 |SCF_TIMEOUT ;break ; -P_FUTEX_OP (TRYLOCK_PI ); arg->mask |=SCF_VAL3 |SCF_UADDR2 ;break ; -P_FUTEX_OP (WAIT_BITSET ); arg->mask |=SCF_UADDR2 ;break ; -P_FUTEX_OP (WAKE_BITSET ); arg->mask |=SCF_UADDR2 ;break ; -P_FUTEX_OP (WAIT_REQUEUE_PI );break ; -default : printed =scnprintf (bf, size,"%#x" , cmd);break ; - } - -if (op &FUTEX_PRIVATE_FLAG ) - printed +=scnprintf (bf + printed, size - printed,"|PRIV" ); - -if (op &FUTEX_CLOCK_REALTIME ) - printed +=scnprintf (bf + printed, size - printed,"|CLKRT" ); - -return printed; -} - -#define SCA_FUTEX_OP syscall_arg__scnprintf_futex_op -static const char *bpf_cmd[] = {"MAP_CREATE" ,"MAP_LOOKUP_ELEM" ,"MAP_UPDATE_ELEM" ,"MAP_DELETE_ELEM" ,"MAP_GET_NEXT_KEY" ,"PROG_LOAD" ,
@@ -678,12 +634,13 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size, .arg_parm = { [arg] = &strarray__##array, }#include "trace/beauty/eventfd.c" -#include "trace/beauty/pid.c" +#include "trace/beauty/futex_op.c" #include "trace/beauty/mmap.c" #include "trace/beauty/mode_t.c" #include "trace/beauty/msg_flags.c" #include "trace/beauty/open_flags.c" #include "trace/beauty/perf_event_open.c" +#include "trace/beauty/pid.c" #include "trace/beauty/sched_policy.c" #include "trace/beauty/signum.c" #include "trace/beauty/socket_type.c"
tools/perf/trace/beauty/futex_op.c new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.5.5
Quoted 78 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit
c0edb7467c3d21b213ff734bfe810d81d2c6ed61:Merge tag 'perf-core-for-mingo-20160505' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/core (2016-05-06 08:35:14 +0200)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-20160506for you to fetch changes up to
d5d71e86d226abe7e08df5763127ed2bd07649a1:perf trace: Move
futex_opbeautifier totools/perf/trace/beauty/(2016-05-06 13:00:59 -0300)----------------------------------------------------------------
perf/core improvements and fixes:User visible:
- Fix ordering of kernel/user entries in 'caller' mode, where the kernel and user parts were being correctly inverted but kept in place wrt each other, i.e. 'callee' (k1, k2, u3, u4) became 'caller' (k2, k1, u4, u3) when it should be 'caller' (u4, u3, k2, k1) (Chris Phlipot)
- In 'perf trace' don't print the raw arg syscall args for a syscall that has no arguments, like
gettid(). This was happening because just checking if the syscall args list is NULL may mean that there are no args (e.g.: gettid) or that there is no tracepoint info (e.g.: clone) (Arnaldo Carvalho de Melo)- Add extra output of counter values with 'perf stat -vv' (Andi Kleen)
Infrastructure:
- Expose callchain db export via the python API (Chris Phlipot)
Code reorganization:
- Move some more syscall arg beautifiers from the 'perf trace' main file to separate files in
tools/perf/trace/beauty/, to reduce the main file line count (Arnaldo Carvalho de Melo)Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Andi Kleen (1):
perf stat: Add extra output of counter values with -vvArnaldo Carvalho de Melo (4):
perf trace: Do not print raw args list for syscalls with no args perf trace: Move signum beautifier totools/perf/trace/beauty/perf trace: Moveopen_flagsbeautifier totools/perf/trace/beauty/perf trace: Movefutex_opbeautifier totools/perf/trace/beauty/Chris Phlipot (6):
perf callchain: Fix incorrect ordering of entries
perf tools: Refactor code to move call path handling out of thread-stack perf script: Enable db export to output sampled callchains perf script: Add call path id to exported sample in db export perf script: Expose usage of the callchain db export via the python api perf script: Update export-to-postgresql to support callchain exporttools/perf/builtin-stat.c | 8 + tools/perf/builtin-trace.c | 165 ++------------------- tools/perf/scripts/python/export-to-postgresql.py | 47 +++--- tools/perf/trace/beauty/futex_op.c | 44 ++++++ tools/perf/trace/beauty/open_flags.c | 56 +++++++ tools/perf/trace/beauty/signum.c | 53 +++++++ tools/perf/util/Build | 1 + tools/perf/util/call-path.c | 122 +++++++++++++++ tools/perf/util/call-path.h | 77 ++++++++++ tools/perf/util/db-export.c | 85 +++++++++++ tools/perf/util/db-export.h | 3 + tools/perf/util/machine.c | 56 +++++-- .../util/scripting-engines/trace-event-python.c | 36 ++++-
Quoted 8 lines
tools/perf/util/thread-stack.c | 139 +---------------- tools/perf/util/thread-stack.h | 31 ++-- 15 files changed, 575 insertions(+), 348 deletions(-) create mode 100644 tools/perf/trace/beauty/futex_op.c create mode 100644 tools/perf/trace/beauty/open_flags.c create mode 100644 tools/perf/trace/beauty/signum.c create mode 100644 tools/perf/util/call-path.c create mode 100644 tools/perf/util/call-path.h
Pulled, thanks a lot Arnaldo!
Ingo