Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(48)

Issue 79049: Tell OProfile about JITted function names and addresses. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 8 months ago by Jeffrey Yasskin
Modified:
15 years, 7 months ago
Reviewers:
CC:
unladen-swallow_googlegroups.com
Base URL:
http://unladen-swallow.googlecode.com/svn/trunk/
Visibility:
Public.

Description

To 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
Unified diffs Side-by-side diffs Delta from patch set Stats (+68 lines, -12 lines) Patch
M Makefile.pre.in View 1 chunk +1 line, -1 line 1 comment Download
M Python/llvm_fbuilder.cc View 4 chunks +24 lines, -10 lines 0 comments Download
M Util/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp View 1 6 chunks +43 lines, -1 line 2 comments Download

Messages

Total messages: 3
Jeffrey Yasskin
FYI. I'm still thinking about the right way to contribute this to LLVM. It should ...
15 years, 8 months ago (2009-06-18 23:48:16 UTC) #1
Reid Kleckner
Wow, that was painless. If only we could get GDB to have an interface like ...
15 years, 8 months ago (2009-06-18 23:58:15 UTC) #2
Collin Winter
15 years, 8 months ago (2009-06-19 18:55:44 UTC) #3
Is the plan to just keep this patch around until a clean way of making this
conditional is found?

http://codereview.appspot.com/79049/diff/5/1005
File Makefile.pre.in (right):

http://codereview.appspot.com/79049/diff/5/1005#newcode435
Line 435: $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(LLVMLDFLAGS)
-L/usr/local/lib/oprofile -Wl,-rpath,/usr/local/lib/oprofile -lopagent \
Should this be done only with --enable-profiling? Is there any penalty to this?

http://codereview.appspot.com/79049/diff/5/1006
File Util/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp (right):

http://codereview.appspot.com/79049/diff/5/1006#newcode179
Line 179: // the session directory, can't find it, and aborts.  TODO: Find a
So oprofile *has* to be running?

http://codereview.appspot.com/79049/diff/5/1006#newcode551
Line 551: //oprofile_support->UnloadNativeCode(FnStart);
Add a todo?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b