[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YWBZqlg3hgsIWq+q@kernel.org>
Date: Fri, 8 Oct 2021 11:46:02 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Riccardo Mancini <rickyman7@...il.com>
Cc: Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: Re: [RFC PATCH v1 36/37] perf test/evlist-open-close: use inline
func to convert timeval to usec
Em Sat, Aug 21, 2021 at 11:19:42AM +0200, Riccardo Mancini escreveu:
> This patch introduces a new inline function to convert a timeval to
> usec.
> This function will be used also in the next patch.
Thanks, applied.
- Arnaldo
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
> tools/perf/bench/evlist-open-close.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/bench/evlist-open-close.c b/tools/perf/bench/evlist-open-close.c
> index c18aa85725281795..00d0aef564f80d44 100644
> --- a/tools/perf/bench/evlist-open-close.c
> +++ b/tools/perf/bench/evlist-open-close.c
> @@ -26,6 +26,11 @@ static int iterations = 100;
> static int nr_events = 1;
> static const char *event_string = "dummy";
>
> +static inline u64 timeval2usec(struct timeval *tv)
> +{
> + return tv->tv_sec * USEC_PER_SEC + tv->tv_usec;
> +}
> +
> static struct record_opts opts = {
> .sample_time = true,
> .mmap_pages = UINT_MAX,
> @@ -197,7 +202,7 @@ static int bench_evlist_open_close__run(char *evstr)
>
> gettimeofday(&end, NULL);
> timersub(&end, &start, &diff);
> - runtime_us = diff.tv_sec * USEC_PER_SEC + diff.tv_usec;
> + runtime_us = timeval2usec(&diff);
> update_stats(&time_stats, runtime_us);
>
> evlist__delete(evlist);
> --
> 2.31.1
--
- Arnaldo
Powered by blists - more mailing lists