$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
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?
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