[systemd-devel] [PATCH v2] bootchart: use NSEC_PER_SEC

Lennart Poettering lennart at poettering.net
Tue Aug 19 15:22:03 PDT 2014


On Tue, 19.08.14 23:31, Thomas H.P. Andersen (phomes at gmail.com) wrote:

> 
> Maybe these are candidates for this as well?
> 
> src/bootchart/bootchart.c:355:        interval = (1.0 / arg_hz) * 1000000000.0;
> src/bootchart/bootchart.c:413:                elapsed = (sample_stop -
> sampledata->sampletime) * 1000000000.0;
> src/bootchart/bootchart.c:416:                newint_s =
> (time_t)(timeleft / 1000000000.0);
> src/bootchart/bootchart.c:417:                newint_ns =
> (long)(timeleft - (newint_s * 1000000000.0));
> src/bootchart/svg.c:634:                            max / 1024.0 /
> (interval / 1000000000.0));
> src/bootchart/svg.c:743:                            max / 1024.0 /
> (interval / 1000000000.0));
> src/bootchart/svg.c:770:                trt = trt / 1000000000.0;
> src/bootchart/svg.c:812:                twt = twt / 1000000000.0;
> src/bootchart/svg.c:1064:                        prt = (rt /
> 1000000000) / (ps->sample->sampledata->sampletime -
> prev->sampledata->sampletime);
> src/bootchart/svg.c:1065:                        wrt = (wt /
> 1000000000) / (ps->sample->sampledata->sampletime -
> prev->sampledata->sampletime);
> src/bootchart/svg.c:1104:                    (ps->last->runtime -
> ps->first->runtime) / 1000000000.0,
> src/bootchart/store.c:413:                            / 1000000000.0;
> src/cgtop/cgtop.c:179:                        x = ((uint64_t)
> ts.tv_sec * 1000000000ULL + (uint64_t) ts.tv_nsec) -
> src/cgtop/cgtop.c:180:                                ((uint64_t)
> g->cpu_timestamp.tv_sec * 1000000000ULL + (uint64_t)
> g->cpu_timestamp.tv_nsec);
> src/cgtop/cgtop.c:264:                        x = ((uint64_t)
> ts.tv_sec * 1000000000ULL + (uint64_t) ts.tv_nsec) -
> src/cgtop/cgtop.c:265:                                ((uint64_t)
> g->io_timestamp.tv_sec * 1000000000ULL + (uint64_t)
> g->io_timestamp.tv_nsec);
> src/cgtop/cgtop.c:271:                                g->io_input_bps
> = (yr * 1000000000ULL) / x;
> src/cgtop/cgtop.c:272:                                g->io_output_bps
> = (yw * 1000000000ULL) / x;

The cgtop/bps ones are weird. But the other ones definitely.

Actually, I wished bootchart wouldn#t use floats for its timekeeping,
but just usec_t like everything else.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list