Skip to content

Commit

Permalink
perf: Do the big rename: Performance Counters -> Performance Events
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Acked-by: Paul Mackerras <[email protected]>
Reviewed-by: Arjan van de Ven <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: David Howells <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Ingo Molnar committed Sep 21, 2009
1 parent dfc6509 commit cdd6c48
Show file tree
Hide file tree
Showing 132 changed files with 2,452 additions and 2,452 deletions.
2 changes: 1 addition & 1 deletion arch/arm/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
#define __NR_preadv (__NR_SYSCALL_BASE+361)
#define __NR_pwritev (__NR_SYSCALL_BASE+362)
#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
#define __NR_perf_counter_open (__NR_SYSCALL_BASE+364)
#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)

/*
* The following SWIs are ARM private.
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/calls.S
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
CALL(sys_preadv)
CALL(sys_pwritev)
CALL(sys_rt_tgsigqueueinfo)
CALL(sys_perf_counter_open)
CALL(sys_perf_event_open)
#ifndef syscalls_counted
.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
#define syscalls_counted
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
#define __NR_preadv 366
#define __NR_pwritev 367
#define __NR_rt_tgsigqueueinfo 368
#define __NR_perf_counter_open 369
#define __NR_perf_event_open 369

#define __NR_syscall 370
#define NR_syscalls __NR_syscall
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/mach-common/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,7 @@ ENTRY(_sys_call_table)
.long _sys_preadv
.long _sys_pwritev
.long _sys_rt_tgsigqueueinfo
.long _sys_perf_counter_open
.long _sys_perf_event_open

.rept NR_syscalls-(.-_sys_call_table)/4
.long _sys_ni_syscall
Expand Down
2 changes: 1 addition & 1 deletion arch/frv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ config FRV
default y
select HAVE_IDE
select HAVE_ARCH_TRACEHOOK
select HAVE_PERF_COUNTERS
select HAVE_PERF_EVENTS

config ZONE_DMA
bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* FRV performance counter support
/* FRV performance event support
*
* Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
* Written by David Howells ([email protected])
Expand All @@ -9,9 +9,9 @@
* 2 of the Licence, or (at your option) any later version.
*/

#ifndef _ASM_PERF_COUNTER_H
#define _ASM_PERF_COUNTER_H
#ifndef _ASM_PERF_EVENT_H
#define _ASM_PERF_EVENT_H

#define PERF_COUNTER_INDEX_OFFSET 0
#define PERF_EVENT_INDEX_OFFSET 0

#endif /* _ASM_PERF_COUNTER_H */
#endif /* _ASM_PERF_EVENT_H */
2 changes: 1 addition & 1 deletion arch/frv/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
#define __NR_preadv 333
#define __NR_pwritev 334
#define __NR_rt_tgsigqueueinfo 335
#define __NR_perf_counter_open 336
#define __NR_perf_event_open 336

#ifdef __KERNEL__

Expand Down
2 changes: 1 addition & 1 deletion arch/frv/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,6 @@ sys_call_table:
.long sys_preadv
.long sys_pwritev
.long sys_rt_tgsigqueueinfo /* 335 */
.long sys_perf_counter_open
.long sys_perf_event_open

syscall_table_size = (. - sys_call_table)
2 changes: 1 addition & 1 deletion arch/frv/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
lib-y := \
__ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \
checksum.o memcpy.o memset.o atomic-ops.o atomic64-ops.o \
outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o perf_counter.o
outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o perf_event.o
8 changes: 4 additions & 4 deletions arch/frv/lib/perf_counter.c → arch/frv/lib/perf_event.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Performance counter handling
/* Performance event handling
*
* Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
* Written by David Howells ([email protected])
Expand All @@ -9,11 +9,11 @@
* 2 of the Licence, or (at your option) any later version.
*/

#include <linux/perf_counter.h>
#include <linux/perf_event.h>

/*
* mark the performance counter as pending
* mark the performance event as pending
*/
void set_perf_counter_pending(void)
void set_perf_event_pending(void)
{
}
2 changes: 1 addition & 1 deletion arch/m68k/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
#define __NR_preadv 329
#define __NR_pwritev 330
#define __NR_rt_tgsigqueueinfo 331
#define __NR_perf_counter_open 332
#define __NR_perf_event_open 332

#ifdef __KERNEL__

Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -756,5 +756,5 @@ sys_call_table:
.long sys_preadv
.long sys_pwritev /* 330 */
.long sys_rt_tgsigqueueinfo
.long sys_perf_counter_open
.long sys_perf_event_open

