diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-02-18 05:28:55 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-02-18 05:28:55 -0800 |
| commit | 489d95995850301e3ae622327cd322f4b9077bbd (patch) | |
| tree | ea1c167714611a50adfcb82b572359ad767b0280 /include | |
| parent | a7308dbbc52c9ac0e8b534e3b3e086b32a754fc6 (diff) | |
[PATCH] consolidate and cleanup profiling code.
Patch from Nikita Danilov <Nikita@Namesys.COM>
this moves functions from identical per-architecture
arch/*/kernel/profile.c into generic kernel/profile.c. Also, identical
{x86,parisc,ppc64,sparc64}_profile_hook()'s are all replaced by the
single kernel/profile.c:profile_hook(), which is #defined to noop in
include/linux/profile.h if CONFIG_PROFILING is not set.
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-i386/hw_irq.h | 26 | ||||
| -rw-r--r-- | include/asm-parisc/irq.h | 17 | ||||
| -rw-r--r-- | include/asm-ppc64/hw_irq.h | 21 | ||||
| -rw-r--r-- | include/asm-sparc64/irq.h | 21 | ||||
| -rw-r--r-- | include/asm-x86_64/hw_irq.h | 26 | ||||
| -rw-r--r-- | include/linux/profile.h | 20 |
6 files changed, 22 insertions, 109 deletions
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index a20ce4941864..520821cb5eaf 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -76,11 +76,8 @@ static inline void x86_do_profile(struct pt_regs * regs) { unsigned long eip; extern unsigned long prof_cpu_mask; -#ifdef CONFIG_PROFILING - extern void x86_profile_hook(struct pt_regs *); - x86_profile_hook(regs); -#endif + profile_hook(regs); if (user_mode(regs)) return; @@ -109,27 +106,6 @@ static inline void x86_do_profile(struct pt_regs * regs) atomic_inc((atomic_t *)&prof_buffer[eip]); } -struct notifier_block; - -#ifdef CONFIG_PROFILING - -int register_profile_notifier(struct notifier_block * nb); -int unregister_profile_notifier(struct notifier_block * nb); - -#else - -static inline int register_profile_notifier(struct notifier_block * nb) -{ - return -ENOSYS; -} - -static inline int unregister_profile_notifier(struct notifier_block * nb) -{ - return -ENOSYS; -} - -#endif /* CONFIG_PROFILING */ - #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h index 90be00a83732..5cf1a18253ba 100644 --- a/include/asm-parisc/irq.h +++ b/include/asm-parisc/irq.h @@ -95,21 +95,4 @@ extern unsigned long txn_alloc_addr(int); /* soft power switch support (power.c) */ extern struct tasklet_struct power_tasklet; -struct notifier_block; - -#ifdef CONFIG_PROFILING -int register_profile_notifier(struct notifier_block *nb); -int unregister_profile_notifier(struct notifier_block *nb); -#else -static inline int register_profile_notifier(struct notifier_block *nb) -{ - return -ENOSYS; -} - -static inline int unregister_profile_notifier(struct notifier_block *nb) -{ - return -ENOSYS; -} -#endif - #endif /* _ASM_PARISC_IRQ_H */ diff --git a/include/asm-ppc64/hw_irq.h b/include/asm-ppc64/hw_irq.h index ba0a72f1185d..9b4ad1f7993f 100644 --- a/include/asm-ppc64/hw_irq.h +++ b/include/asm-ppc64/hw_irq.h @@ -81,26 +81,5 @@ static inline void __do_save_and_cli(unsigned long *flags) struct hw_interrupt_type; static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {} -struct notifier_block; - -#ifdef CONFIG_PROFILING - -int register_profile_notifier(struct notifier_block * nb); -int unregister_profile_notifier(struct notifier_block * nb); - -#else - -static inline int register_profile_notifier(struct notifier_block * nb) -{ - return -ENOSYS; -} - -static inline int unregister_profile_notifier(struct notifier_block * nb) -{ - return -ENOSYS; -} - -#endif /* CONFIG_PROFILING */ - #endif /* _PPC64_HW_IRQ_H */ #endif /* __KERNEL__ */ diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index 6dc5ce5a78c0..f2423a38eee4 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h @@ -157,25 +157,4 @@ static __inline__ unsigned long get_softint(void) return retval; } -struct notifier_block; - -#ifdef CONFIG_PROFILING - -int register_profile_notifier(struct notifier_block *nb); -int unregister_profile_notifier(struct notifier_block *nb); - -#else - -static inline int register_profile_notifier(struct notifier_block *nb) -{ - return -ENOSYS; -} - -static inline int unregister_profile_notifier(struct notifier_block *nb) -{ - return -ENOSYS; -} - -#endif /* CONFIG_PROFILING */ - #endif diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h index bb096fb7ab06..567e01a52346 100644 --- a/include/asm-x86_64/hw_irq.h +++ b/include/asm-x86_64/hw_irq.h @@ -135,11 +135,9 @@ static inline void x86_do_profile (struct pt_regs *regs) unsigned long rip; extern unsigned long prof_cpu_mask; extern char _stext; -#ifdef CONFIG_PROFILING - extern void x86_profile_hook(struct pt_regs *); - x86_profile_hook(regs); -#endif + profile_hook(regs); + if (user_mode(regs)) return; if (!prof_buffer) @@ -166,26 +164,6 @@ static inline void x86_do_profile (struct pt_regs *regs) atomic_inc((atomic_t *)&prof_buffer[rip]); } -struct notifier_block; - -#ifdef CONFIG_PROFILING - -int register_profile_notifier(struct notifier_block * nb); -int unregister_profile_notifier(struct notifier_block * nb); - -#else - -static inline int register_profile_notifier(struct notifier_block * nb) -{ - return -ENOSYS; -} - -static inline int unregister_profile_notifier(struct notifier_block * nb) -{ - return -ENOSYS; -} - -#endif /* CONFIG_PROFILING */ #ifdef CONFIG_SMP /*more of this file should probably be ifdefed SMP */ static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { if (IO_APIC_IRQ(i)) diff --git a/include/linux/profile.h b/include/linux/profile.h index 7ee46d4bb3cc..54c9b8b422af 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h @@ -45,6 +45,12 @@ int profile_event_register(enum profile_type, struct notifier_block * n); int profile_event_unregister(enum profile_type, struct notifier_block * n); +int register_profile_notifier(struct notifier_block * nb); +int unregister_profile_notifier(struct notifier_block * nb); + +/* profiling hook activated on each timer interrupt */ +void profile_hook(struct pt_regs * regs); + #else static inline int profile_event_register(enum profile_type t, struct notifier_block * n) @@ -60,7 +66,19 @@ static inline int profile_event_unregister(enum profile_type t, struct notifier_ #define profile_exit_task(a) do { } while (0) #define profile_exec_unmap(a) do { } while (0) #define profile_exit_mmap(a) do { } while (0) - + +static inline int register_profile_notifier(struct notifier_block * nb) +{ + return -ENOSYS; +} + +static inline int unregister_profile_notifier(struct notifier_block * nb) +{ + return -ENOSYS; +} + +#define profile_hook(regs) do { } while (0) + #endif /* CONFIG_PROFILING */ #endif /* __KERNEL__ */ |
