From 7bd8f960f81394bdd335c19c17129c8a11bfdc31 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 20 Oct 2021 18:33:54 +0200 Subject: [PATCH] Implement flushing events in the emulator --- cfg/cpu-flushing.cfg | 43 +++++++++++++++++++++++++++++++++++++++++ cfg/thread-flushing.cfg | 43 +++++++++++++++++++++++++++++++++++++++++ emu.h | 6 ++++++ emu_ovni.c | 27 ++++++++++++++++++++++++++ pcf.c | 23 ++++++++++++++++++++++ 5 files changed, 142 insertions(+) create mode 100644 cfg/cpu-flushing.cfg create mode 100644 cfg/thread-flushing.cfg diff --git a/cfg/cpu-flushing.cfg b/cfg/cpu-flushing.cfg new file mode 100644 index 0000000..b9bb038 --- /dev/null +++ b/cfg/cpu-flushing.cfg @@ -0,0 +1,43 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW CPU: Flushing state of the RUNNING thread > +################################################################################ +window_name CPU: Flushing state of the RUNNING thread +window_type single +window_id 1 +window_position_x 409 +window_position_y 444 +window_width 954 +window_height 123 +window_comm_lines_enabled true +window_flags_enabled false +window_noncolor_mode true +window_logical_filtered true +window_physical_filtered false +window_comm_fromto true +window_comm_tagsize true +window_comm_typeval true +window_units Microseconds +window_maximum_y 777.000000000000 +window_minimum_y 1.000000000000 +window_compute_y_max false +window_level thread +window_scale_relative 0.000061436799 +window_end_time_relative 0.000061436799 +window_object appl { 1, { All } } +window_begin_time_relative 0.000059269716 +window_open true +window_drawmode draw_randnotzero +window_drawmode_rows draw_randnotzero +window_pixel_size 1 +window_labels_to_draw 1 +window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } } +window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } } +window_filter_module evt_type 1 66 +window_filter_module evt_type_label 1 "CPU: Flusing state of the RUNNING thread" +window_synchronize 1 + diff --git a/cfg/thread-flushing.cfg b/cfg/thread-flushing.cfg new file mode 100644 index 0000000..eb01334 --- /dev/null +++ b/cfg/thread-flushing.cfg @@ -0,0 +1,43 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW Thread: Flushing state of the CURRENT thread > +################################################################################ +window_name Thread: Flushing state of the CURRENT thread +window_type single +window_id 1 +window_position_x 960 +window_position_y 550 +window_width 954 +window_height 236 +window_comm_lines_enabled true +window_flags_enabled true +window_noncolor_mode true +window_logical_filtered true +window_physical_filtered false +window_comm_fromto true +window_comm_tagsize true +window_comm_typeval true +window_units Microseconds +window_maximum_y 1.000000000000 +window_minimum_y 1.000000000000 +window_compute_y_max false +window_level thread +window_scale_relative 1.000000000000 +window_end_time_relative 1.000000000000 +window_object appl { 1, { All } } +window_begin_time_relative 0.000000000000 +window_open true +window_drawmode draw_randnotzero +window_drawmode_rows draw_randnotzero +window_pixel_size 1 +window_labels_to_draw 1 +window_selected_functions { 14, { {cpu, Active Thd}, {appl, Adding}, {task, Adding}, {thread, Last Evt Val}, {node, Adding}, {system, Adding}, {workload, Adding}, {from_obj, All}, {to_obj, All}, {tag_msg, All}, {size_msg, All}, {bw_msg, All}, {evt_type, =}, {evt_value, All} } } +window_compose_functions { 9, { {compose_cpu, As Is}, {compose_appl, As Is}, {compose_task, As Is}, {compose_thread, As Is}, {compose_node, As Is}, {compose_system, As Is}, {compose_workload, As Is}, {topcompose1, As Is}, {topcompose2, As Is} } } +window_filter_module evt_type 1 16 +window_filter_module evt_type_label 1 "Thread: Flushing state of the CURRENT thread" +window_synchronize 1 + diff --git a/emu.h b/emu.h index 41f6b1b..3e23bae 100644 --- a/emu.h +++ b/emu.h @@ -38,6 +38,10 @@ enum nosv_task_state { TASK_ST_DEAD, }; +enum ovni_state { + ST_OVNI_FLUSHING = 1, +}; + enum error_values { ST_BAD = 666, ST_TOO_MANY_TH = 777, @@ -115,6 +119,7 @@ enum chan { CHAN_OVNI_STATE, CHAN_OVNI_APPID, CHAN_OVNI_CPU, + CHAN_OVNI_FLUSH, CHAN_NOSV_TASKID, CHAN_NOSV_TYPEID, @@ -142,6 +147,7 @@ static const int chan_to_prvtype[CHAN_MAX][3] = { { CHAN_OVNI_STATE, 13, -1 }, { CHAN_OVNI_APPID, 14, 64 }, /* Not used */ { CHAN_OVNI_CPU, 15, -1 }, + { CHAN_OVNI_FLUSH, 16, 66 }, { CHAN_NOSV_TASKID, 20, 70 }, { CHAN_NOSV_TYPEID, 21, 71 }, diff --git a/emu_ovni.c b/emu_ovni.c index 295128e..afa1330 100644 --- a/emu_ovni.c +++ b/emu_ovni.c @@ -36,6 +36,7 @@ hook_init_ovni(struct ovni_emu *emu) chan_th_init(th, uth, CHAN_OVNI_PID, CHAN_TRACK_TH_RUNNING, th->proc->pid, 0, 1, row, prv_th, clock); chan_th_init(th, uth, CHAN_OVNI_CPU, CHAN_TRACK_NONE, -1, 0, 1, row, prv_th, clock); chan_th_init(th, uth, CHAN_OVNI_STATE, CHAN_TRACK_NONE, TH_ST_UNKNOWN, 1, 1, row, prv_th, clock); + chan_th_init(th, uth, CHAN_OVNI_FLUSH, CHAN_TRACK_NONE, ST_NULL, 1, 1, row, prv_th, clock); } /* Init the ovni channels in all cpus */ @@ -48,6 +49,7 @@ hook_init_ovni(struct ovni_emu *emu) chan_cpu_init(cpu, ucpu, CHAN_OVNI_TID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); chan_cpu_init(cpu, ucpu, CHAN_OVNI_PID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); chan_cpu_init(cpu, ucpu, CHAN_OVNI_NRTHREADS, CHAN_TRACK_NONE, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_OVNI_FLUSH, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); /* FIXME: Use extended initialization for CPUs too */ chan_enable(&cpu->chan[CHAN_OVNI_TID], 1); @@ -536,6 +538,30 @@ pre_burst(struct ovni_emu *emu) th->nbursts++; } +static void +pre_flush(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + struct ovni_chan *chan_th; + + th = emu->cur_thread; + chan_th = &th->chan[CHAN_OVNI_FLUSH]; + + switch(emu->cur_ev->header.value) + { + case '[': + chan_push(chan_th, ST_OVNI_FLUSHING); + break; + case ']': + chan_pop(chan_th, ST_OVNI_FLUSHING); + break; + default: + err("unexpected value '%c' (expecting '[' or ']')\n", + emu->cur_ev->header.value); + abort(); + } +} + void hook_pre_ovni(struct ovni_emu *emu) { @@ -549,6 +575,7 @@ hook_pre_ovni(struct ovni_emu *emu) case 'H': pre_thread(emu); break; case 'A': pre_affinity(emu); break; case 'B': pre_burst(emu); break; + case 'F': pre_flush(emu); break; default: dbg("unknown ovni event category %c\n", emu->cur_ev->header.category); diff --git a/pcf.c b/pcf.c index 36cf05e..a382ef5 100644 --- a/pcf.c +++ b/pcf.c @@ -176,6 +176,27 @@ struct event_type thread_cpu_affinity = { /* Ignored */ NULL }; +/* ---------------- CHAN_OVNI_FLUSH ---------------- */ + +struct event_value ovni_flush_values[] = { + { 0, "None" }, + { ST_OVNI_FLUSHING, "Flushing" }, + { ST_TOO_MANY_TH, "Unknown flushing state: Multiple threads running" }, + { -1, NULL }, +}; + +struct event_type thread_ovni_flush = { + 0, chan_to_prvtype[CHAN_OVNI_FLUSH][CHAN_TH], + "Thread: Flushing state of the CURRENT thread", + ovni_flush_values +}; + +struct event_type cpu_ovni_flush = { + 0, chan_to_prvtype[CHAN_OVNI_FLUSH][CHAN_CPU], + "CPU: Flusing state of the RUNNING thread", + ovni_flush_values +}; + /* ---------------- CHAN_NOSV_TASKID ---------------- */ struct event_value nosv_taskid_values[] = { @@ -402,6 +423,7 @@ write_events(FILE *f, struct ovni_emu *emu) /* thread_ovni_nthreads not needed */ write_event_type(f, &thread_ovni_state); /* thread_ovni_appid not needed */ + write_event_type(f, &thread_ovni_flush); write_event_type(f, &thread_nosv_taskid); write_event_type(f, &thread_nosv_typeid); write_event_type(f, &thread_nosv_appid); @@ -416,6 +438,7 @@ write_events(FILE *f, struct ovni_emu *emu) /* cpu_ovni_state not needed */ /* cpu_ovni_appid not needed */ /* cpu_ovni_cpu not needed */ + write_event_type(f, &cpu_ovni_flush); write_event_type(f, &cpu_nosv_taskid); write_event_type(f, &cpu_nosv_typeid); write_event_type(f, &cpu_nosv_appid);