aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-05-03 02:29:35 -0400
committerIngo Molnar <mingo@elte.hu>2010-05-03 02:29:35 -0400
commit0806ebd974590ab24ab357d5d87db744e56bfe13 (patch)
treebaf96726e3d9f8c2316e509e0a4cbc99ba5fe67a /tools/perf
parent090f7204dfdb5d7f18208ea81dfdba845897cedd (diff)
parentfeef47d0cb530e8419dfa0b48141b538b89b1b1a (diff)
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing into perf/core
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Documentation/perf-trace-perl.txt6
-rw-r--r--tools/perf/Documentation/perf-trace-python.txt10
-rw-r--r--tools/perf/scripts/perl/bin/check-perf-trace-record2
-rw-r--r--tools/perf/scripts/perl/bin/failed-syscalls-record2
-rw-r--r--tools/perf/scripts/perl/bin/rw-by-file-record2
-rw-r--r--tools/perf/scripts/perl/bin/rw-by-pid-record2
-rw-r--r--tools/perf/scripts/perl/bin/rwtop-record2
-rw-r--r--tools/perf/scripts/perl/bin/wakeup-latency-record2
-rw-r--r--tools/perf/scripts/perl/bin/workqueue-stats-record2
-rw-r--r--tools/perf/scripts/python/bin/failed-syscalls-by-pid-record2
-rw-r--r--tools/perf/scripts/python/bin/sctop-record2
-rw-r--r--tools/perf/scripts/python/bin/syscall-counts-by-pid-record2
-rw-r--r--tools/perf/scripts/python/bin/syscall-counts-record2
-rw-r--r--tools/perf/util/trace-event-parse.c89
-rw-r--r--tools/perf/util/trace-event-read.c12
-rw-r--r--tools/perf/util/trace-event.h1
16 files changed, 24 insertions, 116 deletions
diff --git a/tools/perf/Documentation/perf-trace-perl.txt b/tools/perf/Documentation/perf-trace-perl.txt
index d729cee8d987..ee6525ee6d69 100644
--- a/tools/perf/Documentation/perf-trace-perl.txt
+++ b/tools/perf/Documentation/perf-trace-perl.txt
@@ -49,12 +49,10 @@ available as calls back into the perf executable (see below).
49As an example, the following perf record command can be used to record 49As an example, the following perf record command can be used to record
50all sched_wakeup events in the system: 50all sched_wakeup events in the system:
51 51
52 # perf record -c 1 -f -a -M -R -e sched:sched_wakeup 52 # perf record -a -e sched:sched_wakeup
53 53
54Traces meant to be processed using a script should be recorded with 54Traces meant to be processed using a script should be recorded with
55the above options: -c 1 says to sample every event, -a to enable 55the above option: -a to enable system-wide collection.
56system-wide collection, -M to multiplex the output, and -R to collect
57raw samples.
58 56
59The format file for the sched_wakep event defines the following fields 57The format file for the sched_wakep event defines the following fields
60(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format): 58(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
diff --git a/tools/perf/Documentation/perf-trace-python.txt b/tools/perf/Documentation/perf-trace-python.txt
index a241aca77184..16a86500dcf1 100644
--- a/tools/perf/Documentation/perf-trace-python.txt
+++ b/tools/perf/Documentation/perf-trace-python.txt
@@ -93,7 +93,7 @@ don't care how it exited, so we'll use 'perf record' to record only
93the sys_enter events: 93the sys_enter events:
94 94
95---- 95----
96# perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter 96# perf record -a -e raw_syscalls:sys_enter
97 97
98^C[ perf record: Woken up 1 times to write data ] 98^C[ perf record: Woken up 1 times to write data ]
99[ perf record: Captured and wrote 56.545 MB perf.data (~2470503 samples) ] 99[ perf record: Captured and wrote 56.545 MB perf.data (~2470503 samples) ]
@@ -359,7 +359,7 @@ your script:
359# cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-record 359# cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-record
360 360
361#!/bin/bash 361#!/bin/bash
362perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter 362perf record -a -e raw_syscalls:sys_enter
363---- 363----
364 364
365The 'report' script is also a shell script with the same base name as 365The 'report' script is also a shell script with the same base name as
@@ -449,12 +449,10 @@ available as calls back into the perf executable (see below).
449As an example, the following perf record command can be used to record 449As an example, the following perf record command can be used to record
450all sched_wakeup events in the system: 450all sched_wakeup events in the system:
451 451
452 # perf record -c 1 -f -a -M -R -e sched:sched_wakeup 452 # perf record -a -e sched:sched_wakeup
453 453
454Traces meant to be processed using a script should be recorded with 454Traces meant to be processed using a script should be recorded with
455the above options: -c 1 says to sample every event, -a to enable 455the above option: -a to enable system-wide collection.
456system-wide collection, -M to multiplex the output, and -R to collect
457raw samples.
458 456
459The format file for the sched_wakep event defines the following fields 457The format file for the sched_wakep event defines the following fields
460(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format): 458(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
diff --git a/tools/perf/scripts/perl/bin/check-perf-trace-record b/tools/perf/scripts/perl/bin/check-perf-trace-record
index e6cb1474f8e8..423ad6aed056 100644
--- a/tools/perf/scripts/perl/bin/check-perf-trace-record
+++ b/tools/perf/scripts/perl/bin/check-perf-trace-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e kmem:kmalloc -e irq:softirq_entry -e kmem:kfree 2perf record -a -e kmem:kmalloc -e irq:softirq_entry -e kmem:kfree
diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-record b/tools/perf/scripts/perl/bin/failed-syscalls-record
index 6ad9b8f5f009..eb5846bcb565 100644
--- a/tools/perf/scripts/perl/bin/failed-syscalls-record
+++ b/tools/perf/scripts/perl/bin/failed-syscalls-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e raw_syscalls:sys_exit $@ 2perf record -a -e raw_syscalls:sys_exit $@
diff --git a/tools/perf/scripts/perl/bin/rw-by-file-record b/tools/perf/scripts/perl/bin/rw-by-file-record
index a828679837a8..5bfaae5a6cba 100644
--- a/tools/perf/scripts/perl/bin/rw-by-file-record
+++ b/tools/perf/scripts/perl/bin/rw-by-file-record
@@ -1,3 +1,3 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e syscalls:sys_enter_read -e syscalls:sys_enter_write $@ 2perf record -a -e syscalls:sys_enter_read -e syscalls:sys_enter_write $@
3 3
diff --git a/tools/perf/scripts/perl/bin/rw-by-pid-record b/tools/perf/scripts/perl/bin/rw-by-pid-record
index 63976bf11e8b..6e0b2f7755ac 100644
--- a/tools/perf/scripts/perl/bin/rw-by-pid-record
+++ b/tools/perf/scripts/perl/bin/rw-by-pid-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@ 2perf record -a -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@
diff --git a/tools/perf/scripts/perl/bin/rwtop-record b/tools/perf/scripts/perl/bin/rwtop-record
index 63976bf11e8b..6e0b2f7755ac 100644
--- a/tools/perf/scripts/perl/bin/rwtop-record
+++ b/tools/perf/scripts/perl/bin/rwtop-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@ 2perf record -a -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@
diff --git a/tools/perf/scripts/perl/bin/wakeup-latency-record b/tools/perf/scripts/perl/bin/wakeup-latency-record
index 9c0cf588ff8c..9f2acaaae9f0 100644
--- a/tools/perf/scripts/perl/bin/wakeup-latency-record
+++ b/tools/perf/scripts/perl/bin/wakeup-latency-record
@@ -1,5 +1,5 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e sched:sched_switch -e sched:sched_wakeup $@ 2perf record -a -e sched:sched_switch -e sched:sched_wakeup $@
3 3
4 4
5 5
diff --git a/tools/perf/scripts/perl/bin/workqueue-stats-record b/tools/perf/scripts/perl/bin/workqueue-stats-record
index c2a1a9421133..85301f2471ff 100644
--- a/tools/perf/scripts/perl/bin/workqueue-stats-record
+++ b/tools/perf/scripts/perl/bin/workqueue-stats-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e workqueue:workqueue_creation -e workqueue:workqueue_destruction -e workqueue:workqueue_execution -e workqueue:workqueue_insertion $@ 2perf record -a -e workqueue:workqueue_creation -e workqueue:workqueue_destruction -e workqueue:workqueue_execution -e workqueue:workqueue_insertion $@
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record
index 6ad9b8f5f009..eb5846bcb565 100644
--- a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record
+++ b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e raw_syscalls:sys_exit $@ 2perf record -a -e raw_syscalls:sys_exit $@
diff --git a/tools/perf/scripts/python/bin/sctop-record b/tools/perf/scripts/python/bin/sctop-record
index 27ccffa26ab4..1fc5998b721d 100644
--- a/tools/perf/scripts/python/bin/sctop-record
+++ b/tools/perf/scripts/python/bin/sctop-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter $@ 2perf record -a -e raw_syscalls:sys_enter $@
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-record b/tools/perf/scripts/python/bin/syscall-counts-by-pid-record
index 27ccffa26ab4..1fc5998b721d 100644
--- a/tools/perf/scripts/python/bin/syscall-counts-by-pid-record
+++ b/tools/perf/scripts/python/bin/syscall-counts-by-pid-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter $@ 2perf record -a -e raw_syscalls:sys_enter $@
diff --git a/tools/perf/scripts/python/bin/syscall-counts-record b/tools/perf/scripts/python/bin/syscall-counts-record
index 27ccffa26ab4..1fc5998b721d 100644
--- a/tools/perf/scripts/python/bin/syscall-counts-record
+++ b/tools/perf/scripts/python/bin/syscall-counts-record
@@ -1,2 +1,2 @@
1#!/bin/bash 1#!/bin/bash
2perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter $@ 2perf record -a -e raw_syscalls:sys_enter $@
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index d6ef414075a6..069f261b225c 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -691,11 +691,6 @@ static int __read_expected(enum event_type expect, const char *str,
691 return ret; 691 return ret;
692} 692}
693 693
694static int read_expected_warn(enum event_type expect, const char *str, bool warn)
695{
696 return __read_expected(expect, str, 1, warn);
697}
698
699static int read_expected(enum event_type expect, const char *str) 694static int read_expected(enum event_type expect, const char *str)
700{ 695{
701 return __read_expected(expect, str, 1, true); 696 return __read_expected(expect, str, 1, true);
@@ -3104,90 +3099,6 @@ static void print_args(struct print_arg *args)
3104 } 3099 }
3105} 3100}
3106 3101
3107static void parse_header_field(const char *field,
3108 int *offset, int *size, bool warn)
3109{
3110 char *token;
3111 int type;
3112
3113 if (read_expected(EVENT_ITEM, "field") < 0)
3114 return;
3115 if (read_expected(EVENT_OP, ":") < 0)
3116 return;
3117
3118 /* type */
3119 if (read_expect_type(EVENT_ITEM, &token) < 0)
3120 goto fail;
3121 free_token(token);
3122
3123 if (read_expected_warn(EVENT_ITEM, field, warn) < 0)
3124 return;
3125 if (read_expected(EVENT_OP, ";") < 0)
3126 return;
3127 if (read_expected(EVENT_ITEM, "offset") < 0)
3128 return;
3129 if (read_expected(EVENT_OP, ":") < 0)
3130 return;
3131 if (read_expect_type(EVENT_ITEM, &token) < 0)
3132 goto fail;
3133 *offset = atoi(token);
3134 free_token(token);
3135 if (read_expected(EVENT_OP, ";") < 0)
3136 return;
3137 if (read_expected(EVENT_ITEM, "size") < 0)
3138 return;
3139 if (read_expected(EVENT_OP, ":") < 0)
3140 return;
3141 if (read_expect_type(EVENT_ITEM, &token) < 0)
3142 goto fail;
3143 *size = atoi(token);
3144 free_token(token);
3145 if (read_expected(EVENT_OP, ";") < 0)
3146 return;
3147 type = read_token(&token);
3148 if (type != EVENT_NEWLINE) {
3149 /* newer versions of the kernel have a "signed" type */
3150 if (type != EVENT_ITEM)
3151 goto fail;
3152
3153 if (strcmp(token, "signed") != 0)
3154 goto fail;
3155
3156 free_token(token);
3157
3158 if (read_expected(EVENT_OP, ":") < 0)
3159 return;
3160
3161 if (read_expect_type(EVENT_ITEM, &token))
3162 goto fail;
3163
3164 free_token(token);
3165 if (read_expected(EVENT_OP, ";") < 0)
3166 return;
3167
3168 if (read_expect_type(EVENT_NEWLINE, &token))
3169 goto fail;
3170 }
3171 fail:
3172 free_token(token);
3173}
3174
3175int parse_header_page(char *buf, unsigned long size)
3176{
3177 init_input_buf(buf, size);
3178
3179 parse_header_field("timestamp", &header_page_ts_offset,
3180 &header_page_ts_size, true);
3181 parse_header_field("commit", &header_page_size_offset,
3182 &header_page_size_size, true);
3183 parse_header_field("overwrite", &header_page_overwrite_offset,
3184 &header_page_overwrite_size, false);
3185 parse_header_field("data", &header_page_data_offset,
3186 &header_page_data_size, true);
3187
3188 return 0;
3189}
3190
3191int parse_ftrace_file(char *buf, unsigned long size) 3102int parse_ftrace_file(char *buf, unsigned long size)
3192{ 3103{
3193 struct format_field *field; 3104 struct format_field *field;
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index 43f19c1fed3a..cb54cd002f49 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -53,6 +53,12 @@ static unsigned long page_size;
53static ssize_t calc_data_size; 53static ssize_t calc_data_size;
54static bool repipe; 54static bool repipe;
55 55
56/* If it fails, the next read will report it */
57static void skip(int size)
58{
59 lseek(input_fd, size, SEEK_CUR);
60}
61
56static int do_read(int fd, void *buf, int size) 62static int do_read(int fd, void *buf, int size)
57{ 63{
58 int rsize = size; 64 int rsize = size;
@@ -184,7 +190,6 @@ static void read_ftrace_printk(void)
184static void read_header_files(void) 190static void read_header_files(void)
185{ 191{
186 unsigned long long size; 192 unsigned long long size;
187 char *header_page;
188 char *header_event; 193 char *header_event;
189 char buf[BUFSIZ]; 194 char buf[BUFSIZ];
190 195
@@ -194,10 +199,7 @@ static void read_header_files(void)
194 die("did not read header page"); 199 die("did not read header page");
195 200
196 size = read8(); 201 size = read8();
197 header_page = malloc_or_die(size); 202 skip(size);
198 read_or_die(header_page, size);
199 parse_header_page(header_page, size);
200 free(header_page);
201 203
202 /* 204 /*
203 * The size field in the page is of type long, 205 * The size field in the page is of type long,
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index ebfee80e4a07..406d452956db 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -244,7 +244,6 @@ extern int header_page_data_size;
244 244
245extern bool latency_format; 245extern bool latency_format;
246 246
247int parse_header_page(char *buf, unsigned long size);
248int trace_parse_common_type(void *data); 247int trace_parse_common_type(void *data);
249int trace_parse_common_pid(void *data); 248int trace_parse_common_pid(void *data);
250int parse_common_pc(void *data); 249int parse_common_pc(void *data);