Skip to contentSkip to conversation

trace-cmd report: Fix hash.key in option -w

PATCH In review Ziqian SUN (Zamir) 2 participants 2 messages Aug 25, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd report: Fix hash.key in option -w

From: "Ziqian SUN (Zamir)" <[email protected]>

In add_wakeup function the hash list is created with hash.key = value. This makes add_sched function will never find a match with the key which results in trace-cmd report will never show the average latency with the following command:
trace-cmd report -w -F 'sched_switch,sched_wakeup'
With this patch, the command will show average latency as it used to be in v2.4.2 like

Average wakeup latency: 28.460 usecs
Maximum Latency: 669.268 usecs at timestamp: 16337.629767 Minimum Latency: 2.153 usecs at timestamp: 16337.533735

RT task timings:

Average wakeup latency: 23.106 usecs
Maximum Latency: 57.482 usecs at timestamp: 16337.187531 Minimum Latency: 4.127 usecs at timestamp: 16336.945209

---
 trace-read.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
trace-read.c +1 -1
index ebb2368..350a843 100644
@@ -610,7 +610,7 @@ static void add_wakeup(unsigned int val, unsigned long long start)
 	info = malloc(sizeof(*info));
 	if (!info)
 		die("Failed to allocate wakeup info");
-	info->hash.key = val;
+	info->hash.key = key;
 	info->start = start;
 	trace_hash_add(&wakeup_hash, &info->hash);
 }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · On Fri, 25 Aug 2017 13:47:49 +0800 "Ziqian SUN (Zamir)" <[email protected]> wrote:

From: "Ziqian SUN (Zamir)" <[email protected]>

In add_wakeup function the hash list is created with hash.key = value. This makes add_sched function will never find a match with the key which results in trace-cmd report will never show the average latency with the following command:
trace-cmd report -w -F 'sched_switch,sched_wakeup'
With this patch, the command will show average latency as it used to be in v2.4.2 like

Average wakeup latency: 28.460 usecs
Maximum Latency: 669.268 usecs at timestamp: 16337.629767 Minimum Latency: 2.153 usecs at timestamp: 16337.533735

Quoted 8 lines

RT task timings:

Average wakeup latency: 23.106 usecs
Maximum Latency: 57.482 usecs at timestamp: 16337.187531 Minimum Latency: 4.127 usecs at timestamp: 16336.945209

Thanks a lot Ziqian! Added. Will push out soon.

I need to update the stables too.

-- Steve