* count.c (zero_ts): New variable.
(count_syscall): Calculate the spent time in the wts variable, then add
it to cc->time.
(call_summary_pers): Do not perform overhead correction.
static struct call_counts *countv[SUPPORTED_PERSONALITIES];
#define counts (countv[current_personality])
static struct call_counts *countv[SUPPORTED_PERSONALITIES];
#define counts (countv[current_personality])
+static const struct timespec zero_ts;
+
static struct timespec overhead;
void
static struct timespec overhead;
void
if (syserror(tcp))
cc->errors++;
if (syserror(tcp))
cc->errors++;
if (count_wallclock) {
/* wall clock time spent while in syscall */
if (count_wallclock) {
/* wall clock time spent while in syscall */
ts_sub(&wts, syscall_exiting_ts, &tcp->etime);
ts_sub(&wts, syscall_exiting_ts, &tcp->etime);
-
- ts_add(&cc->time, &cc->time, &wts);
+ ts_sub(&wts, &wts, &overhead);
} else {
/* system CPU time spent while in syscall */
} else {
/* system CPU time spent while in syscall */
- ts_add(&cc->time, &cc->time, &tcp->dtime);
+ ts_sub(&wts, &tcp->dtime, &overhead);
+
+ ts_add(&cc->time, &cc->time, ts_max(&wts, &zero_ts));
sorted_count[i] = i;
if (counts == NULL || counts[i].calls == 0)
continue;
sorted_count[i] = i;
if (counts == NULL || counts[i].calls == 0)
continue;
- ts_mul(&dtv, &overhead, counts[i].calls);
- ts_sub(&counts[i].time, &counts[i].time, &dtv);
- if (counts[i].time.tv_sec < 0 || counts[i].time.tv_nsec < 0)
- counts[i].time.tv_sec = counts[i].time.tv_nsec = 0;
call_cum += counts[i].calls;
error_cum += counts[i].errors;
ts_add(&tv_cum, &tv_cum, &counts[i].time);
call_cum += counts[i].calls;
error_cum += counts[i].errors;
ts_add(&tv_cum, &tv_cum, &counts[i].time);