Skip to contentSkip to conversation

timer stats: reset entries when disable the timer usage statistics

PATCH Superseded Dong Zhu 1 participant 3 messages Jun 10, 2013 – Jul 17, 2013

lore
Share & tools
lore

Dong Zhu

author
#0 lore raw

PATCH 1/1 timer stats: reset entries when disable the timer usage statistics

Quoted 1 line

From 4dbb760213856dc382241db456c1c6487694837c Mon Sep 17 00:00:00 2001

From: Dong Zhu <[email protected]>
Date: Mon, 10 Jun 2013 15:09:27 +0800

we can start/stop data collection by using :
echo [1|0] > /proc/timer_stats
when we stop the data collection,hrtimer will not update the statistics for a timer any more,but we could still check the timer usage statistics,unfortunately the data is not the latest, the inaccurate data might make us confusing. So the purpose of this patch is to reset the entries once disable operation is executed.In this way we will never see the inaccurate timer usage statistics.

---
 kernel/time/timer_stats.c | 1 +
 1 file changed, 1 insertion(+)
kernel/time/timer_stats.c +1 -0
index 0b537f2..43f05e7 100644
@@ -371,6 +371,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf,
 	switch (ctl[0]) {
 	case '0':
 		if (timer_stats_active) {
+			reset_entries();
 			timer_stats_active = 0;
 			time_stop = ktime_get();
 			sync_access();
Signature · 5 lines
1.7.11.7

-- 
Best Regards,
Dong Zhu
author
#1 lore raw
Quoted 32 lines · Dong Zhu

From 4dbb760213856dc382241db456c1c6487694837c Mon Sep 17 00:00:00 2001
From: Dong Zhu <[email protected]>
Date: Mon, 10 Jun 2013 15:09:27 +0800

we can start/stop data collection by using :
echo [1|0] > /proc/timer_stats
when we stop the data collection,hrtimer will not update the statistics for a timer any more,but we could still check the timer usage statistics,unfortunately the data is not the latest, the inaccurate data might make us confusing. So the purpose of this patch is to reset the entries once disable operation is executed.In this way we will never see the inaccurate timer usage statistics.

---
 kernel/time/timer_stats.c | 1 +
 1 file changed, 1 insertion(+)
kernel/time/timer_stats.c +1 -0
index 0b537f2..43f05e7 100644
@@ -371,6 +371,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf,
 	switch (ctl[0]) {
 	case '0':
 		if (timer_stats_active) {
+			reset_entries();
 			timer_stats_active = 0;
 			time_stop = ktime_get();
 			sync_access();
Signature · 1 line
1.7.11.7

Hi all,

Any comments here ?

Signature · 2 lines
Best Regards,
Dong Zhu
author
#2 lore raw
Quoted 19 lines · Dong Zhu
Quoted 18 lines · Dong Zhu

From 4dbb760213856dc382241db456c1c6487694837c Mon Sep 17 00:00:00 2001
From: Dong Zhu <[email protected]>
Date: Mon, 10 Jun 2013 15:09:27 +0800

we can start/stop data collection by using :
echo [1|0] > /proc/timer_stats
when we stop the data collection,hrtimer will not update the statistics for a timer any more,but we could still check the timer usage statistics,unfortunately the data is not the latest, the inaccurate data might make us confusing. So the purpose of this patch is to reset the entries once disable operation is executed.In this way we will never see the inaccurate timer usage statistics.

---
 kernel/time/timer_stats.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 14 lines
kernel/time/timer_stats.c +1 -0
index 0b537f2..43f05e7 100644
@@ -371,6 +371,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf,
 	switch (ctl[0]) {
 	case '0':
 		if (timer_stats_active) {
+			reset_entries();
 			timer_stats_active = 0;
 			time_stop = ktime_get();
 			sync_access();
Signature · 1 line
1.7.11.7

Hi John and Thomas,

A long time has passed and still no reply here. I think this patch makes sense so could you plz accept it ? Thanks!

BTW, any comments would be appreciated.

Signature · 2 lines
Best Regards,
Dong Zhu