aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/timestamp.h9
-rw-r--r--src/ftdump.c16
2 files changed, 17 insertions, 8 deletions
diff --git a/include/timestamp.h b/include/timestamp.h
index 57fd0bc..b3b10ce 100644
--- a/include/timestamp.h
+++ b/include/timestamp.h
@@ -9,8 +9,15 @@ enum task_type_marker {
9 TSK_UNKNOWN 9 TSK_UNKNOWN
10}; 10};
11 11
12/* Note: bitfields are highly non-portable (allocation is completely
13 * implementation-defined). Make sure you use the *same* compiler as the one
14 * used for the kernel itself (this works with gcc in practice, but is not
15 * *guaranteed* to work). Patches to get rid of the bitfields (without
16 * enlarging the structure) are highly welcome.
17 */
12struct timestamp { 18struct timestamp {
13 uint64_t timestamp; 19 uint64_t timestamp:48;
20 uint64_t pid:16;
14 uint32_t seq_no; 21 uint32_t seq_no;
15 uint8_t cpu; 22 uint8_t cpu;
16 uint8_t event; 23 uint8_t event;
diff --git a/src/ftdump.c b/src/ftdump.c
index 1462c4d..1e4bc12 100644
--- a/src/ftdump.c
+++ b/src/ftdump.c
@@ -29,26 +29,30 @@
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 unsigned int last_seq = 0; 32 uint32_t last_seq = 0, next_seq;
33 const char* name; 33 const char* name;
34 while (count--) { 34 while (count--) {
35 x = ts++; 35 x = ts++;
36 name = event2str(x->event); 36 name = event2str(x->event);
37 if (last_seq && last_seq + 1 != x->seq_no) 37 next_seq = last_seq + 1;
38 if (last_seq && next_seq != x->seq_no)
38 printf("==== non-consecutive sequence number ====\n"); 39 printf("==== non-consecutive sequence number ====\n");
39 last_seq = x->seq_no; 40 last_seq = x->seq_no;
40 if (name) 41 if (name)
41 printf("%-20s seq:%u timestamp:%llu cpu:%d type:%-8s irq:%u irqc:%02u \n", 42 printf("%-20s seq:%u pid:%u timestamp:%llu cpu:%d"
43 " type:%-8s irq:%u irqc:%02u \n",
42 name, x->seq_no, 44 name, x->seq_no,
45 x->pid,
43 (unsigned long long) x->timestamp, 46 (unsigned long long) x->timestamp,
44 x->cpu, 47 x->cpu,
45 task_type2str(x->task_type), 48 task_type2str(x->task_type),
46 x->irq_flag, 49 x->irq_flag,
47 x->irq_count); 50 x->irq_count);
48 else 51 else
49 printf("%16s:%3u seq:%u timestamp:%llu cpu:%u type:%-8s irq:%u irqc:%02u\n", 52 printf("%16s:%3u seq:%u pid:%u timestamp:%llu cpu:%u"
53 " type:%-8s irq:%u irqc:%02u\n",
50 "event", 54 "event",
51 (unsigned int) x->event, x->seq_no, 55 (unsigned int) x->event, x->seq_no, x->pid,
52 (unsigned long long) x->timestamp, 56 (unsigned long long) x->timestamp,
53 x->cpu, 57 x->cpu,
54 task_type2str(x->task_type), 58 task_type2str(x->task_type),
@@ -75,12 +79,10 @@ int main(int argc, char** argv)
75 79
76 printf("struct timestamp:\n" 80 printf("struct timestamp:\n"
77 "\t size = %3lu\n" 81 "\t size = %3lu\n"
78 "\t offset(timestamp) = %3lu\n"
79 "\t offset(seq_no) = %3lu\n" 82 "\t offset(seq_no) = %3lu\n"
80 "\t offset(cpu) = %3lu\n" 83 "\t offset(cpu) = %3lu\n"
81 "\t offset(event) = %3lu\n", 84 "\t offset(event) = %3lu\n",
82 (unsigned long) sizeof(struct timestamp), 85 (unsigned long) sizeof(struct timestamp),
83 offset(struct timestamp, timestamp),
84 offset(struct timestamp, seq_no), 86 offset(struct timestamp, seq_no),
85 offset(struct timestamp, cpu), 87 offset(struct timestamp, cpu),
86 offset(struct timestamp, event)); 88 offset(struct timestamp, event));