From 7c3b4fd64283b1c52b2084751052c5cf2927b18b Mon Sep 17 00:00:00 2001 From: zolliker Date: Fri, 23 Feb 2007 12:14:29 +0000 Subject: [PATCH] - enhanced statistics command --- statistics.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/statistics.c b/statistics.c index 711f00d6..cfbfefb9 100644 --- a/statistics.c +++ b/statistics.c @@ -47,14 +47,15 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData, int argc, char *argv[]) { Statistics *p; tv_t now; - double dif, percent, full, dt; + double dif, percent, full, dt, calls; gettimeofday(&now, 0); 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, "----------------------------------------------"); for (p = list; p != NULL; p = p->next) { if (dif > 0) { + calls = p->cnt / dif; percent = timeFloat(p->tim) * 100 / dif; full = timeFloat(p->total) * 100 / dif; if (full > 0 || percent > 0) { @@ -63,7 +64,7 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData, } else { 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); } } @@ -73,6 +74,8 @@ int StatisticsCommand(SConnection *con, SicsInterp *pSics, void *pData, p->total.tv_sec = 0; p->total.tv_usec = 0; } + SCPrintf(con, eStatus, "----------------------------------------------"); + SCPrintf(con, eStatus, "total time %.2f", dif); lastStat = now; return 1; }