diff options
author | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-07 16:19:26 -0500 |
---|---|---|
committer | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-07 16:19:26 -0500 |
commit | 26c36cfaa22ce2c86084b5bdb8f94a6d831bae01 (patch) | |
tree | c86590ed930c464b7aafba997efca2fb20de2706 | |
parent | 9d7a60b58d0fbb48a5e3a0d868aa7e4ccd6ba24b (diff) |
rt-graph: BUGFIX first job #s were not displaying correctly
-rw-r--r-- | rt-graph.c | 4 | ||||
-rw-r--r-- | rt-plot-task.c | 40 | ||||
-rw-r--r-- | rt-plot-task.h | 4 |
3 files changed, 31 insertions, 17 deletions
@@ -65,6 +65,10 @@ int rt_graph_check_any(struct rt_graph_info *rtinfo, | |||
65 | struct format_field *field; | 65 | struct format_field *field; |
66 | 66 | ||
67 | eid = pevent_data_type(pevent, record); | 67 | eid = pevent_data_type(pevent, record); |
68 | |||
69 | if (eid == rtinfo->switch_away_id) | ||
70 | return 0; | ||
71 | |||
68 | key = get_event_hash_key(eid); | 72 | key = get_event_hash_key(eid); |
69 | field = find_ts_hash(rtinfo->events, key, eid); | 73 | field = find_ts_hash(rtinfo->events, key, eid); |
70 | 74 | ||
diff --git a/rt-plot-task.c b/rt-plot-task.c index c549e3c..cfe45f7 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
@@ -51,7 +51,7 @@ next_rts(struct graph_info *ginfo, int cpu, unsigned long long time) | |||
51 | static void set_cpu_to_time(int cpu, struct graph_info *ginfo, unsigned long long time) | 51 | static void set_cpu_to_time(int cpu, struct graph_info *ginfo, unsigned long long time) |
52 | { | 52 | { |
53 | struct record *record; | 53 | struct record *record; |
54 | unsigned long long rts, seek_time, last_seek; | 54 | unsigned long long last_rts, rts, seek_time, last_seek; |
55 | long long diff; | 55 | long long diff; |
56 | 56 | ||
57 | rts = next_rts(ginfo, cpu, time); | 57 | rts = next_rts(ginfo, cpu, time); |
@@ -70,9 +70,10 @@ static void set_cpu_to_time(int cpu, struct graph_info *ginfo, unsigned long lon | |||
70 | */ | 70 | */ |
71 | do { | 71 | do { |
72 | last_seek = seek_time; | 72 | last_seek = seek_time; |
73 | last_rts = rts; | ||
73 | seek_time = seek_time + 1.5 * (time - rts); | 74 | seek_time = seek_time + 1.5 * (time - rts); |
74 | rts = next_rts(ginfo, cpu, seek_time); | 75 | rts = next_rts(ginfo, cpu, seek_time); |
75 | } while (rts < time); | 76 | } while (rts < time && last_rts != rts); |
76 | tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, last_seek); | 77 | tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, last_seek); |
77 | seek_time = last_seek; | 78 | seek_time = last_seek; |
78 | } else if (rts && diff < 0) { | 79 | } else if (rts && diff < 0) { |
@@ -182,6 +183,7 @@ static int try_param(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
182 | rtt_info->period = period; | 183 | rtt_info->period = period; |
183 | rtt_info->params_found = TRUE; | 184 | rtt_info->params_found = TRUE; |
184 | ret = 1; | 185 | ret = 1; |
186 | rtt_info->first_rels[0] = get_rts(ginfo, record); | ||
185 | } | 187 | } |
186 | out: | 188 | out: |
187 | return ret; | 189 | return ret; |
@@ -207,6 +209,9 @@ static int try_release(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
207 | info->dtime = deadline; | 209 | info->dtime = deadline; |
208 | info->dlabel = rtt_info->label; | 210 | info->dlabel = rtt_info->label; |
209 | 211 | ||
212 | if (job <= 3) | ||
213 | rtt_info->first_rels[job - 1] = release; | ||
214 | |||
210 | ret = 1; | 215 | ret = 1; |
211 | } | 216 | } |
212 | return ret; | 217 | return ret; |
@@ -365,6 +370,7 @@ get_previous_release(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
365 | struct rt_graph_info *rtg_info = &ginfo->rtinfo; | 370 | struct rt_graph_info *rtg_info = &ginfo->rtinfo; |
366 | 371 | ||
367 | last_record = tracecmd_peek_data(ginfo->handle, cpu); | 372 | last_record = tracecmd_peek_data(ginfo->handle, cpu); |
373 | *out_job = *out_release = *out_deadline = 0; | ||
368 | if (!last_record) | 374 | if (!last_record) |
369 | return NULL; | 375 | return NULL; |
370 | last_record->ref_count++; | 376 | last_record->ref_count++; |
@@ -415,14 +421,22 @@ static int get_time_info(struct graph_info *ginfo, | |||
415 | struct offset_cache *offsets; | 421 | struct offset_cache *offsets; |
416 | 422 | ||
417 | /* Seek CPUs to first record after this time */ | 423 | /* Seek CPUs to first record after this time */ |
424 | *out_job = *out_release = *out_deadline = 0; | ||
418 | *out_record = find_record(ginfo, rtt_info->base.pid, time); | 425 | *out_record = find_record(ginfo, rtt_info->base.pid, time); |
419 | if (!*out_record) | 426 | if (!*out_record) |
427 | return 0; | ||
428 | |||
429 | /* This is not necessarily correct for sporadic, but will do for now */ | ||
430 | if (time < rtt_info->first_rels[2]) { | ||
431 | job = (time >= rtt_info->first_rels[1]) ? 2 : 1; | ||
432 | *out_job = job; | ||
433 | *out_release = rtt_info->first_rels[job - 1]; | ||
434 | *out_deadline = rtt_info->first_rels[job]; | ||
420 | goto out; | 435 | goto out; |
436 | } | ||
421 | 437 | ||
422 | min_ts = time - 2*rtt_info->wcet; | 438 | min_ts = time - 2*rtt_info->wcet; |
423 | *out_job = 0; | 439 | *out_job = *out_release = *out_deadline = 0; |
424 | *out_release = 0; | ||
425 | *out_deadline = 0; | ||
426 | 440 | ||
427 | offsets = save_offsets(ginfo); | 441 | offsets = save_offsets(ginfo); |
428 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { | 442 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { |
@@ -438,7 +452,7 @@ static int get_time_info(struct graph_info *ginfo, | |||
438 | } | 452 | } |
439 | restore_offsets(ginfo, offsets); | 453 | restore_offsets(ginfo, offsets); |
440 | out: | 454 | out: |
441 | return (min_ts == 0); | 455 | return 1; |
442 | } | 456 | } |
443 | 457 | ||
444 | static inline int in_res(struct graph_info *ginfo, unsigned long long time, | 458 | static inline int in_res(struct graph_info *ginfo, unsigned long long time, |
@@ -457,7 +471,6 @@ static int rt_task_plot_event(struct graph_info *ginfo, struct graph_plot *plot, | |||
457 | 471 | ||
458 | /* No more records, finish what we started */ | 472 | /* No more records, finish what we started */ |
459 | if (!record) { | 473 | if (!record) { |
460 | update_last_task_record(ginfo, task_info, record); | ||
461 | if (task_info->last_cpu >= 0) { | 474 | if (task_info->last_cpu >= 0) { |
462 | info->box = TRUE; | 475 | info->box = TRUE; |
463 | info->bstart = task_info->last_time; | 476 | info->bstart = task_info->last_time; |
@@ -496,8 +509,6 @@ static int rt_task_plot_event(struct graph_info *ginfo, struct graph_plot *plot, | |||
496 | free_record(task_info->last_records[cpu]); | 509 | free_record(task_info->last_records[cpu]); |
497 | task_info->last_records[cpu] = record; | 510 | task_info->last_records[cpu] = record; |
498 | } | 511 | } |
499 | } else { | ||
500 | update_last_task_record(ginfo, task_info, record); | ||
501 | } | 512 | } |
502 | 513 | ||
503 | return 1; | 514 | return 1; |
@@ -506,6 +517,7 @@ static int rt_task_plot_event(struct graph_info *ginfo, struct graph_plot *plot, | |||
506 | static void rt_task_plot_start(struct graph_info *ginfo, struct graph_plot *plot, | 517 | static void rt_task_plot_start(struct graph_info *ginfo, struct graph_plot *plot, |
507 | unsigned long long time) | 518 | unsigned long long time) |
508 | { | 519 | { |
520 | int i; | ||
509 | struct rt_task_info *rtt_info = plot->private; | 521 | struct rt_task_info *rtt_info = plot->private; |
510 | 522 | ||
511 | task_plot_start(ginfo, plot, time); | 523 | task_plot_start(ginfo, plot, time); |
@@ -517,6 +529,8 @@ static void rt_task_plot_start(struct graph_info *ginfo, struct graph_plot *plot | |||
517 | rtt_info->last_cpu = -1; | 529 | rtt_info->last_cpu = -1; |
518 | rtt_info->last_job = -1; | 530 | rtt_info->last_job = -1; |
519 | rtt_info->params_found = FALSE; | 531 | rtt_info->params_found = FALSE; |
532 | for (i = 0; i < 3; i++) | ||
533 | rtt_info->first_rels[i] = 0ULL; | ||
520 | update_job(rtt_info, 0); | 534 | update_job(rtt_info, 0); |
521 | } | 535 | } |
522 | 536 | ||
@@ -564,7 +578,7 @@ static int rt_task_plot_display_info(struct graph_info *ginfo, | |||
564 | unsigned long long time) | 578 | unsigned long long time) |
565 | { | 579 | { |
566 | const char *comm; | 580 | const char *comm; |
567 | int show_dead, show_rel, pid, job, eid; | 581 | int pid, job, eid; |
568 | struct record *record; | 582 | struct record *record; |
569 | struct event_format *event; | 583 | struct event_format *event; |
570 | unsigned long usec, sec; | 584 | unsigned long usec, sec; |
@@ -576,17 +590,11 @@ static int rt_task_plot_display_info(struct graph_info *ginfo, | |||
576 | get_time_info(ginfo, rtt_info, time, | 590 | get_time_info(ginfo, rtt_info, time, |
577 | &job, &release, &deadline, &record); | 591 | &job, &release, &deadline, &record); |
578 | restore_offsets(ginfo, offsets); | 592 | restore_offsets(ginfo, offsets); |
579 | show_rel = in_res(ginfo, release, time); | ||
580 | show_dead = in_res(ginfo, deadline, time); | ||
581 | 593 | ||
582 | /* Show real-time data about time */ | 594 | /* Show real-time data about time */ |
583 | pid = rtt_info->base.pid; | 595 | pid = rtt_info->base.pid; |
584 | comm = pevent_data_comm_from_pid(ginfo->pevent, pid); | 596 | comm = pevent_data_comm_from_pid(ginfo->pevent, pid); |
585 | trace_seq_printf(s, "%s - %d:%d\n", comm, pid, job); | 597 | trace_seq_printf(s, "%s - %d:%d\n", comm, pid, job); |
586 | if (show_rel) | ||
587 | trace_seq_printf(s, "RELEASE\n"); | ||
588 | if (show_dead) | ||
589 | trace_seq_printf(s, "DEADLINE\n"); | ||
590 | 598 | ||
591 | if (record) { | 599 | if (record) { |
592 | rts = get_rts(ginfo, record); | 600 | rts = get_rts(ginfo, record); |
diff --git a/rt-plot-task.h b/rt-plot-task.h index 7cdda67..a66de39 100644 --- a/rt-plot-task.h +++ b/rt-plot-task.h | |||
@@ -7,7 +7,6 @@ struct rt_task_info { | |||
7 | struct task_plot_info base; | 7 | struct task_plot_info base; |
8 | 8 | ||
9 | int pid; | 9 | int pid; |
10 | |||
11 | unsigned long long wcet; | 10 | unsigned long long wcet; |
12 | unsigned long long period; | 11 | unsigned long long period; |
13 | 12 | ||
@@ -17,6 +16,9 @@ struct rt_task_info { | |||
17 | int last_job; | 16 | int last_job; |
18 | int last_cpu; | 17 | int last_cpu; |
19 | 18 | ||
19 | /* Used to get around bugs(ish) */ | ||
20 | unsigned long long first_rels[3]; | ||
21 | |||
20 | gboolean params_found; | 22 | gboolean params_found; |
21 | char *label; | 23 | char *label; |
22 | }; | 24 | }; |