2 changes: 1 addition & 1 deletion arch/m68knommu/kernel/syscalltable.S
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ ENTRY(sys_call_table)
.long sys_preadv
.long sys_pwritev /* 330 */
.long sys_rt_tgsigqueueinfo
.long sys_perf_counter_open
.long sys_perf_event_open

.rept NR_syscalls-(.-sys_call_table)/4
.long sys_ni_syscall
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
#define __NR_preadv 363 /* new */
#define __NR_pwritev 364 /* new */
#define __NR_rt_tgsigqueueinfo 365 /* new */
#define __NR_perf_counter_open 366 /* new */
#define __NR_perf_event_open 366 /* new */

#define __NR_syscalls 367

Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/syscall_table.S
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ ENTRY(sys_call_table)
.long sys_ni_syscall
.long sys_ni_syscall
.long sys_rt_tgsigqueueinfo /* 365 */
.long sys_perf_counter_open
.long sys_perf_event_open
6 changes: 3 additions & 3 deletions arch/mips/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
#define __NR_preadv (__NR_Linux + 330)
#define __NR_pwritev (__NR_Linux + 331)
#define __NR_rt_tgsigqueueinfo (__NR_Linux + 332)
#define __NR_perf_counter_open (__NR_Linux + 333)
#define __NR_perf_event_open (__NR_Linux + 333)
#define __NR_accept4 (__NR_Linux + 334)

/*
Expand Down Expand Up @@ -664,7 +664,7 @@
#define __NR_preadv (__NR_Linux + 289)
#define __NR_pwritev (__NR_Linux + 290)
#define __NR_rt_tgsigqueueinfo (__NR_Linux + 291)
#define __NR_perf_counter_open (__NR_Linux + 292)
#define __NR_perf_event_open (__NR_Linux + 292)
#define __NR_accept4 (__NR_Linux + 293)

/*
Expand Down Expand Up @@ -979,7 +979,7 @@
#define __NR_preadv (__NR_Linux + 293)
#define __NR_pwritev (__NR_Linux + 294)
#define __NR_rt_tgsigqueueinfo (__NR_Linux + 295)
#define __NR_perf_counter_open (__NR_Linux + 296)
#define __NR_perf_event_open (__NR_Linux + 296)
#define __NR_accept4 (__NR_Linux + 297)

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/scall32-o32.S
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ einval: li v0, -ENOSYS
sys sys_preadv 6 /* 4330 */
sys sys_pwritev 6
sys sys_rt_tgsigqueueinfo 4
sys sys_perf_counter_open 5
sys sys_perf_event_open 5
sys sys_accept4 4
.endm

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/scall64-64.S
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,6 @@ sys_call_table:
PTR sys_preadv
PTR sys_pwritev /* 5390 */
PTR sys_rt_tgsigqueueinfo
PTR sys_perf_counter_open
PTR sys_perf_event_open
PTR sys_accept4
.size sys_call_table,.-sys_call_table
2 changes: 1 addition & 1 deletion arch/mips/kernel/scall64-n32.S
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,6 @@ EXPORT(sysn32_call_table)
PTR sys_preadv
PTR sys_pwritev
PTR compat_sys_rt_tgsigqueueinfo /* 5295 */
PTR sys_perf_counter_open
PTR sys_perf_event_open
PTR sys_accept4
.size sysn32_call_table,.-sysn32_call_table
2 changes: 1 addition & 1 deletion arch/mips/kernel/scall64-o32.S
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,6 @@ sys_call_table:
PTR compat_sys_preadv /* 4330 */
PTR compat_sys_pwritev
PTR compat_sys_rt_tgsigqueueinfo
PTR sys_perf_counter_open
PTR sys_perf_event_open
PTR sys_accept4
.size sys_call_table,.-sys_call_table
2 changes: 1 addition & 1 deletion arch/mn10300/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
#define __NR_preadv 334
#define __NR_pwritev 335
#define __NR_rt_tgsigqueueinfo 336
#define __NR_perf_counter_open 337
#define __NR_perf_event_open 337

#ifdef __KERNEL__

Expand Down
2 changes: 1 addition & 1 deletion arch/mn10300/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ ENTRY(sys_call_table)
.long sys_preadv
.long sys_pwritev /* 335 */
.long sys_rt_tgsigqueueinfo
.long sys_perf_counter_open
.long sys_perf_event_open


