Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-02-04 20:05:42


> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Jonathan Turkanis
> Sent: Friday, February 04, 2005 2:45 PM
> To: boost_at_[hidden]
> Subject: [boost] Re: Profiling Library suggestion
>
> christopher diggins wrote:
> > I was searching around boost for mention of a profiling library. A
> > fellow by the name of Carl Daniels posted something about an
invasive
> > profiling library. I was wondering in anyone knows what happened to
> > that project? Profiling seems lacking at Boost, is anyone else
> > interested in such a thing?
> >
> > Would a trivial policy driven RAII type be sufficient to garner
> > interest as
> > a mini-library?
> >
> > e.g.
> >
> > struct ProfilerDefaultPolicy {
> > OnElapsed(int msec) {
> > cout << "time elapsed (msec): " << msec << endl;
> > }
> > };
> >
> > template<typename Policy_T = ProfilerDefaultPolicy>
> > class Profiler {
> > public:
> > Profiler() { mnStart = GetTickCount(); };
> > ~Profiler() { Policy_T::OnElapsed(GetMSecElapsed()); };
> > int GetMSecElapsed() { return GetTickCount() - mnStart; };
> > int GetTickCount() { return int(double(clock()) * 1000 /
> > CLOCKS_PER_SEC); };
> > private:
> > int mnStart;
> > };
> >
> > usage:
> >
> > void MyRoutine() {
> > Profiler<> p;
> > // do stuff
> > }
>

[Jonathan Turkanis]:
> How about:
>
> typedef profiled< MyClass, Interface, Profiler<> > >
MyProfiledClass;
>
> ?

[Brian Braatz]
That is a good idea (use a AOP style weave).

It begs asking here- when we talk about profiling, what are the use
cases you guys see.

I have some stuff to implement profiling on in the coming weeks. My
situations are as follows:

* Profile and log the profiling results of my unit tests between the
checkpoints
-> Either explicitly or I may redefine BOOST_CHECKPOINT

* Profile an application for when makes certain method calls on some COM
objects- Also log this information.
-> Problem is, folks have coded directly to the COM objects proxy
class. Because of this, the AOP style typedef trick will not work unless
I push the proxy classes into a namespace- and redefine them in the
global namespace with a weave in place. (structurally this might be more
work than I want to deal with)

* profiling specific operations which cross cut many areas of the system
and only doing that when certain dynamic conditions exist

I am asking you guys for how you need to use profiling because by
talking aobut the problem that is to be solved, it might make the
discussion of what the solution is easier to address.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk