Benchmarking C++ operators 2004-06-01 - By Daniel Bachler
Back Well there is Intels Vtune, but it's quite expensive (although I think that there is a trial version available) and it can be a bit tough to set up so that it returns some usefull information. MSVC has some kind of profiler of its own IIRC, but without any graphical representation or anything fancy. And, last but not least, you can of course take timestamps yourself everytime you operator gets called and everytime it returns and measuring that time. If it's something simple I would first try the last trick, it's quite fast to setup and very precise, as the time you loose on profiling is really negligible. If you want to take it a step further you can store an array of simple structures containing last starttime and amount of time in that block, then write two small function, like this: (C++ style pseudocode)
Void StartBlock(int blockIndex) { m_ProfilerStructures[blockIndex].m_Starttime = gettime(); }
Void EndBlock(int blockIndex) { m_ProfilerStructures[blockIndex].m_ElapsedTime += gettime() - m_ProfilerStructures[blockIndex].m_Startime(); }
You can then use it like this:
StartBlock(INIT); Initialize(); EndBlock(INIT); StartBlock(MAIN); DoStruff(); EndBlock(MAIN);
Daniel
> -- --Original Message-- -- > From: owner-xsi@(protected) > [mailto:owner-xsi@(protected)] On Behalf Of Felix Gebhardt > Sent: Tuesday, June 01, 2004 2:22 PM > To: XSI@(protected) > Subject: Benchmarking C++ operators > > Hi all, > > does anyone happen to have an advise on what's the best way > to benchmark > compiled operators? In VBS I just would take a time snapshot > but it's not > too precise. How to nail it down better in C++? Any simple > but precise way > or free and easy to use analyzer/profiler? > > Suggestions greatly appreciated, > Felix > --- > Unsubscribe? Mail Majordomo@(protected) with the following > text in body: > unsubscribe xsi >
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|