nr_syscalls=(.-sys_call_table)/4
2 changes: 1 addition & 1 deletion arch/parisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config PARISC
select RTC_DRV_GENERIC
select INIT_ALL_POSSIBLE
select BUG
select HAVE_PERF_COUNTERS
select HAVE_PERF_EVENTS
select GENERIC_ATOMIC64 if !64BIT
help
The PA-RISC microprocessor is designed by Hewlett-Packard and used
Expand Down
7 changes: 0 additions & 7 deletions arch/parisc/include/asm/perf_counter.h

This file was deleted.

7 changes: 7 additions & 0 deletions arch/parisc/include/asm/perf_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __ASM_PARISC_PERF_EVENT_H
#define __ASM_PARISC_PERF_EVENT_H

/* parisc only supports software events through this interface. */
static inline void set_perf_event_pending(void) { }

#endif /* __ASM_PARISC_PERF_EVENT_H */
4 changes: 2 additions & 2 deletions arch/parisc/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,9 @@
#define __NR_preadv (__NR_Linux + 315)
#define __NR_pwritev (__NR_Linux + 316)
#define __NR_rt_tgsigqueueinfo (__NR_Linux + 317)
#define __NR_perf_counter_open (__NR_Linux + 318)
#define __NR_perf_event_open (__NR_Linux + 318)

#define __NR_Linux_syscalls (__NR_perf_counter_open + 1)
#define __NR_Linux_syscalls (__NR_perf_event_open + 1)


#define __IGNORE_select /* newselect */
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/syscall_table.S
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
ENTRY_COMP(preadv) /* 315 */
ENTRY_COMP(pwritev)
ENTRY_COMP(rt_tgsigqueueinfo)
ENTRY_SAME(perf_counter_open)
ENTRY_SAME(perf_event_open)

/* Nothing yet */

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ config PPC
select HAVE_OPROFILE
select HAVE_SYSCALL_WRAPPERS if PPC64
select GENERIC_ATOMIC64 if PPC32
select HAVE_PERF_COUNTERS
select HAVE_PERF_EVENTS

config EARLY_PRINTK
bool
Expand Down
22 changes: 11 additions & 11 deletions arch/powerpc/include/asm/hw_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,43 +135,43 @@ static inline int irqs_disabled_flags(unsigned long flags)
*/
struct irq_chip;

#ifdef CONFIG_PERF_COUNTERS
#ifdef CONFIG_PERF_EVENTS

#ifdef CONFIG_PPC64
static inline unsigned long test_perf_counter_pending(void)
static inline unsigned long test_perf_event_pending(void)
{
unsigned long x;

asm volatile("lbz %0,%1(13)"
: "=r" (x)
: "i" (offsetof(struct paca_struct, perf_counter_pending)));
: "i" (offsetof(struct paca_struct, perf_event_pending)));
return x;
}

static inline void set_perf_counter_pending(void)
static inline void set_perf_event_pending(void)
{
asm volatile("stb %0,%1(13)" : :
"r" (1),
"i" (offsetof(struct paca_struct, perf_counter_pending)));
"i" (offsetof(struct paca_struct, perf_event_pending)));
}

static inline void clear_perf_counter_pending(void)
static inline void clear_perf_event_pending(void)
{
asm volatile("stb %0,%1(13)" : :
"r" (0),
"i" (offsetof(struct paca_struct, perf_counter_pending)));
"i" (offsetof(struct paca_struct, perf_event_pending)));
}
#endif /* CONFIG_PPC64 */

#else /* CONFIG_PERF_COUNTERS */
#else /* CONFIG_PERF_EVENTS */

static inline unsigned long test_perf_counter_pending(void)
static inline unsigned long test_perf_event_pending(void)
{
return 0;
}

static inline void clear_perf_counter_pending(void) {}
#endif /* CONFIG_PERF_COUNTERS */
static inline void clear_perf_event_pending(void) {}
#endif /* CONFIG_PERF_EVENTS */

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_HW_IRQ_H */
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/paca.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct paca_struct {
u8 soft_enabled; /* irq soft-enable flag */
u8 hard_enabled; /* set if irqs are enabled in MSR */
u8 io_sync; /* writel() needs spin_unlock sync */
u8 perf_counter_pending; /* PM interrupt while soft-disabled */
u8 perf_event_pending; /* PM interrupt while soft-disabled */

/* Stuff for accurate time accounting */
u64 user_time; /* accumulated usermode TB ticks */
Expand Down
Loading

0 comments on commit cdd6c48

Please sign in to comment.