39 for (
int i = 0; i < Component::Size; i++)
54 #ifdef Statistic_Activated 55 shared_ptr<Statistic::JobMeasurement> jm = boost::make_shared<JobMeasurement>(stylesheet, zoom);
56 jm->jobStartTime = boost::posix_time::microsec_clock::universal_time();
59 return boost::make_shared<JobMeasurement>();
64 unsigned int relations)
66 #ifdef Statistic_Activated 69 job->relations = relations;
74 #ifdef Statistic_Activated 75 job->startTime[component] = boost::posix_time::microsec_clock::universal_time();
81 #ifdef Statistic_Activated 82 job->stopTime[component] = boost::posix_time::microsec_clock::universal_time();
83 job->stopped[component] =
true;
88 #ifdef Statistic_Activated 90 for(
int c = 0; c < Component::Size; c++) {
92 for(
int z = 0; z < 19; z++) {
97 ss << n <<
" Measurements on Zoom: " << z <<
", average: ";
99 ss << avg/1000.0 <<
" ms\n";
101 ss << avg <<
" µs\n";
106 LOG_SEV(stat_log, info) << ss.str();
112 #ifdef Statistic_Activated 115 for(
int c = 0; c < Component::Size; c++) {
116 if (!job->stopped[c])
121 n = m.
count[job->zoom];
122 m.
average[job->zoom] *= n/(float)(n + 1.0f);
123 m.
average[job->zoom] += job->getDuration(c).total_microseconds() / (float)(n + 1.0f);
124 m.
count[job->zoom]++;
145 file.open(filename, std::fstream::app);
148 std::stringstream ss;
149 ss <<
"JobStart " << job->jobStartTime.time_of_day().total_microseconds() <<
" ";
150 for(
int i = 0; i < Component::Size; i++) {
154 ss <<
"Stylesheet " << job->stylesheet <<
" Zoom " << job->zoom <<
" Nodes " << job->nodes <<
" Ways " << job->ways <<
" Relations " << job->relations <<
"\n";
165 case Cache:
return "Cache";
168 case GeoWays:
return "GeoWays";
173 case Slicing:
return "Slicing";
shared_ptr< Configuration > config
string componentToName(Component component) const
void stop(shared_ptr< Statistic::JobMeasurement > &job, Component component) const
shared_ptr< JobMeasurement > startNewMeasurement(const string &stylesheet, int zoom)
void setStats(shared_ptr< Statistic::JobMeasurement > &job, unsigned int nodes, unsigned int ways, unsigned int relations)
boost::posix_time::time_duration duration
void start(shared_ptr< Statistic::JobMeasurement > &job, Component component) const
void finished(shared_ptr< Statistic::JobMeasurement > &job)
std::vector< shared_ptr< JobMeasurement > > measurementsBuffer
Statistic(const shared_ptr< Configuration > &config)
ptime stopTime[Component::Size]
ptime startTime[Component::Size]
AvgMeasurement componentAvgs[Component::Size]
static shared_ptr< Statistic > instance
This file is part of alaCarte.
#define LOG_SEV(log, lvl)
static const char * performance_log
Filepath to the performance log (type: string)
void writeToFile(const char *filename)
duration getDuration(int i)
void printStatistic() const