Implement flushing events in the emulator

This commit is contained in:
Rodrigo Arias 2021-10-20 18:33:54 +02:00
parent 2f565450ea
commit 7bd8f960f8
5 changed files with 142 additions and 0 deletions

43
cfg/cpu-flushing.cfg Normal file
View File

@ -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

43
cfg/thread-flushing.cfg Normal file
View File

@ -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

6
emu.h
View File

@ -38,6 +38,10 @@ enum nosv_task_state {
TASK_ST_DEAD, TASK_ST_DEAD,
}; };
enum ovni_state {
ST_OVNI_FLUSHING = 1,
};
enum error_values { enum error_values {
ST_BAD = 666, ST_BAD = 666,
ST_TOO_MANY_TH = 777, ST_TOO_MANY_TH = 777,
@ -115,6 +119,7 @@ enum chan {
CHAN_OVNI_STATE, CHAN_OVNI_STATE,
CHAN_OVNI_APPID, CHAN_OVNI_APPID,
CHAN_OVNI_CPU, CHAN_OVNI_CPU,
CHAN_OVNI_FLUSH,
CHAN_NOSV_TASKID, CHAN_NOSV_TASKID,
CHAN_NOSV_TYPEID, CHAN_NOSV_TYPEID,
@ -142,6 +147,7 @@ static const int chan_to_prvtype[CHAN_MAX][3] = {
{ CHAN_OVNI_STATE, 13, -1 }, { CHAN_OVNI_STATE, 13, -1 },
{ CHAN_OVNI_APPID, 14, 64 }, /* Not used */ { CHAN_OVNI_APPID, 14, 64 }, /* Not used */
{ CHAN_OVNI_CPU, 15, -1 }, { CHAN_OVNI_CPU, 15, -1 },
{ CHAN_OVNI_FLUSH, 16, 66 },
{ CHAN_NOSV_TASKID, 20, 70 }, { CHAN_NOSV_TASKID, 20, 70 },
{ CHAN_NOSV_TYPEID, 21, 71 }, { CHAN_NOSV_TYPEID, 21, 71 },

View File

@ -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_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_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_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 */ /* 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_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_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_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 */ /* FIXME: Use extended initialization for CPUs too */
chan_enable(&cpu->chan[CHAN_OVNI_TID], 1); chan_enable(&cpu->chan[CHAN_OVNI_TID], 1);
@ -536,6 +538,30 @@ pre_burst(struct ovni_emu *emu)
th->nbursts++; 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 void
hook_pre_ovni(struct ovni_emu *emu) 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 'H': pre_thread(emu); break;
case 'A': pre_affinity(emu); break; case 'A': pre_affinity(emu); break;
case 'B': pre_burst(emu); break; case 'B': pre_burst(emu); break;
case 'F': pre_flush(emu); break;
default: default:
dbg("unknown ovni event category %c\n", dbg("unknown ovni event category %c\n",
emu->cur_ev->header.category); emu->cur_ev->header.category);

23
pcf.c
View File

@ -176,6 +176,27 @@ struct event_type thread_cpu_affinity = {
/* Ignored */ NULL /* 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 ---------------- */ /* ---------------- CHAN_NOSV_TASKID ---------------- */
struct event_value nosv_taskid_values[] = { struct event_value nosv_taskid_values[] = {
@ -402,6 +423,7 @@ write_events(FILE *f, struct ovni_emu *emu)
/* thread_ovni_nthreads not needed */ /* thread_ovni_nthreads not needed */
write_event_type(f, &thread_ovni_state); write_event_type(f, &thread_ovni_state);
/* thread_ovni_appid not needed */ /* 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_taskid);
write_event_type(f, &thread_nosv_typeid); write_event_type(f, &thread_nosv_typeid);
write_event_type(f, &thread_nosv_appid); 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_state not needed */
/* cpu_ovni_appid not needed */ /* cpu_ovni_appid not needed */
/* cpu_ovni_cpu 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_taskid);
write_event_type(f, &cpu_nosv_typeid); write_event_type(f, &cpu_nosv_typeid);
write_event_type(f, &cpu_nosv_appid); write_event_type(f, &cpu_nosv_appid);