|
Boost : |
From: Sérgio Vale e Pace (svpace.forum_at_[hidden])
Date: 2005-02-04 13:50:47
if there is interest in it I would like to boostify it, I´m frequently
use something like this and I find it very useful.
On Fri, 04 Feb 2005 10:07:59 -0500, christopher diggins
<cdiggins_at_[hidden]> 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
> }
>
> Pretty trivial (and probably not boost-worthy), but I find it very useful.
> Does anyone want to take this and run with it (i.e. boostify it)?
>
> Christopher Diggins
> Object Oriented Template Library (OOTL)
> http://www.ootl.org
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk