- do not allow logger to write more than once per period

- fixed bug in statistics.c
This commit is contained in:
zolliker
2010-04-13 14:31:58 +00:00
parent 6c4f57ec6f
commit eebb6b06e9
3 changed files with 47 additions and 13 deletions

View File

@ -58,8 +58,8 @@ int StatisticsCommand(SConnection * con, SicsInterp * pSics, void *pData,
gettimeofday(&now, 0);
dif = timeFloat(timeDif(lastStat, now));
SCPrintf(con, eValue, "calls/s time[%] full[%] mean[ms] command");
SCPrintf(con, eValue, "----------------------------------------------");
SCPrintf(con, eLog, "calls/s time[%] full[%] mean[ms] command");
SCPrintf(con, eLog, "----------------------------------------------");
for (p = list; p != NULL; p = p->next) {
if (dif > 0) {
calls = p->cnt / dif;
@ -71,7 +71,7 @@ int StatisticsCommand(SConnection * con, SicsInterp * pSics, void *pData,
} else {
dt = 0;
}
SCPrintf(con, eValue, "%7.1f %7.1f %7.1f %8.2f %s", calls,
SCPrintf(con, eLog, "%7.1f %7.1f %7.1f %8.2f %s", calls,
percent, full, dt, p->name);
}
}
@ -81,8 +81,8 @@ int StatisticsCommand(SConnection * con, SicsInterp * pSics, void *pData,
p->total.tv_sec = 0;
p->total.tv_usec = 0;
}
SCPrintf(con, eValue, "----------------------------------------------");
SCPrintf(con, eValue, "total time %.2f", dif);
SCPrintf(con, eLog, "----------------------------------------------");
SCPrintf(con, eLog, "total time %.2f", dif);
lastStat = now;
return 1;
}