diff options
author | ricardobtxr <ricardo.btxr@gmail.com> | 2019-05-23 23:00:43 -0400 |
---|---|---|
committer | Björn Brandenburg <bbb@mpi-sws.org> | 2019-06-03 06:22:31 -0400 |
commit | bea119e8503107b92aae3bd26f2ceac104f58293 (patch) | |
tree | 5fb5a1c50c0b4a3b65fce3b2539df3d8983dc23c | |
parent | 0a9701c7be2ef0256bb434d01a9261d9b345bdc6 (diff) |
Update ft2csv.c
Retrieve UNLOCK overheads when UNLOCK_START and UNLOCK_END records are interleaved by SCHED and SCHED2 records.
-rw-r--r-- | src/ft2csv.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/ft2csv.c b/src/ft2csv.c index 162db9a..8874533 100644 --- a/src/ft2csv.c +++ b/src/ft2csv.c | |||
@@ -32,6 +32,7 @@ | |||
32 | static int want_interleaved = 1; | 32 | static int want_interleaved = 1; |
33 | static int want_best_effort = 0; | 33 | static int want_best_effort = 0; |
34 | static int want_interrupted = 0; | 34 | static int want_interrupted = 0; |
35 | static int max_interleaved_skipped = 0; | ||
35 | static int find_by_pid = AUTO_SELECT; | 36 | static int find_by_pid = AUTO_SELECT; |
36 | 37 | ||
37 | /* discard samples from a specific CPU */ | 38 | /* discard samples from a specific CPU */ |
@@ -121,10 +122,12 @@ static struct timestamp* next_pid(struct timestamp* first, struct timestamp* end | |||
121 | { | 122 | { |
122 | struct timestamp* pos; | 123 | struct timestamp* pos; |
123 | uint32_t last_seqno = 0, next_seqno = 0; | 124 | uint32_t last_seqno = 0, next_seqno = 0; |
125 | int event_count = 0; | ||
124 | 126 | ||
125 | 127 | ||
126 | last_seqno = first->seq_no; | 128 | last_seqno = first->seq_no; |
127 | for (pos = first + 1; pos < end; pos++) { | 129 | for (pos = first + 1; pos < end; pos++) { |
130 | event_count = event_count + 1; | ||
128 | /* check for for holes in the sequence number */ | 131 | /* check for for holes in the sequence number */ |
129 | next_seqno = last_seqno + 1; | 132 | next_seqno = last_seqno + 1; |
130 | if (next_seqno != pos->seq_no) { | 133 | if (next_seqno != pos->seq_no) { |
@@ -150,10 +153,11 @@ static struct timestamp* next_pid(struct timestamp* first, struct timestamp* end | |||
150 | if (pos->event == id1 || pos->event == id2) | 153 | if (pos->event == id1 || pos->event == id2) |
151 | return pos; | 154 | return pos; |
152 | else | 155 | else |
153 | /* Don't allow unexpected IDs interleaved. | 156 | if (event_count > max_interleaved_skipped) |
154 | * Tasks are sequential, there shouldn't be | 157 | /* Don't allow unexpected IDs interleaved. |
155 | * anything else. */ | 158 | * Tasks are sequential, there shouldn't be |
156 | return NULL; | 159 | * anything else. */ |
160 | return NULL; | ||
157 | } | 161 | } |
158 | } | 162 | } |
159 | return NULL; | 163 | return NULL; |
@@ -262,7 +266,7 @@ static void find_event_by_pid(struct timestamp* first, struct timestamp* end) | |||
262 | int interrupted = 0; | 266 | int interrupted = 0; |
263 | 267 | ||
264 | /* special case: take suspensions into account */ | 268 | /* special case: take suspensions into account */ |
265 | if (first->event >= SUSPENSION_RANGE) { | 269 | if (first->event >= SUSPENSION_RANGE && max_interleaved_skipped == 0) { |
266 | second = accumulate_exec_time(first, end, | 270 | second = accumulate_exec_time(first, end, |
267 | first->event + 1, &exec_time, | 271 | first->event + 1, &exec_time, |
268 | &interrupted); | 272 | &interrupted); |
@@ -387,9 +391,11 @@ static void list_ids(struct timestamp* start, struct timestamp* end) | |||
387 | 391 | ||
388 | 392 | ||
389 | #define USAGE \ | 393 | #define USAGE \ |
390 | "Usage: ft2csv [-r] [-i] [-b] [-a CPU] [-o CPU] <event_name> <logfile> \n" \ | 394 | "Usage: ft2csv [-r] [-i] [-s NUM] [-b] [-a CPU] [-o CPU] <event_name> <logfile> \n" \ |
391 | " -i: ignore interleaved -- ignore samples if start " \ | 395 | " -i: ignore interleaved -- ignore samples if start " \ |
392 | "and end are non-consecutive\n" \ | 396 | "and end are non-consecutive\n" \ |
397 | " -s: max_interleaved_skipped -- maximum number of skipped interleaved samples. " \ | ||
398 | "must be used in conjunction with [-i] option \n" \ | ||
393 | " -b: best effort -- don't skip non-rt time stamps \n" \ | 399 | " -b: best effort -- don't skip non-rt time stamps \n" \ |
394 | " -r: raw binary format -- don't produce .csv output \n" \ | 400 | " -r: raw binary format -- don't produce .csv output \n" \ |
395 | " -a: avoid CPU -- skip samples from a specific CPU\n" \ | 401 | " -a: avoid CPU -- skip samples from a specific CPU\n" \ |
@@ -408,7 +414,7 @@ static void die(char* msg) | |||
408 | exit(1); | 414 | exit(1); |
409 | } | 415 | } |
410 | 416 | ||
411 | #define OPTS "ibra:o:pexhl" | 417 | #define OPTS "ibrs:a:o:pexhl" |
412 | 418 | ||
413 | int main(int argc, char** argv) | 419 | int main(int argc, char** argv) |
414 | { | 420 | { |
@@ -426,6 +432,11 @@ int main(int argc, char** argv) | |||
426 | want_interleaved = 0; | 432 | want_interleaved = 0; |
427 | fprintf(stderr, "Discarging interleaved samples.\n"); | 433 | fprintf(stderr, "Discarging interleaved samples.\n"); |
428 | break; | 434 | break; |
435 | case 's': | ||
436 | max_interleaved_skipped = atoi(optarg); | ||
437 | fprintf(stderr, "skipping up to %d interleaved samples.\n", | ||
438 | max_interleaved_skipped); | ||
439 | break; | ||
429 | case 'x': | 440 | case 'x': |
430 | want_interrupted = 1; | 441 | want_interrupted = 1; |
431 | fprintf(stderr, "Not filtering disturbed-by-interrupt samples.\n"); | 442 | fprintf(stderr, "Not filtering disturbed-by-interrupt samples.\n"); |