aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/trace-event-parse.c
diff options
context:
space:
mode:
authorDavid Ahern <daahern@cisco.com>2011-03-10 00:23:25 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-14 16:05:55 -0400
commitc70c94b47405d2c94df19c16273daf1f5fb9193d (patch)
tree44e1f7bb1752bfde03e65b1435a4172a6d67a0d2 /tools/perf/util/trace-event-parse.c
parent2ee7a49f935b19f7daf0a110800488acd2479cba (diff)
perf script: Move printing of 'common' data from print_event and rename
This change does impact output: latency data is trace specific and is now printed after the common data - comm, tid, cpu, time and event name. Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <1299734608-5223-4-git-send-email-daahern@cisco.com> Signed-off-by: David Ahern <daahern@cisco.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r--tools/perf/util/trace-event-parse.c49
1 files changed, 10 insertions, 39 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index dd5f058292d8..0a7ed5b5e281 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -2643,9 +2643,9 @@ static void print_lat_fmt(void *data, int size __unused)
2643 printf("."); 2643 printf(".");
2644 2644
2645 if (lock_depth < 0) 2645 if (lock_depth < 0)
2646 printf("."); 2646 printf(". ");
2647 else 2647 else
2648 printf("%d", lock_depth); 2648 printf("%d ", lock_depth);
2649} 2649}
2650 2650
2651#define TRACE_GRAPH_INDENT 2 2651#define TRACE_GRAPH_INDENT 2
@@ -2821,18 +2821,13 @@ static void print_graph_nested(struct event *event, void *data)
2821 2821
2822static void 2822static void
2823pretty_print_func_ent(void *data, int size, struct event *event, 2823pretty_print_func_ent(void *data, int size, struct event *event,
2824 int cpu, int pid, const char *comm __unused, 2824 int cpu, int pid)
2825 unsigned long secs, unsigned long usecs)
2826{ 2825{
2827 struct format_field *field; 2826 struct format_field *field;
2828 struct record *rec; 2827 struct record *rec;
2829 void *copy_data; 2828 void *copy_data;
2830 unsigned long val; 2829 unsigned long val;
2831 2830
2832 printf("%5lu.%06lu | ", secs, usecs);
2833
2834 printf(" | ");
2835
2836 if (latency_format) { 2831 if (latency_format) {
2837 print_lat_fmt(data, size); 2832 print_lat_fmt(data, size);
2838 printf(" | "); 2833 printf(" | ");
@@ -2865,19 +2860,13 @@ out_free:
2865} 2860}
2866 2861
2867static void 2862static void
2868pretty_print_func_ret(void *data, int size __unused, struct event *event, 2863pretty_print_func_ret(void *data, int size __unused, struct event *event)
2869 int cpu __unused, int pid __unused, const char *comm __unused,
2870 unsigned long secs, unsigned long usecs)
2871{ 2864{
2872 unsigned long long rettime, calltime; 2865 unsigned long long rettime, calltime;
2873 unsigned long long duration, depth; 2866 unsigned long long duration, depth;
2874 struct format_field *field; 2867 struct format_field *field;
2875 int i; 2868 int i;
2876 2869
2877 printf("%5lu.%06lu | ", secs, usecs);
2878
2879 printf(" | ");
2880
2881 if (latency_format) { 2870 if (latency_format) {
2882 print_lat_fmt(data, size); 2871 print_lat_fmt(data, size);
2883 printf(" | "); 2872 printf(" | ");
@@ -2915,31 +2904,21 @@ pretty_print_func_ret(void *data, int size __unused, struct event *event,
2915 2904
2916static void 2905static void
2917pretty_print_func_graph(void *data, int size, struct event *event, 2906pretty_print_func_graph(void *data, int size, struct event *event,
2918 int cpu, int pid, const char *comm, 2907 int cpu, int pid)
2919 unsigned long secs, unsigned long usecs)
2920{ 2908{
2921 if (event->flags & EVENT_FL_ISFUNCENT) 2909 if (event->flags & EVENT_FL_ISFUNCENT)
2922 pretty_print_func_ent(data, size, event, 2910 pretty_print_func_ent(data, size, event, cpu, pid);
2923 cpu, pid, comm, secs, usecs);
2924 else if (event->flags & EVENT_FL_ISFUNCRET) 2911 else if (event->flags & EVENT_FL_ISFUNCRET)
2925 pretty_print_func_ret(data, size, event, 2912 pretty_print_func_ret(data, size, event);
2926 cpu, pid, comm, secs, usecs);
2927 printf("\n"); 2913 printf("\n");
2928} 2914}
2929 2915
2930void print_event(int cpu, void *data, int size, unsigned long long nsecs, 2916void print_trace_event(int cpu, void *data, int size)
2931 char *comm)
2932{ 2917{
2933 struct event *event; 2918 struct event *event;
2934 unsigned long secs;
2935 unsigned long usecs;
2936 int type; 2919 int type;
2937 int pid; 2920 int pid;
2938 2921
2939 secs = nsecs / NSECS_PER_SEC;
2940 nsecs -= secs * NSECS_PER_SEC;
2941 usecs = nsecs / NSECS_PER_USEC;
2942
2943 type = trace_parse_common_type(data); 2922 type = trace_parse_common_type(data);
2944 2923
2945 event = trace_find_event(type); 2924 event = trace_find_event(type);
@@ -2951,17 +2930,10 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs,
2951 pid = trace_parse_common_pid(data); 2930 pid = trace_parse_common_pid(data);
2952 2931
2953 if (event->flags & (EVENT_FL_ISFUNCENT | EVENT_FL_ISFUNCRET)) 2932 if (event->flags & (EVENT_FL_ISFUNCENT | EVENT_FL_ISFUNCRET))
2954 return pretty_print_func_graph(data, size, event, cpu, 2933 return pretty_print_func_graph(data, size, event, cpu, pid);
2955 pid, comm, secs, usecs);
2956 2934
2957 if (latency_format) { 2935 if (latency_format)
2958 printf("%8.8s-%-5d %3d",
2959 comm, pid, cpu);
2960 print_lat_fmt(data, size); 2936 print_lat_fmt(data, size);
2961 } else
2962 printf("%16s-%-5d [%03d]", comm, pid, cpu);
2963
2964 printf(" %5lu.%06lu: %s: ", secs, usecs, event->name);
2965 2937
2966 if (event->flags & EVENT_FL_FAILED) { 2938 if (event->flags & EVENT_FL_FAILED) {
2967 printf("EVENT '%s' FAILED TO PARSE\n", 2939 printf("EVENT '%s' FAILED TO PARSE\n",
@@ -2970,7 +2942,6 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs,
2970 } 2942 }
2971 2943
2972 pretty_print(data, size, event); 2944 pretty_print(data, size, event);
2973 printf("\n");
2974} 2945}
2975 2946
2976static void print_fields(struct print_flag_sym *field) 2947static void print_fields(struct print_flag_sym *field)