diff options
| author | Kenneth D. Merry <ken@FreeBSD.org> | 2013-04-11 21:18:04 +0000 |
|---|---|---|
| committer | Kenneth D. Merry <ken@FreeBSD.org> | 2013-04-11 21:18:04 +0000 |
| commit | 5e796316388dca78279741f1e4d3a3488d08c3d9 (patch) | |
| tree | 585693d76c32fc39b397195b5dfbd134f9404ad6 /usr.bin/ctlstat | |
| parent | e7fdf38bbbf109bbc72897547f3bf41bc53b0436 (diff) | |
Notes
Diffstat (limited to 'usr.bin/ctlstat')
| -rw-r--r-- | usr.bin/ctlstat/ctlstat.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/ctlstat/ctlstat.c b/usr.bin/ctlstat/ctlstat.c index ff67bf6ad6a5..e04aa5405bb1 100644 --- a/usr.bin/ctlstat/ctlstat.c +++ b/usr.bin/ctlstat/ctlstat.c @@ -404,7 +404,7 @@ ctlstat_json(struct ctlstat_context *ctx) { static void ctlstat_standard(struct ctlstat_context *ctx) { - long double cur_secs, prev_secs, etime; + long double etime; uint64_t delta_jiffies, delta_idle; uint32_t port; long double cpu_percentage; @@ -416,12 +416,8 @@ ctlstat_standard(struct ctlstat_context *ctx) { if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0)) errx(1, "error returned from getcpu()"); - cur_secs = ctx->cur_time.tv_sec + - ((long double)ctx->cur_time.tv_nsec / 1000000000); - prev_secs = ctx->prev_time.tv_sec + - ((long double)ctx->prev_time.tv_nsec / 1000000000); - - etime = cur_secs - prev_secs; + etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec + + (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9; if (F_CPU(ctx)) { ctx->prev_total_jiffies = ctx->cur_total_jiffies; |
