From 34c00c482f8d63af02784de9d376237611b42bfe Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Mon, 15 Oct 2012 17:18:01 -0400 Subject: Allow servers to run on a special NULL cpu. --- rt-graph.c | 8 +++-- rt-graph.h | 6 ++-- rt-plot-container.c | 4 +-- rt-plot-vcpu.c | 91 +++++++++++++++++++++++++++++++---------------------- 4 files changed, 65 insertions(+), 44 deletions(-) diff --git a/rt-graph.c b/rt-graph.c index f9abcef..b77f9ea 100644 --- a/rt-graph.c +++ b/rt-graph.c @@ -664,7 +664,7 @@ int rt_graph_check_server_param(struct graph_info *ginfo, struct record *record, int rt_graph_check_server_switch_to(struct graph_info *ginfo, struct record *record, gint *sid, gint *job, - gint *tid, gint *tjob, + gint *tid, gint *tjob, gint *cpu, unsigned long long *ts) { struct rt_graph_info *rtg_info = &ginfo->rtg_info; @@ -684,6 +684,7 @@ int rt_graph_check_server_switch_to(struct graph_info *ginfo, STORE_FIELD(rtg_info, event, sswitch_to, job); STORE_FIELD(rtg_info, event, sswitch_to, tid); STORE_FIELD(rtg_info, event, sswitch_to, tjob); + STORE_FIELD(rtg_info, event, sswitch_to, cpu); } id = pevent_data_type(pevent, record); @@ -692,6 +693,7 @@ int rt_graph_check_server_switch_to(struct graph_info *ginfo, LOAD_INT(rtg_info, record, sswitch_to, job, job); LOAD_INT(rtg_info, record, sswitch_to, tid, tid); LOAD_INT(rtg_info, record, sswitch_to, tjob, tjob); + LOAD_INT(rtg_info, record, sswitch_to, cpu, cpu); *ts = get_rts(ginfo, record); dprintf(3, "Read server_switch_to(job(%d, %d)): %d\n", @@ -709,7 +711,7 @@ int rt_graph_check_server_switch_to(struct graph_info *ginfo, int rt_graph_check_server_switch_away(struct graph_info *ginfo, struct record *record, gint *sid, gint *job, - gint *tid, gint *tjob, + gint *tid, gint *tjob, gint *cpu, unsigned long long *ts) { struct rt_graph_info *rtg_info = &ginfo->rtg_info; @@ -729,6 +731,7 @@ int rt_graph_check_server_switch_away(struct graph_info *ginfo, STORE_FIELD(rtg_info, event, sswitch_away, job); STORE_FIELD(rtg_info, event, sswitch_away, tid); STORE_FIELD(rtg_info, event, sswitch_away, tjob); + STORE_FIELD(rtg_info, event, sswitch_away, cpu); } id = pevent_data_type(pevent, record); @@ -737,6 +740,7 @@ int rt_graph_check_server_switch_away(struct graph_info *ginfo, LOAD_INT(rtg_info, record, sswitch_away, job, job); LOAD_INT(rtg_info, record, sswitch_away, tid, tid); LOAD_INT(rtg_info, record, sswitch_away, tjob, tjob); + LOAD_INT(rtg_info, record, sswitch_away, tjob, cpu); *ts = get_rts(ginfo, record); diff --git a/rt-graph.h b/rt-graph.h index f3a1705..91ce3c0 100644 --- a/rt-graph.h +++ b/rt-graph.h @@ -86,12 +86,14 @@ struct rt_graph_info { struct format_field *sswitch_to_job_field; struct format_field *sswitch_to_tid_field; struct format_field *sswitch_to_tjob_field; + struct format_field *sswitch_to_cpu_field; gint server_switch_away_id; struct format_field *sswitch_away_sid_field; struct format_field *sswitch_away_job_field; struct format_field *sswitch_away_tid_field; struct format_field *sswitch_away_tjob_field; + struct format_field *sswitch_away_cpu_field; gint server_release_id; struct format_field *srelease_sid_field; @@ -188,11 +190,11 @@ int rt_graph_check_server_param(struct graph_info *ginfo, struct record *record, unsigned long long *period); int rt_graph_check_server_switch_to(struct graph_info *ginfo, struct record *record, - gint *sid, gint *job, gint *tid, gint *tjob, + gint *sid, gint *job, gint *tid, gint *tjob, gint *cpu, unsigned long long *when); int rt_graph_check_server_switch_away(struct graph_info *ginfo, struct record *record, - gint *sid, gint *job, gint *tid, gint *tjob, + gint *sid, gint *job, gint *tid, gint *tjob, gint *cpu, unsigned long long *when); int rt_graph_check_server_release(struct graph_info *ginfo, struct record *record, diff --git a/rt-plot-container.c b/rt-plot-container.c index b21f9de..623c616 100644 --- a/rt-plot-container.c +++ b/rt-plot-container.c @@ -71,7 +71,7 @@ static inline void try_job_update(struct server_iter_args *args, int candidate) static int server_iterator(struct graph_info *ginfo, struct record *record, void *data) { - int sid, job, tid, tjob, match, ret; + int sid, job, tid, tjob, match, ret, cpu; struct server_iter_args *args = data; unsigned long long when, time = get_rts(ginfo, record); @@ -80,7 +80,7 @@ static int server_iterator(struct graph_info *ginfo, struct record *record, void if (time < args->goal) return 1; -#define ARGS ginfo, record, &sid, &job, &tid, &tjob, &when +#define ARGS ginfo, record, &sid, &job, &tid, &tjob, &cpu, &when match = rt_graph_check_server_switch_away(ARGS); if (match && sid == args->match_sid) { /* We were running something */ 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 try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, struct record *record, struct plot_info *info) { - int job, sid, tid, tjob, match, ret = 0; + int job, sid, tid, tjob, cpu, match, ret = 0; unsigned long long ts; match = rt_graph_check_server_switch_away(ginfo, record, &sid, &job, - &tid, &tjob, &ts); - + &tid, &tjob, &cpu, &ts); if (match && sid == vcpu_info->sid) { /* This server is no longer running something */ update_task_label(vcpu_info, tid, tjob); @@ -76,28 +75,37 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, ret = 1; } else if (vcpu_info->show_server && match && tid == vcpu_info->sid) { - /* This server is no longer running */ - update_server_label(vcpu_info, tjob); + info->box = TRUE; + info->bstart = vcpu_info->server_run_time; + info->bend = ts; - check_server(vcpu_info->server_running, vcpu_info, ts, - "stopped running when wasn't running"); - check_server(!vcpu_info->task_running || vcpu_info->task_cpu == NO_CPU, - vcpu_info, ts, "stopped running while a task is active"); + if (!sid) { + /* This server is leaving an undetermined state */ + vcpu_info->server_run_time = ts; - if (vcpu_info->server_run_time && vcpu_info->server_run_time < ts) { - info->box = TRUE; - if (!sid) + if (vcpu_info->server_running) { info->bcolor = 0; - else - info->bcolor = hash_cpu(sid - 1); - info->bfill = TRUE; - info->bstart = vcpu_info->server_run_time; - info->bend = ts; + info->bfill = TRUE; + } else { + info->bcolor = hash_cpu(vcpu_info->server_cpu); + info->bfill = FALSE; + } + } else { + /* This server is no longer running */ + update_server_label(vcpu_info, tjob); + + /* This should always be true. It is drawn just to show + * when server state has broken + */ + info->bfill = (vcpu_info->server_running) ? TRUE : FALSE; + + info->bcolor = hash_cpu(cpu); info->blabel = vcpu_info->server_label; + + vcpu_info->server_run_time = 0ULL; + vcpu_info->server_cpu = NO_CPU; + vcpu_info->server_running = FALSE; } - vcpu_info->server_run_time = 0ULL; - vcpu_info->server_cpu = NO_CPU; - vcpu_info->server_running = FALSE; ret = 1; } @@ -105,11 +113,6 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, if (ret) { dprintf(3, "VCPU Switch away tid: %d on %d:%d at %llu\n", tid, sid, job, ts); - - vcpu_info->task_run_time = 0ULL; - vcpu_info->task_tid = -1; - vcpu_info->task_running = FALSE; - vcpu_info->task_cpu = NO_CPU; } return ret; @@ -118,11 +121,11 @@ try_server_switch_away(struct graph_info *ginfo, struct vcpu_info *vcpu_info, static int try_server_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, struct record *record, struct plot_info *info) { - int job, sid, tid, tjob, match, ret = 0; + int job, sid, tid, tjob, cpu, match, ret = 0; unsigned long long ts; match = rt_graph_check_server_switch_to(ginfo, record, - &sid, &job, &tid, &tjob, &ts); + &sid, &job, &tid, &tjob, &cpu, &ts); if (match && sid == vcpu_info->sid) { update_server_label(vcpu_info, job); 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 vcpu_info->task_run_time = ts; vcpu_info->task_cpu = sid; - vcpu_info->server_cpu = record->cpu; + vcpu_info->server_cpu = cpu; vcpu_info->task_tid = tid; vcpu_info->task_running = TRUE; ret = 1; } else if (vcpu_info->show_server && match && tid == vcpu_info->sid) { - /* This server is now running */ - update_server_label(vcpu_info, tjob); + if (!sid) { + /* Server is now in an undetermined state */ + if (vcpu_info->server_running) { + info->box = TRUE; + info->bstart = vcpu_info->server_run_time; + info->bend = ts; + info->blabel = vcpu_info->server_label; + info->bfill = TRUE; + info->bcolor = hash_cpu(vcpu_info->server_cpu); + } + } else { + /* This server is now running */ + update_server_label(vcpu_info, tjob); - check_server(vcpu_info->spare || !vcpu_info->server_running || vcpu_info->server_cpu == NO_CPU, - vcpu_info, ts, "running server again on %d:%d, run: %d, cpu: %d", sid, job, vcpu_info->server_running, vcpu_info->server_cpu); - vcpu_info->spare = FALSE; + vcpu_info->server_running = TRUE; + vcpu_info->task_running = FALSE; + vcpu_info->task_run_time = ts; + } + vcpu_info->server_cpu = cpu; vcpu_info->server_run_time = ts; - vcpu_info->server_cpu = sid; - vcpu_info->server_running = TRUE; ret = 1; } @@ -196,7 +210,7 @@ static int try_switch_to(struct graph_info *ginfo, struct vcpu_info *vcpu_info, } if (ret) { - dprintf(3, "VCPU Switch away on VCPU %d for %d:%d at %llu\n", + dprintf(3, "Switch to on VCPU %d for %d:%d at %llu\n", vcpu_info->sid, pid, job, ts); } return ret; @@ -260,6 +274,7 @@ static int try_server_block(struct graph_info *ginfo, struct vcpu_info *vcpu_inf vcpu_info->block_time = ts; vcpu_info->block_cpu = record->cpu; vcpu_info->blocked = TRUE; + vcpu_info->server_running = FALSE; if (!ts) die("Initally no block time\n"); @@ -495,8 +510,8 @@ int rt_vcpu_plot_record_matches(struct rt_plot_common *rt, unsigned long long dull; #define ARG ginfo, record, &sid, &dint - match = rt_graph_check_server_switch_to(ARG, &dint, &dint, &dull) || - rt_graph_check_server_switch_away(ARG,&dint, &dint, &dull) || + match = rt_graph_check_server_switch_to(ARG, &dint, &dint, &dint, &dull) || + rt_graph_check_server_switch_away(ARG, &dint, &dint, &dint, &dull) || rt_graph_check_server_completion(ARG, &dull) || rt_graph_check_server_release(ARG, &dull, &dull) || rt_graph_check_switch_to(ARG, &dull) || -- cgit v1.2.2