added printing info how much time winix spent in the ezc engine

added to Request:
timespec timespec_req_stop;
timespec timespec_req_diff;
timespec timespec_ezc_engine_start;
timespec timespec_ezc_engine_stop;
This commit is contained in:
2021-06-24 15:33:44 +02:00
parent 443c2023d9
commit 2f1cdcf379
9 changed files with 208 additions and 37 deletions

View File

@@ -56,7 +56,8 @@ LoadAvg::LoadAvg()
cache_req_per_sec5 = 0.0;
cache_req_per_sec15 = 0.0;
was_stop_request = false;
timespec_old_req_stop.tv_sec = 0;
timespec_old_req_stop.tv_nsec = 0;
CreateTable();
}
@@ -76,7 +77,8 @@ LoadAvg & LoadAvg::operator=(const LoadAvg & l)
cache_req_per_sec5 = l.cache_req_per_sec5;
cache_req_per_sec15 = l.cache_req_per_sec15;
was_stop_request = l.was_stop_request;
timespec_old_req_stop.tv_sec = l.timespec_old_req_stop.tv_sec;
timespec_old_req_stop.tv_nsec = l.timespec_old_req_stop.tv_nsec;
CreateTable();
@@ -182,14 +184,14 @@ void LoadAvg::CheckTimers()
void LoadAvg::StartRequest()
void LoadAvg::StartRequest(Request * req)
{
clock_gettime(CLOCK_REALTIME, &start_req);
if( was_stop_request )
if( timespec_old_req_stop.tv_sec != 0 )
{
double dp = (start_req.tv_sec - stop_req.tv_sec);
dp += double(start_req.tv_nsec - stop_req.tv_nsec) / 1000000000.0; // make sure that tv_nsec has signed type
// we got at least one request in the past
timespec diff;
calculate_timespec_diff(timespec_old_req_stop, req->timespec_req_start, diff);
double dp = timespec_to_double(diff);
current1.dp += dp;
current5.dp += dp;
@@ -203,14 +205,9 @@ void LoadAvg::StartRequest()
void LoadAvg::StopRequest()
void LoadAvg::StopRequest(Request * req)
{
char buf[50];
clock_gettime(CLOCK_REALTIME, &stop_req);
double dr = (stop_req.tv_sec - start_req.tv_sec);
dr += double(stop_req.tv_nsec - start_req.tv_nsec) / 1000000000.0; // make sure that tv_nsec has signed type
double dr = timespec_to_double(req->timespec_req_diff);
current1.dr += dr;
current5.dr += dr;
@@ -220,11 +217,7 @@ char buf[50];
current5.req += 1;
current15.req += 1;
sprintf(buf, "%f", dr);
SetNonZeroDigitsAfterComma(buf, 2);
log << log2 << "LA: request took: " << buf << "s" << logend;
was_stop_request = true;
timespec_old_req_stop = req->timespec_req_stop;
}