diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-09-22 17:20:16 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-09-22 17:20:16 -0400 |
commit | 956ffd54dda4da2f6d7c0963fda54a6be95f1c4f (patch) | |
tree | 955dc1179211dfffa3905491cdff86737190bca5 /src/ftdump.c | |
parent | a8b90fadf3b8cb67ef881a072f9f283d2a7a51af (diff) | |
parent | 00de6faa7cf1a9e95d738b204f570dd7123e738e (diff) |
Merge branch 'master' of git+ssh://cvs/cvs/proj/litmus/repo/ft_tools
Diffstat (limited to 'src/ftdump.c')
-rw-r--r-- | src/ftdump.c | 44 |
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 | |||
10 | static 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 | |||
20 | static void die(char* msg) | ||
21 | { | ||
22 | if (errno) | ||
23 | perror("error: "); | ||
24 | fprintf(stderr, "%s\n", msg); | ||
25 | exit(1); | ||
26 | } | ||
27 | |||
28 | int 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 | } | ||