Skip to contentSkip to conversation

kernel profiling

DISCUSSION Dimitris Michailidis 1 participant 1 message Jul 9, 1999 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines · Robert Walsh

Other than /dev/profile, is there any mechanism available for profiling the kernel? For example, has anyone implemented a __mcount() function to handle a kernel compiled with -pg, or is this even possible?

Quoted 7 lines

We're currently profiling the kernel NFS daemon (the entire path from network to disk) using SPECsfs and other benchmarking mechanisms, and before I start working on a home-grown profiling mechanism I'd like to make sure I'm not reinventing the wheel.

BTW: /proc/profile hasn't got enough granularity for our purposes and doesn't provide info such as call-graph statistics.

Back in May I posted a patch to enable kernel profiling using gprof, which should give you the call graph statistics you want. The patch basically implements mcount() to collect statistics, adds a couple of files to /proc to make the statistics available to the user land, and provides a command, kernprof, to generate gmon.out for consumption by gprof. kernprof, in addition to preparing data for gprof, also does the job of readprofile, with a number of bugs of the latter fixed.

You can get the patch from

http://linuxwww.db.erau.edu/mail_archives/linux-kernel/May_99/2383.html

or other archives. Since there has been no response to this patch there has been no further development since the initial release, but it probably still applies cleanly against the 2.2.x kernels.

As noted in the initial post, due to bugs in gcc/egcs that cause miscompilation of programs that use -pg and regparms, to use this patch you either need a hacked version of egcs or you need to disable the FASTCALLs in the kernel (the latter is done in the IKD patch).

Let me know if you have any suggestions to improve the patch or need other assistance.

Signature · 6 lines
Dimitris Michailidis                    [email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/