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

Thomas H.P. Andersen phomes at gmail.com
Tue Aug 19 14:31:49 PDT 2014


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;


On Mon, Aug 18, 2014 at 8:59 PM, Ronny Chevalier
<chevalier.ronny at gmail.com> wrote:
> ---
>  src/bootchart/store.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/bootchart/store.c b/src/bootchart/store.c
> index cedcba8..2d2ea42 100644
> --- a/src/bootchart/store.c
> +++ b/src/bootchart/store.c
> @@ -34,6 +34,7 @@
>  #include <time.h>
>
>  #include "util.h"
> +#include "time-util.h"
>  #include "strxcpyx.h"
>  #include "store.h"
>  #include "bootchart.h"
> @@ -54,14 +55,14 @@ double gettime_ns(void) {
>
>          clock_gettime(CLOCK_MONOTONIC, &n);
>
> -        return (n.tv_sec + (n.tv_nsec / 1000000000.0));
> +        return (n.tv_sec + (n.tv_nsec / (double) NSEC_PER_SEC));
>  }
>
>  static double gettime_up(void) {
>          struct timespec n;
>
>          clock_gettime(CLOCK_BOOTTIME, &n);
> -        return (n.tv_sec + (n.tv_nsec / 1000000000.0));
> +        return (n.tv_sec + (n.tv_nsec / (double) NSEC_PER_SEC));
>  }
>
>  void log_uptime(void) {
> --
> 2.0.4
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list