code_profiler
ProfileLog.cpp
Go to the documentation of this file.
1 #include "profiling/Profiler.h"
2 #ifdef PROFILEAPP
3 #include "profiling/ProfileLog.h"
4 #include <iomanip>
5 #include <boost/filesystem.hpp>
6 #include <boost/filesystem/config.hpp>
7 #include <boost/filesystem/path.hpp>
8 
9 using namespace std;
10 
11 void ProfileLog::PrintLog(std::ostream &stream, std::vector< std::map< std::string, Statistics >* >& stats, double totalTime)
12 {
13  int threadNum = 0;
14  for(vector< map<string, Statistics>* >::iterator it = stats.begin(); it != stats.end(); ++it)
15  {
16  stream << fixed;
17  stream << left;
18  stream << "Thread info for thread " << ++threadNum << ":" << std::endl;
19 
20  stream << setw(15) << "Name:" << setw(20) << "Total Time:" << setw(30) << "Average time" << setw(30) << "Relative Time:" << setw(15) << "Called #:" << endl;
21  stream << setfill('-') << setw(100) << "" << endl;
22  stream << setfill(' ');
23 
24  for(map<string, Statistics>::iterator it2 = (*it)->begin(); it2 != (*it)->end(); ++it2)
25  {
26  Statistics stats = it2->second;
27  if(!stats.running)
28  stream << setw(15) << it2->first << setw(20) << stats.msec << setw(30) << (stats.msec / stats.callAmount) << setw(30) << stats.msec/totalTime << setw(30) << stats.callAmount << endl;
29  else
30  stream << setw(15) << it2->first << "ERROR(" << it2->first << ") was never stopped!" << endl;
31  }
32  cout << endl;
33  }
34 
35 }
36 
37 
38 void ProfileLog::PrintLog(std::vector< std::map< std::string, Statistics >* >& stats, double totalTime)
39 {
40  ProfileLog::PrintLog(std::cout, stats, totalTime);
41 
42 }
43 
44 #endif
std::vector
std::iterator
ProfileLog.h
std::setfill
T setfill(T... args)
std::cout
std::ostream
std::map
std::endl
T endl(T... args)
Profiler.h
std::left
T left(T... args)
iomanip
std::map::begin
T begin(T... args)
std
std::fixed
T fixed(T... args)
std::setw
T setw(T... args)