Subject: Running profiling code at function exit time
To: None <tech-kern@NetBSD.ORG>
From: Ben Tober <>
List: tech-kern
Date: 10/24/1996 23:48:42
	Please excuse me for being lazy and prevailing upon the collective
wisdom of the list, but I couldn't think of an easy way to find this out.  I
am currently modifying kernel profiling to record actual execution time
statistics (on the Pentium, using the cycle counter register, but the
technique is generally applicable to other processors that have such registers)
instead of just stat clock statistics for functions.  In order to do this
accurately, I need to have code that runs both as functions enter and as they
exit.  mcount() is run for every entry entry of a profiled function.  It
doesn't appear, however, that there is an equivalent of mcount() for doing
profiling work on the exit from a function.  Is there a way that I can make
some code be executed during function exit for profiled functions?  Clearly,
this could be done by modifying gcc, but I was thinking that perhaps some
hook for this that I'm not aware of is already provided.