linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rt-tests] Fix tracemark output when the latency threshold is hit on ARM
@ 2014-01-28 21:49 Uwe Kleine-König
  2014-01-31 19:16 ` [PATCH rt-tests v2] " Uwe Kleine-König
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2014-01-28 21:49 UTC (permalink / raw)
  To: linux-rt-users

On ARM I'm seeing output like:

	cyclicte-623     0....... 19619418us+: tracing_mark_write: hit latency threshold (2000 > 2097)

That's because of a format mismatch in

	tracemark("hit latency threshold (%d > %d)", diff, tracelimit);

diff is a u64 and tracelimit an int. So on ARM the string is passed in r0,
tracelimit in r1 and diff in r2+r3. The vsnprintf used in tracemark only
expects to ints passed and so only uses r1 and r2 yielding the permutation
in the output.

With a printf attribute annotation for tracemark added this patch fixes a
compiler warning:

	src/cyclictest/cyclictest.c: In function ‘timerthread’:
	src/cyclictest/cyclictest.c:899:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘uint64_t’ [-Wformat]

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: 7667ff694693 ("add setup and call of tracemark function for breaktrace")
---
Hello,

I'm not sure you like that c99 stuff. Tell me if you prefer a cast
to unsigned long long + %llu.

Also, what do you think about adding the printf annotation? Do we care about
non-gcc compilers?

Best regards
Uwe

 src/cyclictest/cyclictest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 686a6356659f..d1e70901e39f 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <inttypes.h>
 #include <stdarg.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -895,7 +896,7 @@ void *timerthread(void *param)
 
 		if (!stopped && tracelimit && (diff > tracelimit)) {
 			stopped++;
-			tracemark("hit latency threshold (%d > %d)", diff, tracelimit);
+			tracemark("hit latency threshold (%" PRIu64 " > %d)", diff, tracelimit);
 			tracing(0);
 			shutdown++;
 			pthread_mutex_lock(&break_thread_id_lock);
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-31 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 21:49 [PATCH rt-tests] Fix tracemark output when the latency threshold is hit on ARM Uwe Kleine-König
2014-01-31 19:16 ` [PATCH rt-tests v2] " Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).