• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List

tjprofiler.h

00001 /***************************************************************************
00002                           tjprofiler.h  -  description
00003                              -------------------
00004     begin                : Mon Aug 5 2002
00005     copyright            : (C) 2001 by Thies H. Jochimsen
00006     email                : jochimse@cns.mpg.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef TJPROFILER_H
00019 #define TJPROFILER_H
00020 
00021 
00022 #include <tjutils/tjutils.h>
00023 #include <tjutils/tjstatic.h>
00024 #include <tjutils/tjlabel.h>
00025 #include <tjutils/tjhandler.h>
00026 
00041 class Profiler : public StaticHandler<Profiler> {
00042 
00043  public:
00044 
00045   Profiler(const STD_string& func_name);
00046   ~Profiler();
00047 
00051   static void reset();
00052 
00056   static void dump_final_result();
00057 
00061   static STD_string get_memory_usage();
00062 
00063 
00064   // functions to initialize/delete static members by the StaticHandler template class
00065   static void init_static();
00066   static void destroy_static();
00067 
00068 
00069   // for debugging List
00070   static const char* get_compName();
00071 
00072 
00073  private:
00074 
00075   STD_string func_label;
00076   double starttime;
00077 
00078   struct elapsed {
00079     elapsed() : time_spent(0.0) {}
00080     double time_spent;
00081   };
00082 
00083   struct FuncMap : public STD_map<STD_string, elapsed>, public Labeled {};
00084 
00085   static SingletonHandler<FuncMap, true> func_map;
00086 };
00087 
00090 #endif

Generated on Tue Dec 18 2012 15:11:15 by  doxygen 1.7.1