* [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
@ 2007-09-26 14:39 Maxim Uvarov
2007-09-26 11:01 ` [PATCH] Since we have counters in __u64 format we have to print themwith " Balbir Singh
2007-09-26 11:32 ` [PATCH] Since we have counters in __u64 format we have to print them with " Andreas Schwab
0 siblings, 2 replies; 8+ messages in thread
From: Maxim Uvarov @ 2007-09-26 14:39 UTC (permalink / raw)
To: LKML; +Cc: balbir, jlan
Small fix for documentation.
---
Documentation/accounting/getdelays.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cbee3a2..73924df 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
void task_context_switch_counts(struct taskstats *t)
{
printf("\n\nTask %15s%15s\n"
- " %15lu%15lu\n",
+ " %15llu%15llu\n",
"voluntary", "nonvoluntary",
t->nvcsw, t->nivcsw);
}
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] Since we have counters in __u64 format we have to print themwith %llu macros.
2007-09-26 14:39 [PATCH] Since we have counters in __u64 format we have to print them with %llu macros Maxim Uvarov
@ 2007-09-26 11:01 ` Balbir Singh
2007-09-26 11:32 ` [PATCH] Since we have counters in __u64 format we have to print them with " Andreas Schwab
1 sibling, 0 replies; 8+ messages in thread
From: Balbir Singh @ 2007-09-26 11:01 UTC (permalink / raw)
To: Maxim Uvarov; +Cc: LKML, balbir, jlan
Maxim Uvarov wrote:
> Small fix for documentation.
>
>
>
> ---
>
> Documentation/accounting/getdelays.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
> index cbee3a2..73924df 100644
> --- a/Documentation/accounting/getdelays.c
> +++ b/Documentation/accounting/getdelays.c
> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
> void task_context_switch_counts(struct taskstats *t)
> {
> printf("\n\nTask %15s%15s\n"
> - " %15lu%15lu\n",
> + " %15llu%15llu\n",
> "voluntary", "nonvoluntary",
> t->nvcsw, t->nivcsw);
> }
>
Looks good!
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
2007-09-26 14:39 [PATCH] Since we have counters in __u64 format we have to print them with %llu macros Maxim Uvarov
2007-09-26 11:01 ` [PATCH] Since we have counters in __u64 format we have to print themwith " Balbir Singh
@ 2007-09-26 11:32 ` Andreas Schwab
2007-09-26 11:48 ` Balbir Singh
1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2007-09-26 11:32 UTC (permalink / raw)
To: Maxim Uvarov; +Cc: LKML, balbir, jlan
Maxim Uvarov <muvarov@ru.mvista.com> writes:
> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
> index cbee3a2..73924df 100644
> --- a/Documentation/accounting/getdelays.c
> +++ b/Documentation/accounting/getdelays.c
> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
> void task_context_switch_counts(struct taskstats *t)
> {
> printf("\n\nTask %15s%15s\n"
> - " %15lu%15lu\n",
> + " %15llu%15llu\n",
> "voluntary", "nonvoluntary",
> t->nvcsw, t->nivcsw);
__u64 is not always long long.
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] 8+ messages in thread* Re: [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
2007-09-26 11:32 ` [PATCH] Since we have counters in __u64 format we have to print them with " Andreas Schwab
@ 2007-09-26 11:48 ` Balbir Singh
2007-09-26 18:22 ` H. Peter Anvin
0 siblings, 1 reply; 8+ messages in thread
From: Balbir Singh @ 2007-09-26 11:48 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Maxim Uvarov, LKML, balbir, jlan
Andreas Schwab wrote:
> Maxim Uvarov <muvarov@ru.mvista.com> writes:
>
>> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
>> index cbee3a2..73924df 100644
>> --- a/Documentation/accounting/getdelays.c
>> +++ b/Documentation/accounting/getdelays.c
>> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
>> void task_context_switch_counts(struct taskstats *t)
>> {
>> printf("\n\nTask %15s%15s\n"
>> - " %15lu%15lu\n",
>> + " %15llu%15llu\n",
>> "voluntary", "nonvoluntary",
>> t->nvcsw, t->nivcsw);
>
> __u64 is not always long long.
What is the maximum size of long long across all architectures?
How does one format __u64 for printing?
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
2007-09-26 11:48 ` Balbir Singh
@ 2007-09-26 18:22 ` H. Peter Anvin
2007-09-27 8:19 ` Balbir Singh
0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2007-09-26 18:22 UTC (permalink / raw)
To: balbir; +Cc: Andreas Schwab, Maxim Uvarov, LKML, balbir, jlan
Balbir Singh wrote:
> Andreas Schwab wrote:
>> Maxim Uvarov <muvarov@ru.mvista.com> writes:
>>
>>> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
>>> index cbee3a2..73924df 100644
>>> --- a/Documentation/accounting/getdelays.c
>>> +++ b/Documentation/accounting/getdelays.c
>>> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
>>> void task_context_switch_counts(struct taskstats *t)
>>> {
>>> printf("\n\nTask %15s%15s\n"
>>> - " %15lu%15lu\n",
>>> + " %15llu%15llu\n",
>>> "voluntary", "nonvoluntary",
>>> t->nvcsw, t->nivcsw);
>> __u64 is not always long long.
>
> What is the maximum size of long long across all architectures?
> How does one format __u64 for printing?
>
In user space, use the macro PRIu64 (or PRIx64 etc) from <inttypes.h>.
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
2007-09-26 18:22 ` H. Peter Anvin
@ 2007-09-27 8:19 ` Balbir Singh
0 siblings, 0 replies; 8+ messages in thread
From: Balbir Singh @ 2007-09-27 8:19 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Andreas Schwab, Maxim Uvarov, LKML, balbir, jlan
H. Peter Anvin wrote:
> Balbir Singh wrote:
>> Andreas Schwab wrote:
>>> Maxim Uvarov <muvarov@ru.mvista.com> writes:
>>>
>>>> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
>>>> index cbee3a2..73924df 100644
>>>> --- a/Documentation/accounting/getdelays.c
>>>> +++ b/Documentation/accounting/getdelays.c
>>>> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
>>>> void task_context_switch_counts(struct taskstats *t)
>>>> {
>>>> printf("\n\nTask %15s%15s\n"
>>>> - " %15lu%15lu\n",
>>>> + " %15llu%15llu\n",
>>>> "voluntary", "nonvoluntary",
>>>> t->nvcsw, t->nivcsw);
>>> __u64 is not always long long.
>> What is the maximum size of long long across all architectures?
>> How does one format __u64 for printing?
>>
>
> In user space, use the macro PRIu64 (or PRIx64 etc) from <inttypes.h>.
>
> -hpa
Thanks, I'll look into it
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
@ 2007-09-26 17:52 Maxim Uvarov
0 siblings, 0 replies; 8+ messages in thread
From: Maxim Uvarov @ 2007-09-26 17:52 UTC (permalink / raw)
To: LKML; +Cc: balbir, jlan
Small fix for documentation.
Added (unsigned long long).
---
Documentation/accounting/getdelays.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cbee3a2..056f024 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -208,9 +208,10 @@ void print_delayacct(struct taskstats *t)
void task_context_switch_counts(struct taskstats *t)
{
printf("\n\nTask %15s%15s\n"
- " %15lu%15lu\n",
+ " %15llu%15llu\n",
"voluntary", "nonvoluntary",
- t->nvcsw, t->nivcsw);
+ (unsigned long long)t->nvcsw,
+ (unsigned long long)t->nivcsw);
}
void print_ioacct(struct taskstats *t)
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
@ 2007-09-26 12:36 Mikael Pettersson
0 siblings, 0 replies; 8+ messages in thread
From: Mikael Pettersson @ 2007-09-26 12:36 UTC (permalink / raw)
To: balbir, schwab; +Cc: balbir, jlan, linux-kernel, muvarov
On Wed, 26 Sep 2007 17:18:06 +0530, Balbir Singh wrote:
> Andreas Schwab wrote:
> > Maxim Uvarov <muvarov@ru.mvista.com> writes:
> >
> >> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
> >> index cbee3a2..73924df 100644
> >> --- a/Documentation/accounting/getdelays.c
> >> +++ b/Documentation/accounting/getdelays.c
> >> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
> >> void task_context_switch_counts(struct taskstats *t)
> >> {
> >> printf("\n\nTask %15s%15s\n"
> >> - " %15lu%15lu\n",
> >> + " %15llu%15llu\n",
> >> "voluntary", "nonvoluntary",
> >> t->nvcsw, t->nivcsw);
> >
> > __u64 is not always long long.
>
> What is the maximum size of long long across all architectures?
> How does one format __u64 for printing?
With %lu you get warnings when u64 is long long (32-bit).
With %llu you get warnings when u64 is plain long (most 64-bit).
Hence %llu + long long cast, i.e.:
printf("%llu", (unsigned long long)value);
This is ugly but luckily imposes no runtime overheads on
current 32- or 64-bit machines.
This could be done more cleanly if the u64 typedef also
#define:d a corresponding FMT_U64 format string.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-09-27 8:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26 14:39 [PATCH] Since we have counters in __u64 format we have to print them with %llu macros Maxim Uvarov
2007-09-26 11:01 ` [PATCH] Since we have counters in __u64 format we have to print themwith " Balbir Singh
2007-09-26 11:32 ` [PATCH] Since we have counters in __u64 format we have to print them with " Andreas Schwab
2007-09-26 11:48 ` Balbir Singh
2007-09-26 18:22 ` H. Peter Anvin
2007-09-27 8:19 ` Balbir Singh
-- strict thread matches above, loose matches on Subject: below --
2007-09-26 17:52 Maxim Uvarov
2007-09-26 12:36 Mikael Pettersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox