Related articles |
---|
generic profiler for C code? stanigator@gmail.com (ssylee) (2009-01-27) |
Re: generic profiler for C code? stanigator@gmail.com (ssylee) (2009-01-27) |
Re: generic profiler for C code? kamalpr@hp.com (kamal) (2009-02-08) |
From: | kamal <kamalpr@hp.com> |
Newsgroups: | comp.compilers |
Date: | Sun, 8 Feb 2009 01:48:46 -0800 (PST) |
Organization: | Compilers Central |
References: | 09-01-054 09-01-057 |
Keywords: | C, performance, tools |
Posted-Date: | 10 Feb 2009 09:36:26 EST |
On Jan 28, 9:39 am, ssylee <staniga...@gmail.com> wrote:
> On Jan 27, 12:43 pm, ssylee <staniga...@gmail.com> wrote:
>
> > I'm running the C/C++ file to be generated as a mex file, used by m-file
> > in Matlab. However, I'm not sure if there are any generic profiler
> > libraries where I can just insert profiler function calls between the
> > function execution that I want to test out. It would be great for some
> > feedback.
if it is a binary generated by a C/C++ compiler, you can use the
standard gprof utility that uses a profiler library.
http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html
It can tell you how many times a function was called in a call graph,
and also provide a histogram as to where the program spent most of its
time executing. The locatiion is in terms of which instructions or C/C+
+ language statements (approximately) the program spent executing. The
histogram is generated based on what the PC value was, when a clock
interrupt occurred in the kernel (once every 10 ms usually).
> > [What are you trying to profile? Time per call? Number of calls?
> > Ranges of arguments? Something else? -John]
>
> To add to my question, I'm trying to profile function call execution
> times in my mex-generating C++ source code for Matlab (i.e. time per
> call).
If the gprof output isn't good enough, you will have to extend the
framework (i.e. add calls in generated code to functions in profiler
library).
Hope that helps.
regards
-kamal
Return to the
comp.compilers page.
Search the
comp.compilers archives again.