diff options
-rw-r--r-- | include/timestamp.h | 5 | ||||
-rw-r--r-- | src/ft2csv.c | 25 | ||||
-rw-r--r-- | src/ftdump.c | 10 | ||||
-rw-r--r-- | src/timestamp.c | 13 |
4 files changed, 47 insertions, 6 deletions
diff --git a/include/timestamp.h b/include/timestamp.h index 46fd8bd..0a269ab 100644 --- a/include/timestamp.h +++ b/include/timestamp.h | |||
@@ -21,6 +21,7 @@ typedef uint32_t cmd_t; | |||
21 | 21 | ||
22 | int str2event(const char* str, cmd_t *id); | 22 | int str2event(const char* str, cmd_t *id); |
23 | const char* event2str(cmd_t id); | 23 | const char* event2str(cmd_t id); |
24 | const char* task_type2str(int task_type); | ||
24 | 25 | ||
25 | #define ENABLE_CMD 0L | 26 | #define ENABLE_CMD 0L |
26 | #define DISABLE_CMD 1L | 27 | #define DISABLE_CMD 1L |
@@ -50,6 +51,8 @@ const char* event2str(cmd_t id); | |||
50 | #define TS_SEND_RESCHED_START TIMESTAMP(190) | 51 | #define TS_SEND_RESCHED_START TIMESTAMP(190) |
51 | #define TS_SEND_RESCHED_END TIMESTAMP(191) | 52 | #define TS_SEND_RESCHED_END TIMESTAMP(191) |
52 | 53 | ||
53 | #define TS_RELEASE_LATENCY TIMESTAMP(2000) | 54 | #define SINGLE_RECORDS_RANGE 200 |
55 | |||
56 | #define TS_RELEASE_LATENCY TIMESTAMP(208) | ||
54 | 57 | ||
55 | #endif | 58 | #endif |
diff --git a/src/ft2csv.c b/src/ft2csv.c index cc6636f..0df45ce 100644 --- a/src/ft2csv.c +++ b/src/ft2csv.c | |||
@@ -39,7 +39,7 @@ static unsigned int interleaved = 0; | |||
39 | 39 | ||
40 | #define CYCLES_PER_US 2128 | 40 | #define CYCLES_PER_US 2128 |
41 | 41 | ||
42 | static unsigned long long threshold = CYCLES_PER_US * 1000; /* 1 ms == 1 full tick */ | 42 | static unsigned long long threshold = CYCLES_PER_US * 10000; /* 10 ms == 10 full ticks */ |
43 | 43 | ||
44 | static struct timestamp* next(struct timestamp* start, struct timestamp* end, | 44 | static struct timestamp* next(struct timestamp* start, struct timestamp* end, |
45 | int cpu) | 45 | int cpu) |
@@ -100,7 +100,16 @@ static void show_csv(struct timestamp* first, struct timestamp *end) | |||
100 | } | 100 | } |
101 | } else | 101 | } else |
102 | incomplete++; | 102 | incomplete++; |
103 | } | ||
103 | 104 | ||
105 | static void show_single_csv(struct timestamp* ts) | ||
106 | { | ||
107 | if (ts->task_type == TSK_RT) { | ||
108 | printf("0, 0, %llu\n", | ||
109 | (unsigned long long) (ts->timestamp)); | ||
110 | complete++; | ||
111 | } else | ||
112 | non_rt++; | ||
104 | } | 113 | } |
105 | 114 | ||
106 | static inline uint64_t bget(int x, uint64_t quad) | 115 | static inline uint64_t bget(int x, uint64_t quad) |
@@ -145,6 +154,14 @@ static void show_id(struct timestamp* start, struct timestamp* end, | |||
145 | show_csv(start, end); | 154 | show_csv(start, end); |
146 | } | 155 | } |
147 | 156 | ||
157 | static void show_single_records(struct timestamp* start, struct timestamp* end, | ||
158 | unsigned long id) | ||
159 | { | ||
160 | for (; start != end; start++) | ||
161 | if (start->event == id) | ||
162 | show_single_csv(start); | ||
163 | } | ||
164 | |||
148 | #define USAGE \ | 165 | #define USAGE \ |
149 | "Usage: ft2csv [-e] [-i] [-b] <event_name> <logfile> \n" \ | 166 | "Usage: ft2csv [-e] [-i] [-b] <event_name> <logfile> \n" \ |
150 | " -e: endianess swap -- restores byte order \n" \ | 167 | " -e: endianess swap -- restores byte order \n" \ |
@@ -210,7 +227,11 @@ int main(int argc, char** argv) | |||
210 | 227 | ||
211 | if (swap_byte_order) | 228 | if (swap_byte_order) |
212 | restore_byte_order(ts, end); | 229 | restore_byte_order(ts, end); |
213 | show_id(ts, end, id); | 230 | |
231 | if (id >= SINGLE_RECORDS_RANGE) | ||
232 | show_single_records(ts, end, id); | ||
233 | else | ||
234 | show_id(ts, end, id); | ||
214 | 235 | ||
215 | fprintf(stderr, | 236 | fprintf(stderr, |
216 | "Total : %10d\n" | 237 | "Total : %10d\n" |
diff --git a/src/ftdump.c b/src/ftdump.c index 599473b..e7b5064 100644 --- a/src/ftdump.c +++ b/src/ftdump.c | |||
@@ -29,10 +29,16 @@ | |||
29 | static void dump(struct timestamp* ts, size_t count) | 29 | static void dump(struct timestamp* ts, size_t count) |
30 | { | 30 | { |
31 | struct timestamp *x; | 31 | struct timestamp *x; |
32 | const char* name; | ||
32 | while (count--) { | 33 | while (count--) { |
33 | x = ts++; | 34 | x = ts++; |
34 | printf("event:%d seq:%u cpu:%d type:%d\n", | 35 | name = event2str(x->event); |
35 | (int) x->event, x->seq_no, x->cpu, x->task_type); | 36 | if (name) |
37 | printf("%-15s %-8s seq:%u cpu:%d timestamp:%llu\n", | ||
38 | name, task_type2str(x->task_type), x->seq_no, x->cpu, x->timestamp); | ||
39 | else | ||
40 | printf("event:%d seq:%u cpu:%d type:%s\n", | ||
41 | (int) x->event, x->seq_no, x->cpu, task_type2str(x->task_type)); | ||
36 | } | 42 | } |
37 | } | 43 | } |
38 | 44 | ||
diff --git a/src/timestamp.c b/src/timestamp.c index f597b87..34ad448 100644 --- a/src/timestamp.c +++ b/src/timestamp.c | |||
@@ -29,11 +29,12 @@ int str2event(const char* str, cmd_t *id) | |||
29 | { | 29 | { |
30 | int i; | 30 | int i; |
31 | 31 | ||
32 | for (i = 0; i < sizeof(event_table) / sizeof(event_table[0]); i++) | 32 | for (i = 0; i < sizeof(event_table) / sizeof(event_table[0]); i++) { |
33 | if (!strcmp(str, event_table[i].name)) { | 33 | if (!strcmp(str, event_table[i].name)) { |
34 | *id = event_table[i].id; | 34 | *id = event_table[i].id; |
35 | return 1; | 35 | return 1; |
36 | } | 36 | } |
37 | } | ||
37 | /* try to parse it as a number */ | 38 | /* try to parse it as a number */ |
38 | return sscanf(str, "%u", id); | 39 | return sscanf(str, "%u", id); |
39 | } | 40 | } |
@@ -48,3 +49,13 @@ const char* event2str(cmd_t id) | |||
48 | 49 | ||
49 | return NULL; | 50 | return NULL; |
50 | } | 51 | } |
52 | |||
53 | const char* task_type2str(int task_type) | ||
54 | { | ||
55 | if (task_type == TSK_RT) | ||
56 | return "RT"; | ||
57 | else if (task_type == TSK_BE) | ||
58 | return "BE"; | ||
59 | else | ||
60 | return "UNKNOWN"; | ||
61 | } | ||