From 3c1ee244e6bf987a10bdcb6224757a8b651c88fb Mon Sep 17 00:00:00 2001 From: Thomas Bogendoerfer Date: Fri, 28 Aug 1998 23:29:33 +0000 Subject: added profiling again. --- arch/mips/kernel/time.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 9c51d1eb7..bf056a122 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c @@ -6,7 +6,7 @@ * This file contains the time handling details for PC-style clocks as * found in some MIPS systems. * - * $Id: time.c,v 1.5 1998/06/06 12:41:48 tsbogend Exp $ + * $Id: time.c,v 1.6 1998/08/25 09:14:43 ralf Exp $ */ #include #include @@ -329,6 +329,25 @@ static long last_rtc_update = 0; static void inline timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) { +#ifdef CONFIG_PROFILE + if(!user_mode(regs)) { + if (prof_buffer && current->pid) { + extern int _stext; + unsigned long pc = regs->cp0_epc; + + pc -= (unsigned long) &_stext; + pc >>= prof_shift; + /* + * Dont ignore out-of-bounds pc values silently, + * put them into the last histogram slot, so if + * present, they will show up as a sharp peak. + */ + if (pc > prof_len-1) + pc = prof_len-1; + atomic_inc((atomic_t *)&prof_buffer[pc]); + } + } +#endif do_timer(regs); /* -- cgit v1.2.3