Revert r247300 for now. I'll post a new changeset for review.

This commit is contained in:
Xin LI 2013-02-26 19:46:59 +00:00
parent c928b49e63
commit d9dcc46365
4 changed files with 15 additions and 12 deletions

View File

@ -156,6 +156,9 @@ timeval2bintime(const struct timeval *tv, struct bintime *bt)
/* 18446744073709 = int(2^64 / 1000000) */
bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
}
#endif /* __BSD_VISIBLE */
#ifdef _KERNEL
/* Operations on timespecs */
#define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
@ -194,7 +197,7 @@ timeval2bintime(const struct timeval *tv, struct bintime *bt)
/* timevaladd and timevalsub are not inlined */
#endif /* __BSD_VISIBLE */
#endif /* _KERNEL */
#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */

View File

@ -323,14 +323,14 @@ main(int ac, char **av)
fprintf(trussinfo->outfile, "%5d: ",
trussinfo->pid);
if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->start_time, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec,
timediff.tv_nsec);
}
if (trussinfo->flags & RELATIVETIMESTAMPS) {
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->curthread->before, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec,
@ -349,14 +349,14 @@ main(int ac, char **av)
fprintf(trussinfo->outfile, "%5d: ",
trussinfo->pid);
if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->start_time, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec,
timediff.tv_nsec);
}
if (trussinfo->flags & RELATIVETIMESTAMPS) {
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->curthread->before, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec, timediff.tv_nsec);

View File

@ -1126,14 +1126,14 @@ print_syscall(struct trussinfo *trussinfo, const char *name, int nargs,
}
if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->start_time, &timediff);
len += fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec, timediff.tv_nsec);
}
if (trussinfo->flags & RELATIVETIMESTAMPS) {
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->curthread->before, &timediff);
len += fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec, timediff.tv_nsec);
@ -1165,9 +1165,9 @@ print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs,
if (!sc)
return;
clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after);
timespecsubt_to(&trussinfo->curthread->after,
timespecsubt(&trussinfo->curthread->after,
&trussinfo->curthread->before, &timediff);
timespecadd_to(&sc->time, &timediff, &sc->time);
timespecadd(&sc->time, &timediff, &sc->time);
sc->ncalls++;
if (errorp)
sc->nerror++;
@ -1205,7 +1205,7 @@ print_summary(struct trussinfo *trussinfo)
fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n",
sc->name, (intmax_t)sc->time.tv_sec,
sc->time.tv_nsec, sc->ncalls, sc->nerror);
timespecadd_to(&total, &sc->time, &total);
timespecadd(&total, &sc->time, &total);
ncall += sc->ncalls;
nerror += sc->nerror;
}

View File

@ -62,7 +62,7 @@ struct trussinfo
SLIST_HEAD(, threadinfo) threadlist;
};
#define timespecsubt_to(tvp, uvp, vvp) \
#define timespecsubt(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec; \
@ -72,7 +72,7 @@ struct trussinfo
} \
} while (0)
#define timespecadd_to(tvp, uvp, vvp) \
#define timespecadd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec; \