Boost logo

Boost :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-02-04 10:07:59

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?


  struct ProfilerDefaultPolicy {
    OnElapsed(int msec) {
      cout << "time elapsed (msec): " << msec << endl;

  template<typename Policy_T = ProfilerDefaultPolicy>
  class Profiler {
      Profiler() { mnStart = GetTickCount(); };
      ~Profiler() { Policy_T::OnElapsed(GetMSecElapsed()); };
      int GetMSecElapsed() { return GetTickCount() - mnStart; };
      int GetTickCount() { return int(double(clock()) * 1000 /
      int mnStart;


  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)

Boost list run by bdawes at, gregod at, cpdaniel at, john at