aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/trace-event-read.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/trace-event-read.c')
-rw-r--r--tools/perf/util/trace-event-read.c19
1 files changed, 13 insertions, 6 deletions
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;