[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1422626562-6966-3-git-send-email-phacht@linux.vnet.ibm.com>
Date: Fri, 30 Jan 2015 15:02:41 +0100
From: Philipp Hachtmann <phacht@...ux.vnet.ibm.com>
To: mingo@...hat.com, peterz@...radead.org,
linux-kernel@...r.kernel.org
Cc: heiko.carstens@...ibm.com, linux-s390@...r.kernel.org,
schwidefsky@...ibm.com,
Philipp Hachtmann <phacht@...ux.vnet.ibm.com>
Subject: [PATCH 2/3] s390/cputime: Provide CPU runtime since IPL
The cpu maintains a cpu timer which runs only while the cpu
is available to the system (i.e. not scheduled away by the hypervisor).
This patch introduces a function cpu_exec_time that returns a
time stamp which reflects the cpu's real processing time since IPL.
Signed-off-by: Philipp Hachtmann <phacht@...ux.vnet.ibm.com>
---
arch/s390/include/asm/cputime.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index b91e960..fee50dd 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -167,6 +167,22 @@ static inline clock_t cputime64_to_clock_t(cputime64_t cputime)
return clock;
}
+/*
+ * Read out the current CPU's timer
+ *
+ * Returns an incrementing time stamp in ns.
+ */
+static inline u64 cpu_exec_time(int cpu_unused)
+{
+ u64 timer;
+ asm volatile(
+ " stpt %0\n" /* Store current cpu timer value */
+ : "=m" (timer));
+
+ return ((ULLONG_MAX - timer) * 1000) / 4096;
+}
+#define cpu_exec_time cpu_exec_time
+
cputime64_t arch_cpu_idle_time(int cpu);
#define arch_idle_time(cpu) arch_cpu_idle_time(cpu)
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists