aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines/trace-event-python.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-05-07 00:49:28 -0400
committerIngo Molnar <mingo@kernel.org>2016-05-07 00:49:28 -0400
commitea7c28518943b26a85d73cd76acd03b71962cb18 (patch)
tree51106d348d0778b7b00d2b8212a9854497d7f47f /tools/perf/util/scripting-engines/trace-event-python.c
parentc0edb7467c3d21b213ff734bfe810d81d2c6ed61 (diff)
parentd5d71e86d226abe7e08df5763127ed2bd07649a1 (diff)
Merge tag 'perf-core-for-mingo-20160506' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: User visible changes: - 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 changes: - 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 <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 525eb49e7ba6..091bce67844c 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -41,6 +41,7 @@
41#include "../thread-stack.h" 41#include "../thread-stack.h"
42#include "../trace-event.h" 42#include "../trace-event.h"
43#include "../machine.h" 43#include "../machine.h"
44#include "../call-path.h"
44#include "thread_map.h" 45#include "thread_map.h"
45#include "cpumap.h" 46#include "cpumap.h"
46#include "stat.h" 47#include "stat.h"
@@ -681,7 +682,7 @@ static int python_export_sample(struct db_export *dbe,
681 struct tables *tables = container_of(dbe, struct tables, dbe); 682 struct tables *tables = container_of(dbe, struct tables, dbe);
682 PyObject *t; 683 PyObject *t;
683 684
684 t = tuple_new(21); 685 t = tuple_new(22);
685 686
686 tuple_set_u64(t, 0, es->db_id); 687 tuple_set_u64(t, 0, es->db_id);
687 tuple_set_u64(t, 1, es->evsel->db_id); 688 tuple_set_u64(t, 1, es->evsel->db_id);
@@ -704,6 +705,7 @@ static int python_export_sample(struct db_export *dbe,
704 tuple_set_u64(t, 18, es->sample->data_src); 705 tuple_set_u64(t, 18, es->sample->data_src);
705 tuple_set_s32(t, 19, es->sample->flags & PERF_BRANCH_MASK); 706 tuple_set_s32(t, 19, es->sample->flags & PERF_BRANCH_MASK);
706 tuple_set_s32(t, 20, !!(es->sample->flags & PERF_IP_FLAG_IN_TX)); 707 tuple_set_s32(t, 20, !!(es->sample->flags & PERF_IP_FLAG_IN_TX));
708 tuple_set_u64(t, 21, es->call_path_id);
707 709
708 call_object(tables->sample_handler, t, "sample_table"); 710 call_object(tables->sample_handler, t, "sample_table");
709 711
@@ -998,8 +1000,10 @@ static void set_table_handlers(struct tables *tables)
998{ 1000{
999 const char *perf_db_export_mode = "perf_db_export_mode"; 1001 const char *perf_db_export_mode = "perf_db_export_mode";
1000 const char *perf_db_export_calls = "perf_db_export_calls"; 1002 const char *perf_db_export_calls = "perf_db_export_calls";
1001 PyObject *db_export_mode, *db_export_calls; 1003 const char *perf_db_export_callchains = "perf_db_export_callchains";
1004 PyObject *db_export_mode, *db_export_calls, *db_export_callchains;
1002 bool export_calls = false; 1005 bool export_calls = false;
1006 bool export_callchains = false;
1003 int ret; 1007 int ret;
1004 1008
1005 memset(tables, 0, sizeof(struct tables)); 1009 memset(tables, 0, sizeof(struct tables));
@@ -1016,6 +1020,7 @@ static void set_table_handlers(struct tables *tables)
1016 if (!ret) 1020 if (!ret)
1017 return; 1021 return;
1018 1022
1023 /* handle export calls */
1019 tables->dbe.crp = NULL; 1024 tables->dbe.crp = NULL;
1020 db_export_calls = PyDict_GetItemString(main_dict, perf_db_export_calls); 1025 db_export_calls = PyDict_GetItemString(main_dict, perf_db_export_calls);
1021 if (db_export_calls) { 1026 if (db_export_calls) {
@@ -1033,6 +1038,33 @@ static void set_table_handlers(struct tables *tables)
1033 Py_FatalError("failed to create calls processor"); 1038 Py_FatalError("failed to create calls processor");
1034 } 1039 }
1035 1040
1041 /* handle export callchains */
1042 tables->dbe.cpr = NULL;
1043 db_export_callchains = PyDict_GetItemString(main_dict,
1044 perf_db_export_callchains);
1045 if (db_export_callchains) {
1046 ret = PyObject_IsTrue(db_export_callchains);
1047 if (ret == -1)
1048 handler_call_die(perf_db_export_callchains);
1049 export_callchains = !!ret;
1050 }
1051
1052 if (export_callchains) {
1053 /*
1054 * Attempt to use the call path root from the call return
1055 * processor, if the call return processor is in use. Otherwise,
1056 * we allocate a new call path root. This prevents exporting
1057 * duplicate call path ids when both are in use simultaniously.
1058 */
1059 if (tables->dbe.crp)
1060 tables->dbe.cpr = tables->dbe.crp->cpr;
1061 else
1062 tables->dbe.cpr = call_path_root__new();
1063
1064 if (!tables->dbe.cpr)
1065 Py_FatalError("failed to create calls processor");
1066 }
1067
1036 tables->db_export_mode = true; 1068 tables->db_export_mode = true;
1037 /* 1069 /*
1038 * Reserve per symbol space for symbol->db_id via symbol__priv() 1070 * Reserve per symbol space for symbol->db_id via symbol__priv()