diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-12-09 11:59:25 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-12-09 11:59:25 -0500 |
commit | 6146de11f45ca0a7f758ab719b1e3ecc467a1d66 (patch) | |
tree | 7514727532d41d73dad79b915a2baa5c4b2d0c55 | |
parent | bc456849c14a2bb5fe40bbe9f392a6a47b500a8c (diff) |
provide usage information
-rw-r--r-- | src/ft2csv.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ft2csv.c b/src/ft2csv.c index 90d231f..0bfb68c 100644 --- a/src/ft2csv.c +++ b/src/ft2csv.c | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | #include "timestamp.h" | 10 | #include "timestamp.h" |
11 | 11 | ||
12 | int no_interleaved = 1; | 12 | static int no_interleaved = 0; |
13 | 13 | ||
14 | static unsigned int complete = 0; | 14 | static unsigned int complete = 0; |
15 | static unsigned int incomplete = 0; | 15 | static unsigned int incomplete = 0; |
@@ -19,7 +19,6 @@ static unsigned int non_rt = 0; | |||
19 | static unsigned int interleaved = 0; | 19 | static unsigned int interleaved = 0; |
20 | 20 | ||
21 | static unsigned long long threshold = 2700 * 1000; /* 1 ms == 1 full tick */ | 21 | static unsigned long long threshold = 2700 * 1000; /* 1 ms == 1 full tick */ |
22 | //static unsigned long long threshold = 2700 * 50; /* 1 ms == 1 full tick */ | ||
23 | 22 | ||
24 | static struct timestamp* next(struct timestamp* start, struct timestamp* end, | 23 | static struct timestamp* next(struct timestamp* start, struct timestamp* end, |
25 | int cpu) | 24 | int cpu) |
@@ -122,15 +121,23 @@ static void show_id(struct timestamp* start, struct timestamp* end, | |||
122 | show_csv(start, end); | 121 | show_csv(start, end); |
123 | } | 122 | } |
124 | 123 | ||
124 | #define USAGE \ | ||
125 | "Usage: ft2csv [-e] [-i] <event_name> <logfile> \n" \ | ||
126 | " -e: endianess swap -- restores byte order \n" \ | ||
127 | " -i: ignore interleaved -- ignore samples if start " \ | ||
128 | "and end are non-consecutive\n" \ | ||
129 | "" | ||
130 | |||
125 | static void die(char* msg) | 131 | static void die(char* msg) |
126 | { | 132 | { |
127 | if (errno) | 133 | if (errno) |
128 | perror("error: "); | 134 | perror("error: "); |
129 | fprintf(stderr, "%s\n", msg); | 135 | fprintf(stderr, "%s\n", msg); |
136 | fprintf(stderr, "%s", USAGE); | ||
130 | exit(1); | 137 | exit(1); |
131 | } | 138 | } |
132 | 139 | ||
133 | #define OPTS "e" | 140 | #define OPTS "ei" |
134 | 141 | ||
135 | int main(int argc, char** argv) | 142 | int main(int argc, char** argv) |
136 | { | 143 | { |
@@ -152,6 +159,9 @@ int main(int argc, char** argv) | |||
152 | case 'e': | 159 | case 'e': |
153 | swap_byte_order = 1; | 160 | swap_byte_order = 1; |
154 | break; | 161 | break; |
162 | case 'i': | ||
163 | no_interleaved = 1; | ||
164 | break; | ||
155 | default: | 165 | default: |
156 | die("Unknown option."); | 166 | die("Unknown option."); |
157 | break; | 167 | break; |
@@ -159,7 +169,7 @@ int main(int argc, char** argv) | |||
159 | } | 169 | } |
160 | 170 | ||
161 | if (argc - optind != 2) | 171 | if (argc - optind != 2) |
162 | die("Usage: ft2csv [-e] <event_name> <logfile>"); | 172 | die("arguments missing"); |
163 | if (map_file(argv[optind + 1], &mapped, &size)) | 173 | if (map_file(argv[optind + 1], &mapped, &size)) |
164 | die("could not map file"); | 174 | die("could not map file"); |
165 | 175 | ||