Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1540977

Re: [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle hist

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle hist
Date 2016-12-13 11:40 +0100
Message-ID <sNSF4-8vJ-7@gated-at.bofh.it> (permalink)
References <sNQjT-7cA-3@gated-at.bofh.it> <sNQjU-7cA-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Tue, Dec 13, 2016 at 05:06:32PM +0900, Namhyung Kim escreveu:
> When --idle-hist option is used, run/wait time and sched delay value
> should be shown for idle task only.  But due to internal accounting, a
> last thread has same value of next idle task's and it was shown.
> 
> In the below example, firefox after idle task has same run time of
> idle task's.

Same as last message, is this something I can fold into a patch yet in
my perf/core branch?

- Arnaldo
 
>   $ perf sched timehist --idle-hist
>   Samples do not have callchains.
>              time    cpu  task name             wait time  sch delay   run time
>                           [tid/pid]                (msec)     (msec)     (msec)
>   --------------- ------  --------------------  ---------  ---------  ---------
>     197731.754335 [0002]  firefox[17773/17739]      0.000      0.000      0.000
>     197731.754486 [0001]  sleep[27470]              0.000      0.000      0.000
>     197731.754903 [0002]  <idle>                    0.047      0.000      0.567
>     197731.754981 [0002]  firefox[17773/17739]      0.000      0.000      0.567
>     197731.755922 [0002]  <idle>                    0.078      0.000      0.941
>     197731.755994 [0002]  firefox[17773/17739]      0.000      0.000      0.941
>   <SNIP>
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/builtin-sched.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 405a91d0515f..64a0959bccd7 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -2439,6 +2439,15 @@ static int timehist_sched_change_event(struct perf_tool *tool,
>  				goto out;
>  
>  			timehist_update_runtime_stats(last_tr, t, tprev);
> +			/*
> +			 * remove delta time of last thread as it's not updated
> +			 * and otherwise it will show an invalid value next
> +			 * time.  we only care total run time and run stat.
> +			 */
> +			last_tr->dt_run = 0;
> +			last_tr->dt_wait = 0;
> +			last_tr->dt_delay = 0;
> +
>  			if (itr->cursor.nr)
>  				callchain_append(&itr->callchain, &itr->cursor,
>  						 t - tprev);
> -- 
> 2.10.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf sched timehist: Fix --idle-hist when no callchains Namhyung Kim <namhyung@kernel.org> - 2016-12-13 09:10 +0100
  [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle hist Namhyung Kim <namhyung@kernel.org> - 2016-12-13 09:10 +0100
    Re: [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle  hist Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-13 11:40 +0100
      Re: [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle  hist Namhyung Kim <namhyung@kernel.org> - 2016-12-13 12:00 +0100
        Re: [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle  hist Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-13 14:20 +0100
    [tip:perf/urgent] perf sched timehist: Add -I/--idle-hist option tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-20 20:30 +0100
  Re: [PATCH 1/2] perf sched timehist: Fix --idle-hist when no  callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-13 11:40 +0100
    Re: [PATCH 1/2] perf sched timehist: Fix --idle-hist when no  callchains Namhyung Kim <namhyung@kernel.org> - 2016-12-13 12:00 +0100
      Re: [PATCH 1/2] perf sched timehist: Fix --idle-hist when no  callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-13 13:10 +0100
      Re: [PATCH 1/2] perf sched timehist: Fix --idle-hist when no  callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-13 14:10 +0100
  [tip:perf/urgent] perf sched timehist: Save callchain when entering  idle tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-20 20:30 +0100

csiph-web