Re: kernel profiling in 2.1 ?

Thomas Bogendoerfer (tsbogend@alpha.franken.de)
Sun, 17 May 1998 23:19:57 +0200


On Sun, May 17, 1998 at 11:36:54AM -0700, Linus Torvalds wrote:
> It may be that the non-x86 profiling was broken - the profiling code was
> moved into architecture-specific code in order to get it right on SMP. It
> definitely works on x86, I'm using it occasionally (and it's sad how much
> time is spent getting the kernel lock).

ok, I forgot to grep the .h, so I missed the x86 profile implementation.
But for the alpha there is (was) no profiling. I just adapted the x86
version, and it works.

Now to my problem with the sluggishness of my machine. I realized, that
when the kernel gets gzipped the mouse pointer under X freezes for as
long as gzip runs. So I did a gzip < /dev/zero > /dev/null and was really
surprised, when the whole machine stopped. I couldn't stop the process,
login via ethernet, nothing. I had to reset it.

Another thing, which halts the machine for some seconds (and terminates by
itself) is something like dd if=/dev/zero of=/dev/null count=1000000. The
profile of such a dd run, doesn't show anything strange:

11 do_wp_page 0.0105
18 ret_from_sys_call 0.5625
19 loop 1.1875
45 write_null 5.6250
49 ret_from_reschedule 1.5312
84 ret_from_handle_bh 7.0000
238 sys_read 0.4648
308 restore_all 2.2000
408 read_zero 0.5050
422 entSys 2.1979
462 sys_write 0.7500
697 __copy_user 1.4893
2828 total 0.0020

Any idea ?

Thomas.

PS: profiling patch for Alpha

Index: time.c
===================================================================
RCS file: /usr/src/cvs/linux/arch/alpha/kernel/time.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 time.c
--- time.c 1998/05/10 21:12:24 1.1.1.7
+++ time.c 1998/05/17 21:07:30
@@ -90,6 +90,26 @@
smp_percpu_timer_interrupt(regs);
if (smp_processor_id() != boot_cpu_id)
return;
+#else
+#ifdef CONFIG_PROFILE
+ if(!user_mode(regs)) {
+ if (prof_buffer && current->pid) {
+ extern int _stext;
+ unsigned long pc = regs->pc;
+
+ 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
#endif

/*

-- 
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
                   [Linus Torvalds in <4rikft$7g5@linux.cs.Helsinki.FI>]

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu