* Re: [PATCH 2/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting)
@ 2007-10-16 13:33 Andreas Schwab
2007-10-16 13:35 ` Hidetoshi Seto
2007-10-17 6:32 ` Hidetoshi Seto
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Schwab @ 2007-10-16 13:33 UTC (permalink / raw)
To: linux-ia64
Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> writes:
> Index: linux-2.6.23/include/asm-ia64/cputime.h
> =================================> --- linux-2.6.23.orig/include/asm-ia64/cputime.h
> +++ linux-2.6.23/include/asm-ia64/cputime.h
> @@ -1,6 +1,82 @@
> +/*
> + * include/asm-ia64/cputime.h
Kill that line. Instead describe the contents of the file.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting)
2007-10-16 13:33 [PATCH 2/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting) Andreas Schwab
@ 2007-10-16 13:35 ` Hidetoshi Seto
2007-10-17 6:32 ` Hidetoshi Seto
1 sibling, 0 replies; 3+ messages in thread
From: Hidetoshi Seto @ 2007-10-16 13:35 UTC (permalink / raw)
To: linux-ia64
> [2/9] ia64_expand_ia64_cputime_h.patch
To check and gather well-grained time, a problem comes
first. It is unit of cpu time, i.e. type of cputime_t.
[include/linux/sched.h]
struct task_struct {
cputime_t utime, stime;
On ia64, this cputime_t is defined quite simply.
[include/asm-ia64/cputime.h]
1 #ifndef __IA64_CPUTIME_H
2 #define __IA64_CPUTIME_H
3
4 #include <asm-generic/cputime.h>
5
6 #endif /* __IA64_CPUTIME_H */
The unit of generic cputime_t is:
[include/asm-generic/cputime.h]
#define jiffies_to_cputime(__jif) (__jif)
tick, equal to jiffies, msec in HZ\x1000.
Therefore, no matter how good grained time we can gather,
we need to round the time value into tick when it save to
stime/utime. Even if we can distinguish 0.6ms and 1.4ms,
we cannot do it after rounding both to 1ms.
To keep accurate time value, we need to define ia64 specific
cputime_t. As the first step to do it, this patch just copy
definitions in asm-generic/cputime.h to asm-ia64/cputime.h.
Required change will be done in next patch[3/9].
Thanks,
H.Seto
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
include/asm-ia64/cputime.h | 76 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+)
Index: linux-2.6.23/include/asm-ia64/cputime.h
=================================--- linux-2.6.23.orig/include/asm-ia64/cputime.h
+++ linux-2.6.23/include/asm-ia64/cputime.h
@@ -1,6 +1,82 @@
+/*
+ * include/asm-ia64/cputime.h
+ *
+ * (C) Copyright FUJITSU LIMITED 2007
+ */
+
#ifndef __IA64_CPUTIME_H
#define __IA64_CPUTIME_H
+#ifndef CONFIG_VIRT_CPU_ACCOUNTING
#include <asm-generic/cputime.h>
+#else
+
+#include <linux/time.h>
+#include <linux/jiffies.h>
+#include <asm/processor.h>
+
+typedef u64 cputime_t;
+typedef u64 cputime64_t;
+
+#define cputime_zero ((cputime_t)0)
+#define cputime_max ((~((cputime_t)0) >> 1) - 1)
+#define cputime_add(__a, __b) ((__a) + (__b))
+#define cputime_sub(__a, __b) ((__a) - (__b))
+#define cputime_div(__a, __n) ((__a) / (__n))
+#define cputime_halve(__a) ((__a) >> 1)
+#define cputime_eq(__a, __b) ((__a) = (__b))
+#define cputime_gt(__a, __b) ((__a) > (__b))
+#define cputime_ge(__a, __b) ((__a) >= (__b))
+#define cputime_lt(__a, __b) ((__a) < (__b))
+#define cputime_le(__a, __b) ((__a) <= (__b))
+
+#define cputime64_zero ((cputime64_t)0)
+#define cputime64_add(__a, __b) ((__a) + (__b))
+#define cputime64_sub(__a, __b) ((__a) - (__b))
+#define cputime_to_cputime64(__ct) (__ct)
+
+/*
+ * Convert cputime <-> jiffies
+ */
+#define cputime_to_jiffies(__ct) (__ct)
+#define jiffies_to_cputime(__jif) (__jif)
+#define cputime64_to_jiffies64(__ct) (__ct)
+#define jiffies64_to_cputime64(__jif) (__jif)
+
+/*
+ * Convert cputime <-> milliseconds
+ */
+#define cputime_to_msecs(__ct) jiffies_to_msecs(__ct)
+#define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs)
+
+/*
+ * Convert cputime <-> seconds
+ */
+#define cputime_to_secs(__ct) ((__ct) / HZ)
+#define secs_to_cputime(__secs) ((__secs) * HZ)
+
+/*
+ * Convert cputime <-> timespec
+ */
+#define timespec_to_cputime(__val) timespec_to_jiffies(__val)
+#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
+
+/*
+ * Convert cputime <-> timeval
+ */
+#define timeval_to_cputime(__val) timeval_to_jiffies(__val)
+#define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val)
+
+/*
+ * Convert cputime <-> clock
+ */
+#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct)
+#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x)
+
+/*
+ * Convert cputime64 to clock.
+ */
+#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct)
+#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
#endif /* __IA64_CPUTIME_H */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting)
2007-10-16 13:33 [PATCH 2/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting) Andreas Schwab
2007-10-16 13:35 ` Hidetoshi Seto
@ 2007-10-17 6:32 ` Hidetoshi Seto
1 sibling, 0 replies; 3+ messages in thread
From: Hidetoshi Seto @ 2007-10-17 6:32 UTC (permalink / raw)
To: linux-ia64
Thank you for quick comment.
Andreas Schwab wrote:
> Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> writes:
>
>> Index: linux-2.6.23/include/asm-ia64/cputime.h
>> =================================>> --- linux-2.6.23.orig/include/asm-ia64/cputime.h
>> +++ linux-2.6.23/include/asm-ia64/cputime.h
>> @@ -1,6 +1,82 @@
>> +/*
>> + * include/asm-ia64/cputime.h
>
> Kill that line. Instead describe the contents of the file.
>
> Andreas.
Well, then I will follow powerpc's example, not s390's :-D
Thanks,
H.Seto
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-10-17 6:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-16 13:33 [PATCH 2/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting) Andreas Schwab
2007-10-16 13:35 ` Hidetoshi Seto
2007-10-17 6:32 ` Hidetoshi Seto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox