aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2013-12-03 08:09:18 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-04 13:17:58 -0500
commit91a058ad3856b0a37cb21250eb4c478d0297a1a3 (patch)
tree41534fdefdd4500884b9c41d70ec9a6ce0b4b0b1 /tools
parente0e96d03f004e8953a731053b61e275f276fff01 (diff)
tools lib traceevent: Add traceevent_host_bigendian function
Adding traceevent_host_bigendian function to get host endianity. It's used in following patches. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1386076182-14484-5-git-send-email-jolsa@redhat.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/traceevent/event-parse.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index a28886066bcc..54273c0ec544 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -23,6 +23,7 @@
23#include <stdbool.h> 23#include <stdbool.h>
24#include <stdarg.h> 24#include <stdarg.h>
25#include <regex.h> 25#include <regex.h>
26#include <string.h>
26 27
27#ifndef __maybe_unused 28#ifndef __maybe_unused
28#define __maybe_unused __attribute__((unused)) 29#define __maybe_unused __attribute__((unused))
@@ -527,6 +528,15 @@ __data2host8(struct pevent *pevent, unsigned long long data)
527 __data2host8(pevent, __val); \ 528 __data2host8(pevent, __val); \
528}) 529})
529 530
531static inline int traceevent_host_bigendian(void)
532{
533 unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 };
534 unsigned int val;
535
536 memcpy(&val, str, 4);
537 return val == 0x01020304;
538}
539
530/* taken from kernel/trace/trace.h */ 540/* taken from kernel/trace/trace.h */
531enum trace_flag_type { 541enum trace_flag_type {
532 TRACE_FLAG_IRQS_OFF = 0x01, 542 TRACE_FLAG_IRQS_OFF = 0x01,