summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKe Wang <ke.wang@spreadtrum.com>2016-12-08 14:02:10 +0800
committerKe Wang <ke.wang@spreadtrum.com>2016-12-08 14:02:10 +0800
commit3a29814dae2302eda661514805d6fba32a8e3ba0 (patch)
tree3b565d98f9dcb3b42bb8ecc5fb3a1e5c1fc8c2aa
parent4272b1a3c3f6a25f3c92f7fcbfcd6167cfbc1ced (diff)
sched: fix wrong truncation of walt_avg
The result of "__entry->walt_avg = (__entry->demand << 10)" will exceed the range of "unsigned int", which will be truncated and make the trace looks like as follows: UnityMain-4588 [004] 6029.645672: walt_update_history: 4588(UnityMain): runtime 9928307 samples 1 event 4 demand 9928307 walt 157 pelt 870 (hist: 9928307 9604307 8440077 87392 34144328) cpu 4 UnityMain-4588 [004] 6029.653658: walt_update_history: 4588(UnityMain): runtime 10000000 samples 1 event 4 demand 10000000 walt 165 pelt 886 (hist: 10000000 9955691 6549308 64000 34144328) cpu 4 Fix this by using a u64 type instead of unsgined int type and make the trace as below: UnityMain-4617 [004] 117.613558: walt_update_history: 4617(UnityMain): runtime 5770597 samples 1 event 4 demand 7038739 walt 720 pelt 680 (hist: 5770597 7680001 8904509 65596 156) cpu 4 UnityMain-4617 [004] 117.633560: walt_update_history: 4617(UnityMain): runtime 9911238 samples 1 event 4 demand 9911238 walt 1014 pelt 769 (hist: 9911238 5770597 7680001 0 1664188058) cpu 4 Signed-off-by: Ke Wang <ke.wang@spreadtrum.com>
-rw-r--r--include/trace/events/sched.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index dffaffab4bc8..c18d8c89bd12 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -1044,7 +1044,7 @@ TRACE_EVENT(walt_update_history,
__field( int, samples )
__field( int, evt )
__field( u64, demand )
- __field(unsigned int, walt_avg )
+ __field( u64, walt_avg )
__field(unsigned int, pelt_avg )
__array( u32, hist, RAVG_HIST_SIZE_MAX)
__field( int, cpu )
@@ -1066,7 +1066,7 @@ TRACE_EVENT(walt_update_history,
),
TP_printk("%d (%s): runtime %u samples %d event %d demand %llu"
- " walt %u pelt %u (hist: %u %u %u %u %u) cpu %d",
+ " walt %llu pelt %u (hist: %u %u %u %u %u) cpu %d",
__entry->pid, __entry->comm,
__entry->runtime, __entry->samples, __entry->evt,
__entry->demand,