From: Philipp Hachtmann <phacht@linux.vnet.ibm.com>
To: mingo@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org
Cc: heiko.carstens@de.ibm.com, linux-s390@vger.kernel.org,
schwidefsky@de.ibm.com,
Philipp Hachtmann <phacht@linux.vnet.ibm.com>
Subject: [PATCH 2/3] s390/cputime: Provide CPU runtime since IPL
Date: Fri, 30 Jan 2015 15:02:41 +0100 [thread overview]
Message-ID: <1422626562-6966-3-git-send-email-phacht@linux.vnet.ibm.com> (raw)
In-Reply-To: <1422626562-6966-1-git-send-email-phacht@linux.vnet.ibm.com>
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@linux.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
next prev parent reply other threads:[~2015-01-30 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 14:02 [RFC] [PATCH 0/3] sched: Support for real CPU runtime and SMT scaling Philipp Hachtmann
2015-01-30 14:02 ` [PATCH 1/3] sched: Support for CPU runtime and SMT based adaption Philipp Hachtmann
2015-01-30 14:02 ` Philipp Hachtmann [this message]
2015-01-30 14:02 ` [PATCH 3/3] s390/cputime: SMT based scaling of CPU runtime deltas Philipp Hachtmann
2015-01-31 11:43 ` [RFC] [PATCH 0/3] sched: Support for real CPU runtime and SMT scaling Peter Zijlstra
2015-02-03 14:11 ` Martin Schwidefsky
2015-02-05 11:24 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422626562-6966-3-git-send-email-phacht@linux.vnet.ibm.com \
--to=phacht@linux.vnet.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox