rendered paste bodystruct lapse
{
time_t curtime;
time_t last;
int hello;
short init;
char funcName[100];
} lapse[200];
void timeCount(char *funcName)
{
struct timeval tv;
gettimeofday(&tv, NULL);
long tms;
int i = 0;
int func = -1;
tms = tv.tv_sec * 1000 + tv.tv_usec / 1000;
while(lapse[i].last) {
if(!strcmp(funcName, lapse[i].funcName)) {
func = i;
break;
}
i++;
}
if(func == -1)
func = i;
if(!lapse[func].last) {
strcpy(lapse[func].funcName, funcName);
lapse[func].hello = 0;
}
if(!lapse[func].init) {
lapse[func].last = tms;
lapse[func].init = 1;
lapse[func].hello += 1;
}
else {
lapse[func].curtime = (tms-lapse[func].last)+lapse[func].curtime;
lapse[func].init = 0;
}
}