diff options
| author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-05-16 23:34:48 -0400 |
|---|---|---|
| committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-05-16 23:34:48 -0400 |
| commit | b9d10e7b98274fccc7149366e9c6caa3c85a5b08 (patch) | |
| tree | 6bdcdc953d27cbf3fc2de3e41c43e1a9ffa558bb /src | |
| parent | 4d337d4d7a3c1e6a65b090251c4e41592740b0d0 (diff) | |
Added filtering.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ft2csv.c | 17 | ||||
| -rw-r--r-- | src/timestamp.c | 15 |
2 files changed, 26 insertions, 6 deletions
diff --git a/src/ft2csv.c b/src/ft2csv.c index a5fdf0a..dc5753b 100644 --- a/src/ft2csv.c +++ b/src/ft2csv.c | |||
| @@ -8,6 +8,9 @@ | |||
| 8 | #include "timestamp.h" | 8 | #include "timestamp.h" |
| 9 | 9 | ||
| 10 | static unsigned int incomplete = 0; | 10 | static unsigned int incomplete = 0; |
| 11 | static unsigned int filtered = 0; | ||
| 12 | |||
| 13 | static unsigned long long threshold = 2700 * 100; | ||
| 11 | 14 | ||
| 12 | static struct timestamp* next(struct timestamp** pos, size_t* count, int cpu) | 15 | static struct timestamp* next(struct timestamp** pos, size_t* count, int cpu) |
| 13 | { | 16 | { |
| @@ -41,9 +44,12 @@ static void show_csv(struct timestamp* ts, size_t count) | |||
| 41 | struct timestamp* stop; | 44 | struct timestamp* stop; |
| 42 | 45 | ||
| 43 | if (find_pair(start, &stop, count)) { | 46 | if (find_pair(start, &stop, count)) { |
| 44 | printf("%llu, %llu, %llu\n", | 47 | if (stop->timestamp - start->timestamp > threshold) |
| 45 | start->timestamp, stop->timestamp, | 48 | filtered++; |
| 46 | stop->timestamp - start->timestamp); | 49 | else |
| 50 | printf("%llu, %llu, %llu\n", | ||
| 51 | start->timestamp, stop->timestamp, | ||
| 52 | stop->timestamp - start->timestamp); | ||
| 47 | } else | 53 | } else |
| 48 | incomplete++; | 54 | incomplete++; |
| 49 | 55 | ||
| @@ -111,7 +117,10 @@ int main(int argc, char** argv) | |||
| 111 | 117 | ||
| 112 | show_id(ts, count, id); | 118 | show_id(ts, count, id); |
| 113 | 119 | ||
| 114 | fprintf(stderr, "Incomplete: %d\n", incomplete); | 120 | fprintf(stderr, |
| 121 | "Incomplete: %d\n" | ||
| 122 | "Filtered : %d\n", | ||
| 123 | incomplete, filtered); | ||
| 115 | 124 | ||
| 116 | return 0; | 125 | return 0; |
| 117 | } | 126 | } |
diff --git a/src/timestamp.c b/src/timestamp.c index 850e437..b787bbd 100644 --- a/src/timestamp.c +++ b/src/timestamp.c | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #include "timestamp.h" | 3 | #include "timestamp.h" |
| 4 | 4 | ||
| 5 | |||
| 6 | struct event_name { | 5 | struct event_name { |
| 7 | const char* name; | 6 | const char* name; |
| 8 | unsigned long id; | 7 | unsigned long id; |
| @@ -15,7 +14,8 @@ static struct event_name event_table[] = | |||
| 15 | EVENT(SCHED), | 14 | EVENT(SCHED), |
| 16 | EVENT(TICK), | 15 | EVENT(TICK), |
| 17 | EVENT(PLUGIN_SCHED), | 16 | EVENT(PLUGIN_SCHED), |
| 18 | EVENT(PLUGIN_TICK) | 17 | EVENT(PLUGIN_TICK), |
| 18 | EVENT(CXS) | ||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | int str2event(const char* str, unsigned long *id) | 21 | int str2event(const char* str, unsigned long *id) |
| @@ -29,3 +29,14 @@ int str2event(const char* str, unsigned long *id) | |||
| 29 | } | 29 | } |
| 30 | return 0; | 30 | return 0; |
| 31 | } | 31 | } |
| 32 | |||
| 33 | const char* event2str(unsigned long id) | ||
| 34 | { | ||
| 35 | int i; | ||
| 36 | |||
| 37 | for (i = 0; i < sizeof(event_table) / sizeof(event_table[0]); i++) | ||
| 38 | if (event_table[i].id == id) | ||
| 39 | return event_table[i].name; | ||
| 40 | |||
| 41 | return NULL; | ||
| 42 | } | ||
