[LLVMdev] Help regarding profiling information

Reid Spencer reid at x10sys.com
Wed Jul 27 14:38:36 PDT 2005


On Wed, 2005-07-27 at 14:07 -0400, Murali Nethi wrote:
> Hi,
> 
> I am trying to obtain basic block profiles for mediabench g721
> benchmark. I have successfully built llvm in profile_enabling mode.

The ENABLE_PROFILE variable to make builds profiling mode for the LLVM
tools, not for the programs you process with those tools.

> Then so as to find out the block execution frequency, I ran the
> command, analyze encode.out-cbe. It generated gmon.out which I read
> using gprof.

The gmon.out file is for the analyze program, not for the program you're
analyzing.

>  However, I did not get the basic block level execution
> frequency. Can anybody help me as to how I can extract the basic block
> execution frequency using llvm?

You need to use one of the instrumentation passes. In particular, the
block profiler, which can be found in
lib/Transforms/Instrumentation/BlockProfiling.cpp.

You can use it like this:

opt -insert-function-profiling -insert-block-profiling YourBytecode.bc > ProfiledBytecode.bc

This will insert the necessary instructions to do the profiling at run
time when you execute the program. You can then use llvm-prof to get the
profiling information.

To make all this easier, please review llvm/utils/profile.pl which is a
perl script that runs the necessary LLVM programs correctly to produce
the profiling information. 

> 
> Thanks
> Murali
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050727/c01691d8/attachment.sig>


More information about the llvm-dev mailing list