diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-15 17:18:01 -0400 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-15 17:18:01 -0400 |
| commit | 34c00c482f8d63af02784de9d376237611b42bfe (patch) | |
| tree | 4ecf10ace6253f848ee2a73a76bb9e79171164e3 /rt-plot-vcpu.c | |
| parent | 84c21bf0c89821bd35b035cd9f7f08acc13ea2dc (diff) | |
Diffstat (limited to 'rt-plot-vcpu.c')
| -rw-r--r-- | rt-plot-vcpu.c | 91 |
1 files changed, 53 insertions, 38 deletions
diff --git a/rt-plot-vcpu.c b/rt-plot-vcpu.c index b04bcfb..60b3d90 100644 --- a/rt-plot-vcpu.c +++ b/rt-plot-vcpu.c | |||
| @@ -43,13 +43,12 @@ static int | |||
| 43 | try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, | 43 | try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, |
| 44 | struct record *record, struct plot_info *info) | 44 | struct record *record, struct plot_info *info) |
| 45 | { | 45 | { |
| 46 | int job, sid, tid, tjob, match, ret = 0; | 46 | int job, sid, tid, tjob, cpu, match, ret = 0; |
| 47 | unsigned long long ts; | 47 | unsigned long long ts; |
| 48 | 48 | ||
| 49 | match = rt_graph_check_server_switch_away(ginfo, record, | 49 | match = rt_graph_check_server_switch_away(ginfo, record, |
| 50 | &sid, &job, | 50 | &sid, &job, |
| 51 | &tid, &tjob, &ts); | 51 | &tid, &tjob, &cpu, &ts); |
| 52 | |||
| 53 | if (match && sid == vcpu_info->sid) { | 52 | if (match && sid == vcpu_info->sid) { |
| 54 | /* This server is no longer running something */ | 53 | /* This server is no longer running something */ |
| 55 | update_task_label(vcpu_info, tid, tjob); | 54 | update_task_label(vcpu_info, tid, tjob); |
| @@ -76,28 +75,37 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, | |||
| 76 | 75 | ||
| 77 | ret = 1; | 76 | ret = 1; |
| 78 | } else if (vcpu_info->show_server && match && tid == vcpu_info->sid) { | 77 | } else if (vcpu_info->show_server && match && tid == vcpu_info->sid) { |
| 79 | /* This server is no longer running */ | 78 | info->box = TRUE; |
| 80 | update_server_label(vcpu_info, tjob); | 79 | info->bstart = vcpu_info->server_run_time; |
| 80 | info->bend = ts; | ||
| 81 | 81 | ||
| 82 | check_server(vcpu_info->server_running, vcpu_info, ts, | 82 | if (!sid) { |
| 83 | "stopped running when wasn't running"); | 83 | /* This server is leaving an undetermined state */ |
| 84 | check_server(!vcpu_info->task_running || vcpu_info->task_cpu == NO_CPU, | 84 | vcpu_info->server_run_time = ts; |
| 85 | vcpu_info, ts, "stopped running while a task is active"); | ||
| 86 | 85 | ||
| 87 | if (vcpu_info->server_run_time && vcpu_info->server_run_time < ts) { | 86 | if (vcpu_info->server_running) { |
| 88 | info->box = TRUE; | ||
| 89 | if (!sid) | ||
| 90 | info->bcolor = 0; | 87 | info->bcolor = 0; |
| 91 | else | 88 | info->bfill = TRUE; |
| 92 | info->bcolor = hash_cpu(sid - 1); | 89 | } else { |
| 93 | info->bfill = TRUE; | 90 | info->bcolor = hash_cpu(vcpu_info->server_cpu); |
| 94 | info->bstart = vcpu_info->server_run_time; | 91 | info->bfill = FALSE; |
| 95 | info->bend = ts; | 92 | } |
| 93 | } else { | ||
| 94 | /* This server is no longer running */ | ||
| 95 | update_server_label(vcpu_info, tjob); | ||
| 96 | |||
| 97 | /* This should always be true. It is drawn just to show | ||
| 98 | * when server state has broken | ||
| 99 | */ | ||
| 100 | info->bfill = (vcpu_info->server_running) ? TRUE : FALSE; | ||
| 101 | |||
| 102 | info->bcolor = hash_cpu(cpu); | ||
| 96 | info->blabel = vcpu_info->server_label; | 103 | info->blabel = vcpu_info->server_label; |
| 104 | |||
| 105 | vcpu_info->server_run_time = 0ULL; | ||
| 106 | vcpu_info->server_cpu = NO_CPU; | ||
| 107 | vcpu_info->server_running = FALSE; | ||
| 97 | } | 108 | } |
| 98 | vcpu_info->server_run_time = 0ULL; | ||
| 99 | vcpu_info->server_cpu = NO_CPU; | ||
| 100 | vcpu_info->server_running = FALSE; | ||
| 101 | 109 | ||
| 102 | ret = 1; | 110 | ret = 1; |
| 103 | } | 111 | } |
| @@ -105,11 +113,6 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, | |||
| 105 | if (ret) { | 113 | if (ret) { |
| 106 | dprintf(3, "VCPU Switch away tid: %d on %d:%d at %llu\n", | 114 | dprintf(3, "VCPU Switch away tid: %d on %d:%d at %llu\n", |
| 107 | tid, sid, job, ts); | 115 | tid, sid, job, ts); |
| 108 | |||
| 109 | vcpu_info->task_run_time = 0ULL; | ||
| 110 | vcpu_info->task_tid = -1; | ||
| 111 | vcpu_info->task_running = FALSE; | ||
| 112 | vcpu_info->task_cpu = NO_CPU; | ||
| 113 | } | 116 | } |
| 114 | 117 | ||
| 115 | return ret; | 118 | return ret; |
| @@ -118,11 +121,11 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, | |||
| 118 | static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, | 121 | static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, |
| 119 | struct record *record, struct plot_info *info) | 122 | struct record *record, struct plot_info *info) |
| 120 | { | 123 | { |
| 121 | int job, sid, tid, tjob, match, ret = 0; | 124 | int job, sid, tid, tjob, cpu, match, ret = 0; |
| 122 | unsigned long long ts; | 125 | unsigned long long ts; |
| 123 | 126 | ||
| 124 | match = rt_graph_check_server_switch_to(ginfo, record, | 127 | match = rt_graph_check_server_switch_to(ginfo, record, |
| 125 | &sid, &job, &tid, &tjob, &ts); | 128 | &sid, &job, &tid, &tjob, &cpu, &ts); |
| 126 | if (match && sid == vcpu_info->sid) { | 129 | if (match && sid == vcpu_info->sid) { |
| 127 | update_server_label(vcpu_info, job); | 130 | update_server_label(vcpu_info, job); |
| 128 | check_server(!vcpu_info->task_running || vcpu_info->task_cpu == NO_CPU, vcpu_info, ts, | 131 | check_server(!vcpu_info->task_running || vcpu_info->task_cpu == NO_CPU, vcpu_info, ts, |
| @@ -137,22 +140,33 @@ static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu | |||
| 137 | 140 | ||
| 138 | vcpu_info->task_run_time = ts; | 141 | vcpu_info->task_run_time = ts; |
| 139 | vcpu_info->task_cpu = sid; | 142 | vcpu_info->task_cpu = sid; |
| 140 | vcpu_info->server_cpu = record->cpu; | 143 | vcpu_info->server_cpu = cpu; |
| 141 | vcpu_info->task_tid = tid; | 144 | vcpu_info->task_tid = tid; |
| 142 | vcpu_info->task_running = TRUE; | 145 | vcpu_info->task_running = TRUE; |
| 143 | ret = 1; | 146 | ret = 1; |
| 144 | } else if (vcpu_info->show_server && match && tid == vcpu_info->sid) { | 147 | } else if (vcpu_info->show_server && match && tid == vcpu_info->sid) { |
| 145 | /* This server is now running */ | 148 | if (!sid) { |
| 146 | update_server_label(vcpu_info, tjob); | 149 | /* Server is now in an undetermined state */ |
| 150 | if (vcpu_info->server_running) { | ||
| 151 | info->box = TRUE; | ||
| 152 | info->bstart = vcpu_info->server_run_time; | ||
| 153 | info->bend = ts; | ||
| 154 | info->blabel = vcpu_info->server_label; | ||
| 155 | info->bfill = TRUE; | ||
| 156 | info->bcolor = hash_cpu(vcpu_info->server_cpu); | ||
| 157 | } | ||
| 158 | } else { | ||
| 159 | /* This server is now running */ | ||
| 160 | update_server_label(vcpu_info, tjob); | ||
| 147 | 161 | ||
| 148 | check_server(vcpu_info->spare || !vcpu_info->server_running || vcpu_info->server_cpu == NO_CPU, | ||
| 149 | vcpu_info, ts, "running server again on %d:%d, run: %d, cpu: %d", sid, job, vcpu_info->server_running, vcpu_info->server_cpu); | ||
| 150 | 162 | ||
| 151 | vcpu_info->spare = FALSE; | 163 | vcpu_info->server_running = TRUE; |
| 164 | vcpu_info->task_running = FALSE; | ||
| 165 | vcpu_info->task_run_time = ts; | ||
| 152 | 166 | ||
| 167 | } | ||
| 168 | vcpu_info->server_cpu = cpu; | ||
| 153 | vcpu_info->server_run_time = ts; | 169 | vcpu_info->server_run_time = ts; |
| 154 | vcpu_info->server_cpu = sid; | ||
| 155 | vcpu_info->server_running = TRUE; | ||
| 156 | ret = 1; | 170 | ret = 1; |
| 157 | } | 171 | } |
| 158 | 172 | ||
| @@ -196,7 +210,7 @@ static int try_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, | |||
| 196 | } | 210 | } |
| 197 | 211 | ||
| 198 | if (ret) { | 212 | if (ret) { |
| 199 | dprintf(3, "VCPU Switch away on VCPU %d for %d:%d at %llu\n", | 213 | dprintf(3, "Switch to on VCPU %d for %d:%d at %llu\n", |
| 200 | vcpu_info->sid, pid, job, ts); | 214 | vcpu_info->sid, pid, job, ts); |
| 201 | } | 215 | } |
| 202 | return ret; | 216 | return ret; |
| @@ -260,6 +274,7 @@ static int try_server_block(struct graph_info *ginfo, struct vcpu_info *vcpu_inf | |||
| 260 | vcpu_info->block_time = ts; | 274 | vcpu_info->block_time = ts; |
| 261 | vcpu_info->block_cpu = record->cpu; | 275 | vcpu_info->block_cpu = record->cpu; |
| 262 | vcpu_info->blocked = TRUE; | 276 | vcpu_info->blocked = TRUE; |
| 277 | vcpu_info->server_running = FALSE; | ||
| 263 | 278 | ||
| 264 | if (!ts) | 279 | if (!ts) |
| 265 | die("Initally no block time\n"); | 280 | die("Initally no block time\n"); |
| @@ -495,8 +510,8 @@ int rt_vcpu_plot_record_matches(struct rt_plot_common *rt, | |||
| 495 | unsigned long long dull; | 510 | unsigned long long dull; |
| 496 | 511 | ||
| 497 | #define ARG ginfo, record, &sid, &dint | 512 | #define ARG ginfo, record, &sid, &dint |
| 498 | match = rt_graph_check_server_switch_to(ARG, &dint, &dint, &dull) || | 513 | match = rt_graph_check_server_switch_to(ARG, &dint, &dint, &dint, &dull) || |
| 499 | rt_graph_check_server_switch_away(ARG,&dint, &dint, &dull) || | 514 | rt_graph_check_server_switch_away(ARG, &dint, &dint, &dint, &dull) || |
| 500 | rt_graph_check_server_completion(ARG, &dull) || | 515 | rt_graph_check_server_completion(ARG, &dull) || |
| 501 | rt_graph_check_server_release(ARG, &dull, &dull) || | 516 | rt_graph_check_server_release(ARG, &dull, &dull) || |
| 502 | rt_graph_check_switch_to(ARG, &dull) || | 517 | rt_graph_check_switch_to(ARG, &dull) || |
