diff options
| author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-04-22 17:46:10 -0400 |
|---|---|---|
| committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-04-22 17:46:10 -0400 |
| commit | b1096b601d7dab3aba29a68cdf161505100bd55a (patch) | |
| tree | 2f62be82b5fb4453fe49854f9829289207657280 | |
| parent | a5853581ad9518280753f90e906c0827a2e5673b (diff) | |
st_show: add -c display count option
| -rw-r--r-- | src/showst.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/showst.c b/src/showst.c index 3e68be6..a89da10 100644 --- a/src/showst.c +++ b/src/showst.c | |||
| @@ -15,13 +15,14 @@ static void usage(const char *str) | |||
| 15 | "\n" | 15 | "\n" |
| 16 | " OPTIONS\n" | 16 | " OPTIONS\n" |
| 17 | " -r -- find task system release and exit\n" | 17 | " -r -- find task system release and exit\n" |
| 18 | " -c -- display a count of the number of events\n" | ||
| 18 | "\n\n" | 19 | "\n\n" |
| 19 | ); | 20 | ); |
| 20 | fprintf(stderr, "Aborted: %s\n", str); | 21 | fprintf(stderr, "Aborted: %s\n", str); |
| 21 | exit(1); | 22 | exit(1); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | #define OPTSTR "r" | 25 | #define OPTSTR "rc" |
| 25 | 26 | ||
| 26 | int main(int argc, char** argv) | 27 | int main(int argc, char** argv) |
| 27 | { | 28 | { |
| @@ -31,6 +32,7 @@ int main(int argc, char** argv) | |||
| 31 | u64 time; | 32 | u64 time; |
| 32 | struct st_event_record *rec; | 33 | struct st_event_record *rec; |
| 33 | int find_release = 0; | 34 | int find_release = 0; |
| 35 | int show_count = 0; | ||
| 34 | int opt; | 36 | int opt; |
| 35 | 37 | ||
| 36 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | 38 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { |
| @@ -38,6 +40,9 @@ int main(int argc, char** argv) | |||
| 38 | case 'r': | 40 | case 'r': |
| 39 | find_release = 1; | 41 | find_release = 1; |
| 40 | break; | 42 | break; |
| 43 | case 'c': | ||
| 44 | show_count = 1; | ||
| 45 | break; | ||
| 41 | case ':': | 46 | case ':': |
| 42 | usage("Argument missing."); | 47 | usage("Argument missing."); |
| 43 | break; | 48 | break; |
| @@ -52,7 +57,7 @@ int main(int argc, char** argv) | |||
| 52 | h = load(argv + optind, argc - optind, &count); | 57 | h = load(argv + optind, argc - optind, &count); |
| 53 | if (!h) | 58 | if (!h) |
| 54 | return 1; | 59 | return 1; |
| 55 | if (!find_release) | 60 | if (show_count) |
| 56 | printf("Loaded %u events.\n", count); | 61 | printf("Loaded %u events.\n", count); |
| 57 | while ((hn = heap_take(earlier_event, h))) { | 62 | while ((hn = heap_take(earlier_event, h))) { |
| 58 | time = event_time(heap_node_value(hn)); | 63 | time = event_time(heap_node_value(hn)); |
