I’m not sure what you’re trying to achieve (i.e. are you researching this
for a product), so I may be answering the wrong thing…
Intel’s VTune can do this for you, and there is a product from AMD, Code
Analyst, that does profiling too.
I’m more familiar with VTune (although I worked at AMD, and I have used
Code Analyst too), and it’s basicly using the method of using a timer
interrrupt to figure out where in the code the execution happened, and dig
out which application this belongs to, etc.
There are similar tools for Linux, oprofile is one of the ones I’ve used.
I’ve written code that does the same thing in real-time OS’s, using a timer
interrupt and grabbing the “return address” of the stack, and you can quite
easily make a histogram of where the code is executing. With a reasonably
precise timer (1ms or so), you get a good idea of where you’ve executed for
most of the time. Obviously, depending on the run-time of the application,
more or less precise timer is needed. 1ms is good enough for something that
runs for a few seconds and upwards. If the app only runs for a second or
so, you’re not going to get enough samples to get any good statistics.
I hope this helps somewhat…
–
Mats
xxxxx@lists.osr.com wrote on 09/22/2004 12:47:04 PM:
Hi,
I have developed a profiler which uses the microsoft vc compiler
switch “/Gh” to add hook function into each function call. The
drawback of this hooking method is you need to do it at compile time
(needs recompiling to get regular build/profile build) and need the
source (not an issue for developers profiling their own code).
I was exploring a method/mechanism to do a runtime hooking by either
some binary patching or using some callback (if any) on each function
call. I have seen some profilers which can attach to a running process
and generate profile information (needs debug info which is not an
issue).
Can someone give me some leads regarding this. I am willing to
explore suggestions.
with best regards,
dhruva
PS: I am posting this question to both NTdev and Windbg lists as I do
not know whether we need to work at driver level (I have no exp) or
use DbgHelp/ImageHlp libraries (some exp).
–
Proud FSF member: #1935
http://schemer.fateback.com/
Questions? First check the Kernel Driver FAQ at http://www.
osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
ForwardSourceID:NT00003EC6