[COMMON] sched: ehmp: Add trace log of lbt_overutilized
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Tue, 13 Mar 2018 10:13:41 +0000 (19:13 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:33:00 +0000 (17:33 +0900)
Change-Id: I6b6e1ef69679de27b14eee7c8629e760a1fe8c98
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
include/trace/events/ehmp.h
kernel/sched/ehmp.c

index cd99ba3e93e37b3ab0586f4b1aa7372d2af6b35d..9667bd8f4042b9bfe31fec3f686ee2f3ffdedaa4 100644 (file)
@@ -334,6 +334,33 @@ TRACE_EVENT(ehmp_ontime_check_migrate,
                __entry->migrate, __entry->label)
 );
 
+TRACE_EVENT(ehmp_lbt_overutilized,
+
+       TP_PROTO(int cpu, int level, unsigned long util, unsigned long capacity, bool overutilized),
+
+       TP_ARGS(cpu, level, util, capacity, overutilized),
+
+       TP_STRUCT__entry(
+               __field( int,           cpu                     )
+               __field( int,           level                   )
+               __field( unsigned long, util                    )
+               __field( unsigned long, capacity                )
+               __field( bool,          overutilized            )
+       ),
+
+       TP_fast_assign(
+               __entry->cpu                    = cpu;
+               __entry->level                  = level;
+               __entry->util                   = util;
+               __entry->capacity               = capacity;
+               __entry->overutilized           = overutilized;
+       ),
+
+       TP_printk("cpu=%d level=%d util=%lu capacity=%lu overutilized=%d",
+               __entry->cpu, __entry->level, __entry->util,
+               __entry->capacity, __entry->overutilized)
+);
+
 #endif /* _TRACE_EHMP_H */
 
 /* This part must be outside protection */
index b6299942e6df3099a42e3aa8e4d559d7ca3599ef..0dffdb63a085ad123f0ce33a475b348b31506508 100644 (file)
@@ -339,11 +339,18 @@ static inline int get_last_level(struct lbt_overutil *ou)
 bool lbt_overutilized(int cpu, int level)
 {
        struct lbt_overutil *ou = per_cpu(lbt_overutil, cpu);
+       bool overutilized;
 
        if (!ou)
                return false;
 
-       return cpu_util(cpu) > ou[level].capacity;
+       overutilized = (cpu_util(cpu) > ou[level].capacity) ? true : false;
+
+       if (overutilized)
+               trace_ehmp_lbt_overutilized(cpu, level, cpu_util(cpu),
+                               ou[level].capacity, overutilized);
+
+       return overutilized;
 }
 
 void update_lbt_overutil(int cpu, unsigned long capacity)