From owner-kernprof@oss.sgi.com Thu Aug 24 19:45:15 2000 Received: by oss.sgi.com id ; Thu, 24 Aug 2000 19:45:06 -0700 Received: from kwanon.research.canon.com.au ([203.12.172.254]:26117 "HELO kwanon.research.canon.com.au") by oss.sgi.com with SMTP id ; Thu, 24 Aug 2000 19:44:38 -0700 Received: from bellmann.research.canon.com.au (bellmann.research.canon.com.au [10.5.0.3]) by kwanon.research.canon.com.au (Postfix) with ESMTP id 365EB8A899 for ; Fri, 25 Aug 2000 02:48:32 +0000 (UTC) Received: from brixi.research.canon.com.au (brixi.research.canon.com.au [10.8.1.11]) by bellmann.research.canon.com.au (Postfix) with ESMTP id 938188B19 for ; Fri, 25 Aug 2000 12:39:06 +1000 (EST) Received: by brixi.research.canon.com.au (Postfix, from userid 157) id 5F11950F23; Fri, 25 Aug 2000 12:44:10 +1000 (EST) Subject: Kernel profiling patch for PPC architecture now available To: linux-kernel@vger.rutgers.edu (Linux kernel mailing list) Date: Fri, 18 Aug 2000 17:21:43 +1000 (EST) X-Mailer: ELM [version 2.5 PL1] Content-Length: 3230 Message-Id: <20000825024410.5F11950F23@brixi.research.canon.com.au> From: greyham@research.canon.com.au (Graham Stoney) Sender: owner-kernprof@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;kernprof-outgoing I recently had the need to do some simple kernel profiling on PPC, and noticed that the collection of data for /proc/profile wasn't implemented for the PPC architecture. I've since added it, and published the following patch: http://members.xoom.com/greyhams/linux/patches/2.2/profile.patch I'd be very grateful for any feedback you might have. Here's the header to whet the appetite: /proc/profile support for ppc & arm in 2.2 Updated: 16 August 2000 ------------------------------------------ ----------------------- The following patch adds /proc/profile kernel profiling support in the Linux 2.2 series kernel to those architectures that currently lack it. Previously, ppc and arm had fallen through the cracks and didn't support this, so the info in /proc/profile was always zeros. Kernel profiling works like this: each timer interrupt calls the do_profile function, and if the interrupt occurs during kernel code it increments a counter for each range of addresses. Profiling is enabled by the "profile=" option on the kernel command line, which also sets the granularity of data collected. The smaller the number, the finer the grain of data collected, and the more memory required for the data buffer. The user-space program "readprofile" then reads the profiling data from /proc/profile, and displays the data against kernel symbols read from System.map. Modules don't get profiled, sorry. In the interest of reducing duplication, this patch hauls all the divergent do_profile implementations out from those architectures that did support it, and puts it in linux/sched.h where all architectures can see it. I think the call to do_profile might be better moved to the architecture independent do_timer routine, to ensure that all new architectures also support profiling and prevent the problem which motivated this patch recurring. However, I'm not sure if this is correct for SMP machines and at least one architecture (sparc/ap1000) uses a seperate hardware tick other than the system timer to do profiling. I don't know how well this works for SMP kernels, but it shouldn't be any worse than it was before. I can't see why write_profile only adjusts the profiling timer on SMP machines in fs/proc/array.c; perhaps the #ifdef test is backwards? mips & sparc architectures had a CONFIG_PROFILE macro, but I couldn't see any definition of it, so I removed it. Perhaps I should add architecture-independent support for it in include/linux/sched.h? Note that other people are working on adding full _mcount-based gprof profiling to the kernel, but generally only for the i386 architecture. I'm not planning on going to that extreme. For examples, see: http://oss.sgi.com/projects/kernprof/ ftp://ftp.suse.com/pub/people/andrea/kernel-patches/ikd/ I'm very keen to hear from anyone willing to give this a try, even on architectures that already supported /proc/profile, just to make sure I didn't break anything. If there's sufficient interest, I'll follow up with a 2.4 patch once this has been tested. Please let me know what you think! -- Graham Stoney Principal Hardware/Software Engineer Canon Information Systems Research Australia Ph: +61 2 9805 2909 Fax: +61 2 9805 2929 From owner-kernprof@oss.sgi.com Wed Aug 30 02:20:38 2000 Received: by oss.sgi.com id ; Wed, 30 Aug 2000 02:20:28 -0700 Received: from m-relay.hcrc.edu.tw ([163.28.64.11]:30278 "EHLO m-relay.HcRC.edu.tw") by oss.sgi.com with ESMTP id ; Wed, 30 Aug 2000 02:19:48 -0700 Received: from yahoo.com (ngi2.eic.nctu.edu.tw [140.113.179.62]) by m-relay.HcRC.edu.tw (8.10.0/8.10.0) with SMTP id e7U9Iw352649; Wed, 30 Aug 2000 17:19:00 +0800 (CST) Message-Id: <200008300919.e7U9Iw352649@m-relay.HcRC.edu.tw> To: kernprof@oss.sgi.com Cc: hwidarta@yahoo.com Subject: questions about kernprof From: hwidarta@yahoo.com Date: Wed, 30 Aug 2000 17:21:02 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-kernprof@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;kernprof-outgoing Dear Sir, I have patched profile-0.7 on linux kernel 2.4.0-test5. It's fine to run all the initial kernel at boot time. But there are some problems with kernprof program; When I type "kernprof -b -t " with (1)kernprof-0.8-1 [root@abc /]# kernprof -b -t cc kernprof: kernel does not support call count mode [root@abc /]# kernprof -b -t ct kernprof: kernel does not support call backtrace mode (2)kernprof-0.8-2 Unable to handle kernel NULL pointer dereference (then the system have no response) the other problem is: (3)kernprof-0.9 [root@abc kernprof]# make gcc -c -O2 -fomit-frame-pointer -I/usr/include kernprof.c kernprof.c:39: linux/tasks.h: No such file or directory make: *** [kernprof.o] Error 1 (Is there any relation with SMP?) What's the problem ? I'm sure enable the PROFILING, FRAME_POINTER, M_COUNT options; and have created the character special device /dev/profile. Thanks, Hendra W ---------------------------------- Download ICQ at http://www.icq.com From owner-kernprof@oss.sgi.com Thu Aug 31 11:47:32 2000 Received: by oss.sgi.com id ; Thu, 31 Aug 2000 11:47:22 -0700 Received: from w199.z208176006.sjc-ca.dsl.cnc.net ([208.176.6.199]:28167 "EHLO market.ffnet.com") by oss.sgi.com with ESMTP id ; Thu, 31 Aug 2000 11:47:14 -0700 Received: by market.ffnet.com with Internet Mail Service (5.5.2650.21) id ; Thu, 31 Aug 2000 11:49:31 -0700 Message-ID: <485CD88F337799449852DFED2A3BB7DC024F6F@beach> From: Bill DeStein To: "'kernprof@oss.sgi.com'" Subject: Profiling a 2.2 kernel Date: Thu, 31 Aug 2000 11:47:07 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-kernprof@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;kernprof-outgoing I'd like to run kernprof with my 2.2.16 kernel. Is there a patch available for 2.2.16, and a version of kernprof that works with it? Thanks, Bill DeStein bill@ffnet.com