DescriptionTo use this, you need at least oprofile 0.9.4. You'll want to build an optimized version of Python, but LLVM's Release mode turns off debug symbols, so you should run make like
   make KEEP_SYMBOLS=1 OPTIMIZE_OPTION="-O3 -g" ...
Then you get output like the following. Symbols starting with "#u#" are JITted python functions.
$ sudo opcontrol --reset
[sudo] password for jyasskin:
Signalling daemon... done
jyasskin@enki:~/opensource/unladen-swallow/tests$ sudo opcontrol --start-daemon; sudo opcontrol --start; ~/opensource/unladen-swallow/oprofile-support/opt/python  -j always -O2 ./performance/bm_django.py -n 50; sudo opcontrol --stop
Profiler running.
...
Stopping profiling.
jyasskin@enki:~/opensource/unladen-swallow/tests$ opreport -l ~/opensource/unladen-swallow/oprofile-support/opt/python |less
CPU: Core 2, speed 1998 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000
samples  %        image name               symbol name
123647    5.0879  python                   llvm::LiveInterval::MergeInClobberRanges(llvm::LiveInterval const&, llvm::BumpPtrAllocator&)
73691     3.0323  python                   lookdict_string
64236     2.6432  libc-2.7.so              _int_malloc
61182     2.5176  python                   _PyEval_CallFunction
46351     1.9073  python                   PyDict_GetItem
37980     1.5628  python                   llvm::SimpleRegisterCoalescing::JoinIntervals(llvm::LiveInterval&, llvm::LiveInterval&, bool&)
36001     1.4814  python                   llvm::MachineInstr::addRegisterDead(unsigned int, llvm::TargetRegisterInfo const*, bool)
30839     1.2690  python                   _PyType_Lookup
30642     1.2609  python                   PyObject_GenericGetAttr
30436     1.2524  python                   llvm::Use::getImpliedUser() const
29716     1.2228  python                   PyEval_EvalCodeEx
29151     1.1995  python                   tupledealloc
27553     1.1338  python                   PyTuple_New
27124     1.1161  14584.jo                 #u#force_unicode@/home/jyasskin/opensource/unladen-swallow/tests/lib/django/django/utils/encoding.py:37
24593     1.0120  libc-2.7.so              _int_free
22773     0.9371  python                   PyObject_CallFunctionObjArgs
22392     0.9214  python                   PyString_FromFormatV
22348     0.9196  python                   PyUnicodeUCS2_Decode
22285     0.9170  python                   PyFrame_New
22065     0.9079  libc-2.7.so              free
21499     0.8847  python                   llvm::DenseMap<llvm::BasicBlock*, llvm::DominatorTreeBase<llvm::BasicBlock>::InfoRec, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::DenseMapInfo<llvm::DominatorTreeBase<llvm::BasicBlock>::InfoRec> >::FindAndConstruct(llvm::BasicBlock* const&)
20178     0.8303  python                   frame_dealloc
19365     0.7968  14584.jo                 #u#render@/home/jyasskin/opensource/unladen-swallow/tests/lib/django/django/template/defaulttags.py:115
19168     0.7887  python                   llvm::SmallPtrSetImpl::FindBucketFor(void const
*) const
17539     0.7217  python                   llvm::LiveInterval::FindLiveRangeContaining(unsigned int) const
17143     0.7054  libc-2.7.so              malloc_consolidate
16711     0.6876  14584.jo                 #u#resolve@/home/jyasskin/opensource/unladen-swallow/tests/lib/django/django/template/__init__.py:533
16695     0.6870  libc-2.7.so              malloc
16336     0.6722  python                   PyObject_GC_UnTrack
15926     0.6553  python                   PyCFunction_Call
15864     0.6528  libstdc++.so.6.0.9       /usr/lib/libstdc++.so.6.0.9
15857     0.6525  python                   PyType_IsSubtype
15851     0.6522  python                   PyObject_GetAttr
15463     0.6363  libc-2.7.so              strlen
15236     0.6269  python                   vgetargskeywords
14859     0.6114  python                   void llvm::Calculate<llvm::Function, llvm::BasicBlock*>(llvm::DominatorTreeBase<llvm::GraphTraits<llvm::BasicBlock*>::NodeType>&, llvm::Function&)
14534     0.5981  python                   PyObject_Malloc
14438     0.5941  python                   PyObject_IsInstance
14013     0.5766  python                   convertsimple
13480     0.5547  python                   llvm::Use::getUser() const
13148     0.5410  python                   string_hash
13013     0.5355  python                   PyArg_UnpackTuple
12495     0.5142  python                   (anonymous namespace)::Verifier::visitInstruction(llvm::Instruction&)
12344     0.5079  python                   llvm::ComputeMaskedBits(llvm::Value*, llvm::APInt const&, llvm::APInt&, llvm::APInt&, llvm::TargetData*, unsigned int)
12243     0.5038  python                   PyEval_EvalFrame
12130     0.4991  python                   (anonymous namespace)::RALinScan::assignRegOrStackSlotAtInterval(llvm::LiveInterval*)
   
  Patch Set 1 #Patch Set 2 : Unloading symbols seems to break things... #
      Total comments: 3
      
     
  
  
 MessagesTotal messages: 3 
  
       | 
    |||||||||||||||||||||||||||||||||||||