lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161213080632.19099-2-namhyung@kernel.org>
Date:   Tue, 13 Dec 2016 17:06:32 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Olsa <jolsa@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        David Ahern <dsahern@...il.com>,
        Andi Kleen <andi@...stfloor.org>,
        Minchan Kim <minchan@...nel.org>
Subject: [PATCH 2/2] perf sched timehist: Fix invalid runtime in the idle hist

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.

  $ 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@...nel.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