2013-09-22 08:49:37

by Wei Yang

[permalink] [raw]
Subject: [PATCH] perf: fix two warning in bench/numa

There two warnings in bench/numa, when buiding this on 32-bit machine.

The warning output is attached:

bench/numa.c:1113:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
bench/numa.c:1161:6: error: format ‘%lx’ expects argument of t'long unsigned int’, but argument 5 has type ‘u64’ [-Werror=format]

This patch fixs these two warnings.

Signed-off-by: Wei Yang <[email protected]>
---
tools/perf/bench/numa.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 30d1c32..a73c4ed 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -1110,7 +1110,7 @@ static void *worker_thread(void *__tdata)
/* Check whether our max runtime timed out: */
if (g->p.nr_secs) {
timersub(&stop, &start0, &diff);
- if (diff.tv_sec >= g->p.nr_secs) {
+ if (diff.tv_sec >= (time_t)g->p.nr_secs) {
g->stop_work = true;
break;
}
@@ -1157,7 +1157,7 @@ static void *worker_thread(void *__tdata)
runtime_ns_max += diff.tv_usec * 1000;

if (details >= 0) {
- printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016lx]\n",
+ printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIu64"]\n",
process_nr, thread_nr, runtime_ns_max / bytes_done, val);
}
fflush(stdout);
--
1.7.5.4


2013-09-25 07:35:39

by Wei Yang

[permalink] [raw]
Subject: Re: [PATCH] perf: fix two warning in bench/numa

Hi, all

Any comments on this one?

These two warnings will break the compile of perf under 32-bit machine.

On Sun, Sep 22, 2013 at 04:49:24PM +0800, Wei Yang wrote:
>There two warnings in bench/numa, when buiding this on 32-bit machine.
>
>The warning output is attached:
>
>bench/numa.c:1113:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
>bench/numa.c:1161:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'u64' [-Werror=format]
>
>This patch fixs these two warnings.
>
>Signed-off-by: Wei Yang <[email protected]>
>---
> tools/perf/bench/numa.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
>index 30d1c32..a73c4ed 100644
>--- a/tools/perf/bench/numa.c
>+++ b/tools/perf/bench/numa.c
>@@ -1110,7 +1110,7 @@ static void *worker_thread(void *__tdata)
> /* Check whether our max runtime timed out: */
> if (g->p.nr_secs) {
> timersub(&stop, &start0, &diff);
>- if (diff.tv_sec >= g->p.nr_secs) {
>+ if (diff.tv_sec >= (time_t)g->p.nr_secs) {
> g->stop_work = true;
> break;
> }
>@@ -1157,7 +1157,7 @@ static void *worker_thread(void *__tdata)
> runtime_ns_max += diff.tv_usec * 1000;
>
> if (details >= 0) {
>- printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016lx]\n",
>+ printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIu64"]\n",
> process_nr, thread_nr, runtime_ns_max / bytes_done, val);
> }
> fflush(stdout);
>--
>1.7.5.4

--
Richard Yang
Help you, Help me

2013-09-25 11:26:54

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] perf: fix two warning in bench/numa


* Wei Yang <[email protected]> wrote:

> Hi, all
>
> Any comments on this one?
>
> These two warnings will break the compile of perf under 32-bit machine.

fix looks good to me.

> >- if (diff.tv_sec >= g->p.nr_secs) {
> >+ if (diff.tv_sec >= (time_t)g->p.nr_secs) {

> >- printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016lx]\n",
> >+ printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIu64"]\n",

Acked-by: Ingo Molnar <[email protected]>

Thanks,

Ingo

2013-09-26 01:16:35

by Wei Yang

[permalink] [raw]
Subject: Re: [PATCH] perf: fix two warning in bench/numa

On Wed, Sep 25, 2013 at 01:26:29PM +0200, Ingo Molnar wrote:
>
>* Wei Yang <[email protected]> wrote:
>
>> Hi, all
>>
>> Any comments on this one?
>>
>> These two warnings will break the compile of perf under 32-bit machine.
>
>fix looks good to me.

Thanks for your comments :-)

>
>> >- if (diff.tv_sec >= g->p.nr_secs) {
>> >+ if (diff.tv_sec >= (time_t)g->p.nr_secs) {
>
>> >- printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016lx]\n",
>> >+ printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIu64"]\n",
>
>Acked-by: Ingo Molnar <[email protected]>
>
>Thanks,
>
> Ingo

--
Richard Yang
Help you, Help me

2013-10-30 03:19:03

by Wei Yang

[permalink] [raw]
Subject: Re: [PATCH] perf: fix two warning in bench/numa

Dear maintainer,

Is this one accepted or droped?
Or I missed the right person?

On Sun, Sep 22, 2013 at 04:49:24PM +0800, Wei Yang wrote:
>There two warnings in bench/numa, when buiding this on 32-bit machine.
>
>The warning output is attached:
>
>bench/numa.c:1113:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
>bench/numa.c:1161:6: error: format ‘%lx’ expects argument of t'long unsigned int’, but argument 5 has type ‘u64’ [-Werror=format]
>
>This patch fixs these two warnings.
>
>Signed-off-by: Wei Yang <[email protected]>
>---
> tools/perf/bench/numa.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
>index 30d1c32..a73c4ed 100644
>--- a/tools/perf/bench/numa.c
>+++ b/tools/perf/bench/numa.c
>@@ -1110,7 +1110,7 @@ static void *worker_thread(void *__tdata)
> /* Check whether our max runtime timed out: */
> if (g->p.nr_secs) {
> timersub(&stop, &start0, &diff);
>- if (diff.tv_sec >= g->p.nr_secs) {
>+ if (diff.tv_sec >= (time_t)g->p.nr_secs) {
> g->stop_work = true;
> break;
> }
>@@ -1157,7 +1157,7 @@ static void *worker_thread(void *__tdata)
> runtime_ns_max += diff.tv_usec * 1000;
>
> if (details >= 0) {
>- printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016lx]\n",
>+ printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIu64"]\n",
> process_nr, thread_nr, runtime_ns_max / bytes_done, val);
> }
> fflush(stdout);
>--
>1.7.5.4

--
Richard Yang
Help you, Help me