aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/trace-event-parse.c2
-rw-r--r--tools/perf/util/trace-event-read.c19
-rw-r--r--tools/perf/util/trace-event.h7
3 files changed, 20 insertions, 8 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 069f261b225c..73a02223c629 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1937,7 +1937,7 @@ void *raw_field_ptr(struct event *event, const char *name, void *data)
1937 if (!field) 1937 if (!field)
1938 return NULL; 1938 return NULL;
1939 1939
1940 if (field->flags & FIELD_IS_STRING) { 1940 if (field->flags & FIELD_IS_DYNAMIC) {
1941 int offset; 1941 int offset;
1942 1942
1943 offset = *(int *)(data + field->offset); 1943 offset = *(int *)(data + field->offset);
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index cb54cd002f49..f55cc3a765a1 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -53,12 +53,6 @@ static unsigned long page_size;
53static ssize_t calc_data_size; 53static ssize_t calc_data_size;
54static bool repipe; 54static bool repipe;
55 55
56/* If it fails, the next read will report it */
57static void skip(int size)
58{
59 lseek(input_fd, size, SEEK_CUR);
60}
61
62static int do_read(int fd, void *buf, int size) 56static int do_read(int fd, void *buf, int size)
63{ 57{
64 int rsize = size; 58 int rsize = size;
@@ -98,6 +92,19 @@ static int read_or_die(void *data, int size)
98 return r; 92 return r;
99} 93}
100 94
95/* If it fails, the next read will report it */
96static void skip(int size)
97{
98 char buf[BUFSIZ];
99 int r;
100
101 while (size) {
102 r = size > BUFSIZ ? BUFSIZ : size;
103 read_or_die(buf, r);
104 size -= r;
105 };
106}
107
101static unsigned int read4(void) 108static unsigned int read4(void)
102{ 109{
103 unsigned int data; 110 unsigned int data;
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 406d452956db..b3e86b1e4444 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -233,7 +233,12 @@ static inline unsigned long long __data2host8(unsigned long long data)
233 233
234#define data2host2(ptr) __data2host2(*(unsigned short *)ptr) 234#define data2host2(ptr) __data2host2(*(unsigned short *)ptr)
235#define data2host4(ptr) __data2host4(*(unsigned int *)ptr) 235#define data2host4(ptr) __data2host4(*(unsigned int *)ptr)
236#define data2host8(ptr) __data2host8(*(unsigned long long *)ptr) 236#define data2host8(ptr) ({ \
237 unsigned long long __val; \
238 \
239 memcpy(&__val, (ptr), sizeof(unsigned long long)); \
240 __data2host8(__val); \
241})
237 242
238extern int header_page_ts_offset; 243extern int header_page_ts_offset;
239extern int header_page_ts_size; 244extern int header_page_ts_size;