- added statistics to logreader
This commit is contained in:
@ -253,6 +253,8 @@ static int LogReader(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
int idir;
|
int idir;
|
||||||
char *colon;
|
char *colon;
|
||||||
|
|
||||||
|
static Statistics *stat;
|
||||||
|
Statistics *old;
|
||||||
|
|
||||||
/* argtolower(argc, argv); */
|
/* argtolower(argc, argv); */
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
@ -363,6 +365,10 @@ static int LogReader(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
loss = 0;
|
loss = 0;
|
||||||
overflow = 0;
|
overflow = 0;
|
||||||
for (i = iarg; i < argc; i++) {
|
for (i = iarg; i < argc; i++) {
|
||||||
|
if (stat ==NULL) {
|
||||||
|
stat = StatisticsNew("loggervar");
|
||||||
|
}
|
||||||
|
old = StatisticsBegin(stat);
|
||||||
startim = from;
|
startim = from;
|
||||||
t = 0;
|
t = 0;
|
||||||
lastt = 0;
|
lastt = 0;
|
||||||
@ -545,6 +551,7 @@ static int LogReader(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
}
|
}
|
||||||
if (c.np < 0)
|
if (c.np < 0)
|
||||||
overflow = 1;
|
overflow = 1;
|
||||||
|
StatisticsEnd(old);
|
||||||
}
|
}
|
||||||
snprintf(line, sizeof line, "*%d %d\n", loss, overflow);
|
snprintf(line, sizeof line, "*%d %d\n", loss, overflow);
|
||||||
SCWrite(pCon, line, eWarning);
|
SCWrite(pCon, line, eWarning);
|
||||||
|
Reference in New Issue
Block a user