diff mbox

[PMQA] nohz: check cpus are in nohz mode

Message ID 1401886775-32179-1-git-send-email-sanjay.rawat@linaro.org
State New
Headers show

Commit Message

Sanjay Singh Rawat June 4, 2014, 12:59 p.m. UTC
check for the timer interrupt raised on cpu for duration of
3 seconds and report the mode

Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
---
 Makefile         |    2 ++
 nohz/Makefile    |   25 +++++++++++++++++++++
 nohz/nohz_01.sh  |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 nohz/nohz_01.txt |    1 +
 4 files changed, 92 insertions(+)
 create mode 100644 nohz/Makefile
 create mode 100755 nohz/nohz_01.sh
 create mode 100644 nohz/nohz_01.txt
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 731619d..896497c 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@  check:
 	@(cd thermal; $(MAKE) check)
 #	@(cd powertop; $(MAKE) check)
 	@(cd cputopology; $(MAKE) check)
+	@(cd nohz; $(MAKE) check)
 
 uncheck:
 	@(cd cpufreq; $(MAKE) uncheck)
@@ -41,6 +42,7 @@  uncheck:
 	@(cd cpuidle; $(MAKE) uncheck)
 #	@(cd suspend; $(MAKE) uncheck)
 	@(cd thermal; $(MAKE) uncheck)
+	@(cd nohz; $(MAKE) uncheck)
 
 recheck: uncheck check
 
diff --git a/nohz/Makefile b/nohz/Makefile
new file mode 100644
index 0000000..315ff6f
--- /dev/null
+++ b/nohz/Makefile
@@ -0,0 +1,25 @@ 
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2014, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+# Contributors:
+#     Sanjay Singh Rawat <sanjay.rawat@linaro.org> (LG Electronics)
+#       - initial API and implementation
+#
+
+include ../Test.mk
diff --git a/nohz/nohz_01.sh b/nohz/nohz_01.sh
new file mode 100755
index 0000000..2828188
--- /dev/null
+++ b/nohz/nohz_01.sh
@@ -0,0 +1,64 @@ 
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2014, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+# Contributors:
+#     Sanjay Singh Rawat <sanjay.rawat@linaro.org> (LG Electronics)
+#       - initial API and implementation
+#
+
+# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#nohz_01
+
+source ../include/functions.sh
+
+check_cpu_nohz_interrupt() {
+    local cpu=$1
+    local cpuid=${cpu:3}
+    local ints=
+    local inte=
+    local i=
+    local diff=
+
+    i=$(cat /proc/interrupts | grep time | wc -l)
+    if [ $i -ne 1 ]; then
+        echo "warning: multiple entry for timer interrupt :" $i
+        exit 1
+    fi
+
+    if [ "$cpu" == "cpu0" ]; then
+        return 0
+    fi
+
+    cpuid=$((cpuid+2))
+    ints=$(cat /proc/interrupts | grep time | awk -v c=$cpuid '{ print $c }')
+    sleep 3
+    inte=$(cat /proc/interrupts | grep time | awk -v c=$cpuid '{ print $c }')
+
+    #echo $cpu "interrupts before" $ints "after" $inte
+    diff=$((inte-ints))
+
+    if [ $diff -eq 0 ]; then
+        echo $cpu "in NOHZ"
+    else
+        echo $cpu "not in NOHZ"
+    fi
+}
+
+for_each_cpu check_cpu_nohz_interrupt
+test_status_show
diff --git a/nohz/nohz_01.txt b/nohz/nohz_01.txt
new file mode 100644
index 0000000..0c547f5
--- /dev/null
+++ b/nohz/nohz_01.txt
@@ -0,0 +1 @@ 
+check each cpu is in nohz mode (wait 3 seconds for timer interrupt)