static struct timeval shortest = { 1000000, 0 };
-/* On entry, tv is syscall exit timestamp */
void
-count_syscall(struct tcb *tcp, struct timeval *tv)
+count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
{
+ struct timeval wtv;
+ struct timeval *tv = &wtv;
struct call_counts *cc;
unsigned long scno = tcp->scno;
cc->errors++;
/* tv = wall clock time spent while in syscall */
- tv_sub(tv, tv, &tcp->etime);
+ tv_sub(tv, syscall_exiting_tv, &tcp->etime);
/* Spent more wall clock time than spent system time? (usually yes) */
if (tv_cmp(tv, &tcp->dtime) > 0) {
if (tv_nz(&tcp->dtime))
/* tv = system time spent, if it isn't 0 */
- *tv = tcp->dtime;
+ tv = &tcp->dtime;
else if (tv_cmp(tv, &one_tick) > 0) {
/* tv = smallest "sane" time interval */
if (tv_cmp(&shortest, &one_tick) < 0)
- *tv = shortest;
+ tv = &shortest;
else
- *tv = one_tick;
+ tv = &one_tick;
}
}
if (tv_cmp(tv, &shortest) < 0)
extern void qualify(const char *);
extern void print_pc(struct tcb *);
extern int trace_syscall(struct tcb *);
-extern void count_syscall(struct tcb *, struct timeval *);
+extern void count_syscall(struct tcb *, const struct timeval *);
extern void call_summary(FILE *);
#if defined(AVR32) \
}
if (cflag) {
- struct timeval t = tv;
- count_syscall(tcp, &t);
+ count_syscall(tcp, &tv);
if (cflag == CFLAG_ONLY_STATS) {
goto ret;
}