Polling time, if read() doesn't block. Currently, trace_pipe_raw never
blocks on read(). So, we need to sleep for a while, to avoid spending
too much CPU cycles. A fix for it is expected for 3.10.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
#include "kbuffer.h"
#include "event-parse.h"
+/*
+ * Polling time, if read() doesn't block. Currently, trace_pipe_raw never
+ * blocks on read(). So, we need to sleep for a while, to avoid spending
+ * too much CPU cycles. A fix for it is expected for 3.10.
+ */
+#define POLLING_TIME 15
+
#define PAGE_SIZE 0x400
/* Test for a little-endian machine */
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
kbuffer_next_event(kbuf, NULL);
}
} else {
- printf("read size = 0\n");
+ /*
+ * Before Kernel 3.10, read() never blocks. So, we
+ * need to sleep for a while
+ */
+ sleep(POLLING_TIME);
}
} while (1);
}