diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-09-21 06:02:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-21 08:28:04 -0400 |
commit | cdd6c482c9ff9c55475ee7392ec8f672eddb7be6 (patch) | |
tree | 81f98a3ab46c589792057fe2392c1e10f8ad7893 /tools/perf/builtin-record.c | |
parent | dfc65094d0313cc48969fa60bcf33d693aeb05a7 (diff) |
perf: Do the big rename: Performance Counters -> Performance Events
Bye-bye Performance Counters, welcome Performance Events!
In the past few months the perfcounters subsystem has grown out its
initial role of counting hardware events, and has become (and is
becoming) a much broader generic event enumeration, reporting, logging,
monitoring, analysis facility.
Naming its core object 'perf_counter' and naming the subsystem
'perfcounters' has become more and more of a misnomer. With pending
code like hw-breakpoints support the 'counter' name is less and
less appropriate.
All in one, we've decided to rename the subsystem to 'performance
events' and to propagate this rename through all fields, variables
and API names. (in an ABI compatible fashion)
The word 'event' is also a bit shorter than 'counter' - which makes
it slightly more convenient to write/handle as well.
Thanks goes to Stephane Eranian who first observed this misnomer and
suggested a rename.
User-space tooling and ABI compatibility is not affected - this patch
should be function-invariant. (Also, defconfigs were not touched to
keep the size down.)
This patch has been generated via the following script:
FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
sed -i \
-e 's/PERF_EVENT_/PERF_RECORD_/g' \
-e 's/PERF_COUNTER/PERF_EVENT/g' \
-e 's/perf_counter/perf_event/g' \
-e 's/nb_counters/nb_events/g' \
-e 's/swcounter/swevent/g' \
-e 's/tpcounter_event/tp_event/g' \
$FILES
for N in $(find . -name perf_counter.[ch]); do
M=$(echo $N | sed 's/perf_counter/perf_event/g')
mv $N $M
done
FILES=$(find . -name perf_event.*)
sed -i \
-e 's/COUNTER_MASK/REG_MASK/g' \
-e 's/COUNTER/EVENT/g' \
-e 's/\<event\>/event_id/g' \
-e 's/counter/event/g' \
-e 's/Counter/Event/g' \
$FILES
... to keep it as correct as possible. This script can also be
used by anyone who has pending perfcounters patches - it converts
a Linux kernel tree over to the new naming. We tried to time this
change to the point in time where the amount of pending patches
is the smallest: the end of the merge window.
Namespace clashes were fixed up in a preparatory patch - and some
stylistic fallout will be fixed up in a subsequent patch.
( NOTE: 'counters' are still the proper terminology when we deal
with hardware registers - and these sed scripts are a bit
over-eager in renaming them. I've undone some of that, but
in case there's something left where 'counter' would be
better than 'event' we can undo that on an individual basis
instead of touching an otherwise nicely automated patch. )
Suggested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-arch@vger.kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 2459e5a22ed8..a5a050af8e7d 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -77,7 +77,7 @@ static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS]; | |||
77 | 77 | ||
78 | static unsigned long mmap_read_head(struct mmap_data *md) | 78 | static unsigned long mmap_read_head(struct mmap_data *md) |
79 | { | 79 | { |
80 | struct perf_counter_mmap_page *pc = md->base; | 80 | struct perf_event_mmap_page *pc = md->base; |
81 | long head; | 81 | long head; |
82 | 82 | ||
83 | head = pc->data_head; | 83 | head = pc->data_head; |
@@ -88,7 +88,7 @@ static unsigned long mmap_read_head(struct mmap_data *md) | |||
88 | 88 | ||
89 | static void mmap_write_tail(struct mmap_data *md, unsigned long tail) | 89 | static void mmap_write_tail(struct mmap_data *md, unsigned long tail) |
90 | { | 90 | { |
91 | struct perf_counter_mmap_page *pc = md->base; | 91 | struct perf_event_mmap_page *pc = md->base; |
92 | 92 | ||
93 | /* | 93 | /* |
94 | * ensure all reads are done before we write the tail out. | 94 | * ensure all reads are done before we write the tail out. |
@@ -233,7 +233,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full) | |||
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | comm_ev.header.type = PERF_EVENT_COMM; | 236 | comm_ev.header.type = PERF_RECORD_COMM; |
237 | size = ALIGN(size, sizeof(u64)); | 237 | size = ALIGN(size, sizeof(u64)); |
238 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); | 238 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); |
239 | 239 | ||
@@ -288,7 +288,7 @@ static void pid_synthesize_mmap_samples(pid_t pid, pid_t tgid) | |||
288 | while (1) { | 288 | while (1) { |
289 | char bf[BUFSIZ], *pbf = bf; | 289 | char bf[BUFSIZ], *pbf = bf; |
290 | struct mmap_event mmap_ev = { | 290 | struct mmap_event mmap_ev = { |
291 | .header = { .type = PERF_EVENT_MMAP }, | 291 | .header = { .type = PERF_RECORD_MMAP }, |
292 | }; | 292 | }; |
293 | int n; | 293 | int n; |
294 | size_t size; | 294 | size_t size; |
@@ -355,7 +355,7 @@ static void synthesize_all(void) | |||
355 | 355 | ||
356 | static int group_fd; | 356 | static int group_fd; |
357 | 357 | ||
358 | static struct perf_header_attr *get_header_attr(struct perf_counter_attr *a, int nr) | 358 | static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int nr) |
359 | { | 359 | { |
360 | struct perf_header_attr *h_attr; | 360 | struct perf_header_attr *h_attr; |
361 | 361 | ||
@@ -371,7 +371,7 @@ static struct perf_header_attr *get_header_attr(struct perf_counter_attr *a, int | |||
371 | 371 | ||
372 | static void create_counter(int counter, int cpu, pid_t pid) | 372 | static void create_counter(int counter, int cpu, pid_t pid) |
373 | { | 373 | { |
374 | struct perf_counter_attr *attr = attrs + counter; | 374 | struct perf_event_attr *attr = attrs + counter; |
375 | struct perf_header_attr *h_attr; | 375 | struct perf_header_attr *h_attr; |
376 | int track = !counter; /* only the first counter needs these */ | 376 | int track = !counter; /* only the first counter needs these */ |
377 | struct { | 377 | struct { |
@@ -417,7 +417,7 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
417 | attr->disabled = 1; | 417 | attr->disabled = 1; |
418 | 418 | ||
419 | try_again: | 419 | try_again: |
420 | fd[nr_cpu][counter] = sys_perf_counter_open(attr, pid, cpu, group_fd, 0); | 420 | fd[nr_cpu][counter] = sys_perf_event_open(attr, pid, cpu, group_fd, 0); |
421 | 421 | ||
422 | if (fd[nr_cpu][counter] < 0) { | 422 | if (fd[nr_cpu][counter] < 0) { |
423 | int err = errno; | 423 | int err = errno; |
@@ -444,7 +444,7 @@ try_again: | |||
444 | printf("\n"); | 444 | printf("\n"); |
445 | error("perfcounter syscall returned with %d (%s)\n", | 445 | error("perfcounter syscall returned with %d (%s)\n", |
446 | fd[nr_cpu][counter], strerror(err)); | 446 | fd[nr_cpu][counter], strerror(err)); |
447 | die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n"); | 447 | die("No CONFIG_PERF_EVENTS=y kernel support configured?\n"); |
448 | exit(-1); | 448 | exit(-1); |
449 | } | 449 | } |
450 | 450 | ||
@@ -478,7 +478,7 @@ try_again: | |||
478 | if (multiplex && fd[nr_cpu][counter] != multiplex_fd) { | 478 | if (multiplex && fd[nr_cpu][counter] != multiplex_fd) { |
479 | int ret; | 479 | int ret; |
480 | 480 | ||
481 | ret = ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_SET_OUTPUT, multiplex_fd); | 481 | ret = ioctl(fd[nr_cpu][counter], PERF_EVENT_IOC_SET_OUTPUT, multiplex_fd); |
482 | assert(ret != -1); | 482 | assert(ret != -1); |
483 | } else { | 483 | } else { |
484 | event_array[nr_poll].fd = fd[nr_cpu][counter]; | 484 | event_array[nr_poll].fd = fd[nr_cpu][counter]; |
@@ -496,7 +496,7 @@ try_again: | |||
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_ENABLE); | 499 | ioctl(fd[nr_cpu][counter], PERF_EVENT_IOC_ENABLE); |
500 | } | 500 | } |
501 | 501 | ||
502 | static void open_counters(int cpu, pid_t pid) | 502 | static void open_counters(int cpu, pid_t pid) |
@@ -642,7 +642,7 @@ static int __cmd_record(int argc, const char **argv) | |||
642 | if (done) { | 642 | if (done) { |
643 | for (i = 0; i < nr_cpu; i++) { | 643 | for (i = 0; i < nr_cpu; i++) { |
644 | for (counter = 0; counter < nr_counters; counter++) | 644 | for (counter = 0; counter < nr_counters; counter++) |
645 | ioctl(fd[i][counter], PERF_COUNTER_IOC_DISABLE); | 645 | ioctl(fd[i][counter], PERF_EVENT_IOC_DISABLE); |
646 | } | 646 | } |
647 | } | 647 | } |
648 | } | 648 | } |