patch-2.1.37 linux/arch/m68k/kernel/time.c

Next file: linux/arch/m68k/kernel/traps.c
Previous file: linux/arch/m68k/kernel/signal.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.36/linux/arch/m68k/kernel/time.c linux/arch/m68k/kernel/time.c
@@ -27,6 +27,24 @@
   return -1;
 }
 
+static inline void do_profile (unsigned long pc)
+{
+	if (prof_buffer && current->pid) {
+		extern int _stext;
+		pc -= (unsigned long) &_stext;
+		pc >>= prof_shift;
+		if (pc < prof_len)
+			++prof_buffer[pc];
+		else
+		/*
+		 * 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.
+		 */
+			++prof_buffer[prof_len-1];
+	}
+}
+
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
@@ -37,6 +55,9 @@
 	static long last_rtc_update=0;
 
 	do_timer(regs);
+
+	if (!user_mode(regs))
+		do_profile(regs->pc);
 
 	/*
 	 * If we have an externally synchronized Linux clock, then update

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov