- enhanced statistics command
This commit is contained in:
@ -47,14 +47,15 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData,
|
|||||||
int argc, char *argv[]) {
|
int argc, char *argv[]) {
|
||||||
Statistics *p;
|
Statistics *p;
|
||||||
tv_t now;
|
tv_t now;
|
||||||
double dif, percent, full, dt;
|
double dif, percent, full, dt, calls;
|
||||||
|
|
||||||
gettimeofday(&now, 0);
|
gettimeofday(&now, 0);
|
||||||
dif = timeFloat(timeDif(lastStat, now));
|
dif = timeFloat(timeDif(lastStat, now));
|
||||||
SCPrintf(con, eStatus, " calls time[%] full[%] mean[ms] command");
|
SCPrintf(con, eStatus, "calls/s time[%] full[%] mean[ms] command");
|
||||||
SCPrintf(con, eStatus, "----------------------------------------------");
|
SCPrintf(con, eStatus, "----------------------------------------------");
|
||||||
for (p = list; p != NULL; p = p->next) {
|
for (p = list; p != NULL; p = p->next) {
|
||||||
if (dif > 0) {
|
if (dif > 0) {
|
||||||
|
calls = p->cnt / dif;
|
||||||
percent = timeFloat(p->tim) * 100 / dif;
|
percent = timeFloat(p->tim) * 100 / dif;
|
||||||
full = timeFloat(p->total) * 100 / dif;
|
full = timeFloat(p->total) * 100 / dif;
|
||||||
if (full > 0 || percent > 0) {
|
if (full > 0 || percent > 0) {
|
||||||
@ -63,7 +64,7 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData,
|
|||||||
} else {
|
} else {
|
||||||
dt = 0;
|
dt = 0;
|
||||||
}
|
}
|
||||||
SCPrintf(con, eStatus, "%7ld %7.1f %7.1f %8.2f %s", p->cnt,
|
SCPrintf(con, eStatus, "%7.1f %7.1f %7.1f %8.2f %s", calls,
|
||||||
percent, full, dt, p->name);
|
percent, full, dt, p->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,6 +74,8 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData,
|
|||||||
p->total.tv_sec = 0;
|
p->total.tv_sec = 0;
|
||||||
p->total.tv_usec = 0;
|
p->total.tv_usec = 0;
|
||||||
}
|
}
|
||||||
|
SCPrintf(con, eStatus, "----------------------------------------------");
|
||||||
|
SCPrintf(con, eStatus, "total time %.2f", dif);
|
||||||
lastStat = now;
|
lastStat = now;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user