|
[Rivet] stopwatch feature for timing tests?David Bjergaard david.bjergaard at gmail.comTue Jun 28 18:09:33 BST 2016
Hi Andy, I don't. Most of the time when I need to find bottle necks I use gcov, which is generated per object file (so I think it should work with Rivet's shared library approach). I tried playing with gprof (since that's what I turn to with c++) but it doesn't handle the python script. I don't have a minimal working example, but I thought one should be able to do: > rivet-buildplugin RivetMY_ANALYSIS.so MY_ANALYSIS.cc -pg > rivet --pwd --a MY_ANALYSIS foo.hepmc > gprof gmon.out In my test, it doesn't look like this produces the expected gmon.out to profile with, so I'm not sure what's going on. David Andy Buckley <andy.buckley at cern.ch> writes: > Do you have a recipe for profiling Rivet analyses, David? Not sure why > they are less straightforward than usual... do you mean because > "rivet" is a Python script? "time" will work fine, of course; for any > Python scripts you need to profile the python (or whatever) binary > executable explicitly, i.e. "valgrind --tool=callgrind python `which > rivet` ..." and the same for e.g. gdb. > > Guess we could put this stuff in a debugging page on the wiki, if > there's interest. Or just add it to the troubleshooting / FAQs. > > Andy > > > On 28/06/16 16:59, David Bjergaard wrote: >> Is there a reason the standard profiling tools don't work? >> $ time rivet >> >> Other alternatives: >> http://fa.bianp.net/blog/2011/a-profiler-for-python-extensions/ >> http://gernotklingler.com/blog/gprof-valgrind-gperftools-evaluation-tools-application-level-cpu-profiling-linux/ >> >> It would be nice if there were a prescription on the Rivet wiki for how to >> profile analyses since it isn't as straight forward as a traditional C++ >> program. >> >> David >> >> Raghav Kunnawalkam Elayavalli <raghav.k.e at cern.ch> writes: >> >>> Yeah i want to internally check the timing of certain methods i have >>> that get called during run time. >>> >>> liking with root works and the timing is pretty accurate from both >>> cases >>> rivet-buildplugin RivetAnalysis.so Analysis.cc -lRecursiveTools $ >>> (root-config --cflags --libs) >>> >>> finished: Time from root TStopwatch >>> CPU time (min) = 0.484667 >>> Real time (min) = 0.487455 >>> >>> Rivet run completed at 2016-06-28 17:31:56, time elapsed = 0:00:29 >>> >>> Cheers >>> Raghav >>> >>> On Jun 28, 2016, at 5:25 PM, Andy Buckley <a.g.buckley at gmail.com> >>> wrote: >>> >>> >>> >>> On 28/06/16 16:18, Raghav Kunnawalkam Elayavalli wrote: >>> >>> Hi Rivet experts, >>> >>> I would like to optimize an analysis of mine for which i need >>> the help of something like the TStopwatch feature. I assume i >>> can use that from root itself, pointing to the rootcxxflags >>> during compilation, but i wanted to know if Rivet has >>> something like that. I cant find a timer class in the >>> documentation. but in know its there since you printout the >>> time elapsed. >>> >>> >>> I guess it's ok to link against ROOT like you say. With the usual >>> caveats about accuracy of such timing tests. >>> >>> The timing that we write out is just in the script layer, using >>> Python's datetime module. It gives overall timing rather than >>> per-component. At a simpler level you could just run it through >>> the "time" shell command, but I guess you want to do some internal >>> profiling? Maybe worth looking into valgrind, gprof, or perf for >>> that. >>> >>> Andy >>> >>> -- >>> Dr Andy Buckley, Lecturer / Royal Society University Research >>> Fellow >>> Particle Physics Expt Group, University of Glasgow >>> >>> >>> >>> _______________________________________________ >>> Rivet mailing list >>> Rivet at projects.hepforge.org >>> https://www.hepforge.org/lists/listinfo/rivet
More information about the Rivet mailing list |