aboutsummaryrefslogtreecommitdiffstats
path: root/src/ftdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ftdump.c')
-rw-r--r--src/ftdump.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ftdump.c b/src/ftdump.c
new file mode 100644
index 0000000..849d6ee
--- /dev/null
+++ b/src/ftdump.c
@@ -0,0 +1,44 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <errno.h>
5
6#include "mapping.h"
7
8#include "timestamp.h"
9
10static void dump(struct timestamp* ts, size_t count)
11{
12 struct timestamp *x;
13 while (count--) {
14 x = ts++;
15 printf("event:%d seq:%u cpu:%d type:%d\n",
16 (int) x->event, x->seq_no, x->cpu, x->task_type);
17 }
18}
19
20static void die(char* msg)
21{
22 if (errno)
23 perror("error: ");
24 fprintf(stderr, "%s\n", msg);
25 exit(1);
26}
27
28int main(int argc, char** argv)
29{
30 void* mapped;
31 size_t size, count;
32 struct timestamp* ts;
33
34 if (argc != 2)
35 die("Usage: ftdump <logfile>");
36 if (map_file(argv[1], &mapped, &size))
37 die("could not map file");
38
39 ts = (struct timestamp*) mapped;
40 count = size / sizeof(struct timestamp);
41
42 dump(ts, count);
43 return 0;
44}