Skip to contentSkip to conversation

perf: fix two warning in bench/numa

PATCH In review Wei Yang 3 participants 6 messages Sep 22, 2013 – Nov 4, 2013 perf events

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 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.

---
 tools/perf/bench/numa.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +2 -2
index 30d1c32..a73c4ed 100644
@@ -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);
Signature · 1 line
1.7.5.4
author
#1 lore raw

Hi, all

Any comments on this one?

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

Quoted 38 lines · Wei Yang

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.

---
tools/perf/bench/numa.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +2 -2
index 30d1c32..a73c4ed 100644
@@ -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);
Signature · 1 line
1.7.5.4
Signature · 2 lines
Richard Yang
Help you, Help me
Acked-by
#2 lore raw
Quoted 5 lines · Wei Yang

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.

Quoted 5 lines

tools/perf/bench/numa.c static void *worker_thread(void *__tdata) · line 1160

Quoted 5 lines
tools/perf/bench/numa.c +2 -2
-			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",

Thanks,

Ingo

author
#3 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 5 lines · Wei Yang

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 :-)

Quoted 12 lines
Quoted 6 lines

tools/perf/bench/numa.c static void *worker_thread(void *__tdata) · line 1160

Quoted 6 lines
tools/perf/bench/numa.c +2 -2
-			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",

Thanks,

Ingo

Signature · 2 lines
Richard Yang
Help you, Help me
author
#4 lore raw
In reply to Wei Yang

Dear maintainer,

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

Quoted 38 lines · Wei Yang

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.

---
tools/perf/bench/numa.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +2 -2
index 30d1c32..a73c4ed 100644
@@ -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);
Signature · 1 line
1.7.5.4
Signature · 2 lines
Richard Yang
Help you, Help me
#5 lore raw

[tip:perf/core] perf bench: Fix two warnings

In reply to Wei Yang
perf bench: Fix two warnings
Commit-ID:  32bf5bd181026fc99c0e15045abe409167285ba8
Gitweb:     http://git.kernel.org/tip/32bf5bd181026fc99c0e15045abe409167285ba8
Author:     Wei Yang <[email protected]>
AuthorDate: Sun, 22 Sep 2013 16:49:24 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 1 Nov 2013 10:41:54 -0300

perf bench: Fix two warnings

There are two warnings in bench/numa, when building 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 fixes these two warnings.

---
 tools/perf/bench/numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/bench/numa.c +2 -2
index 30d1c32..a73c4ed 100644
@@ -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);