aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft2csv.c25
-rw-r--r--src/ftdump.c10
-rw-r--r--src/timestamp.c13
3 files changed, 43 insertions, 5 deletions
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
42static unsigned long long threshold = CYCLES_PER_US * 1000; /* 1 ms == 1 full tick */ 42static unsigned long long threshold = CYCLES_PER_US * 10000; /* 10 ms == 10 full ticks */
43 43
44static struct timestamp* next(struct timestamp* start, struct timestamp* end, 44static 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
105static 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
106static inline uint64_t bget(int x, uint64_t quad) 115static 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
157static 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 @@
29static void dump(struct timestamp* ts, size_t count) 29static 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
53const 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}