From a4ce0e2a1e68a32deb8e6182e98b88f3246cc4ba Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 28 Feb 2023 10:08:30 +0100 Subject: [PATCH] Add Idle view in Nanos6 --- cfg/cpu/nanos6/idle.cfg | 42 ++++++++++++++++++++++++++++++++++++ cfg/thread/nanos6/idle.cfg | 42 ++++++++++++++++++++++++++++++++++++ doc/user/emulation/nanos6.md | 7 ++++++ src/emu/emu_prv.h | 1 + src/emu/nanos6/event.c | 2 ++ src/emu/nanos6/nanos6_priv.h | 5 +++++ src/emu/nanos6/setup.c | 19 +++++++++++++--- 7 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 cfg/cpu/nanos6/idle.cfg create mode 100644 cfg/thread/nanos6/idle.cfg diff --git a/cfg/cpu/nanos6/idle.cfg b/cfg/cpu/nanos6/idle.cfg new file mode 100644 index 0000000..a953084 --- /dev/null +++ b/cfg/cpu/nanos6/idle.cfg @@ -0,0 +1,42 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW CPU: Nanos6 idle state of the RUNNING thread > +################################################################################ +window_name CPU: Nanos6 idle state of the RUNNING thread +window_type single +window_id 1 +window_position_x 0 +window_position_y 0 +window_width 600 +window_height 150 +window_comm_lines_enabled false +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 1000.0 +window_minimum_y 1.0 +window_compute_y_max true +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 40 +window_filter_module evt_type_label 1 "CPU: Nanos6 idle state of the RUNNING thread" + diff --git a/cfg/thread/nanos6/idle.cfg b/cfg/thread/nanos6/idle.cfg new file mode 100644 index 0000000..7894b79 --- /dev/null +++ b/cfg/thread/nanos6/idle.cfg @@ -0,0 +1,42 @@ +#ParaverCFG +ConfigFile.Version: 3.4 +ConfigFile.NumWindows: 1 + + +################################################################################ +< NEW DISPLAYING WINDOW Thread: Nanos6 idle state > +################################################################################ +window_name Thread: Nanos6 idle state +window_type single +window_id 1 +window_position_x 0 +window_position_y 0 +window_width 600 +window_height 150 +window_comm_lines_enabled false +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 1000.0 +window_minimum_y 1.0 +window_compute_y_max true +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 40 +window_filter_module evt_type_label 1 "Thread: Nanos6 idle state" + diff --git a/doc/user/emulation/nanos6.md b/doc/user/emulation/nanos6.md index a8ac0b9..09809bb 100644 --- a/doc/user/emulation/nanos6.md +++ b/doc/user/emulation/nanos6.md @@ -76,6 +76,13 @@ This view shows the type of each thread: - External: used for external threads that attach to Nanos6 (currently there are not in use). +## Idle view + +This view shows the idle state of the worker thread. A worker becomes idle when +it has nothing to do. In particular, when attempting to get a task in the +DelegationLock, after the first iteration the worker is considered idle. +Similarly, when a worker serves tasks, all the time is not moving tasks from the +queues is considered idle too. ## Subsystem view diff --git a/src/emu/emu_prv.h b/src/emu/emu_prv.h index ba25b41..28f5072 100644 --- a/src/emu/emu_prv.h +++ b/src/emu/emu_prv.h @@ -24,6 +24,7 @@ enum emu_prv_types { PRV_NANOS6_SUBSYSTEM = 37, PRV_NANOS6_RANK = 38, PRV_NANOS6_THREAD = 39, + PRV_NANOS6_IDLE = 40, PRV_KERNEL_CS = 45, PRV_RESERVED = 100, }; diff --git a/src/emu/nanos6/event.c b/src/emu/nanos6/event.c index d5186ea..07b5885 100644 --- a/src/emu/nanos6/event.c +++ b/src/emu/nanos6/event.c @@ -36,6 +36,8 @@ static const int ss_table[256][256][3] = { ['r'] = { CHSS, PUSH, ST_RESUME }, ['R'] = { CHSS, POP, ST_RESUME }, ['*'] = { CHSS, IGN, -1 }, + ['i'] = { CH_IDLE, PUSH, ST_WORKER_IDLE }, + ['I'] = { CH_IDLE, POP, ST_WORKER_IDLE }, }, ['P'] = { /* TODO: Ignore progress events for now */ ['r'] = { CHSS, IGN, -1 }, diff --git a/src/emu/nanos6/nanos6_priv.h b/src/emu/nanos6/nanos6_priv.h index b75d05a..8def73e 100644 --- a/src/emu/nanos6/nanos6_priv.h +++ b/src/emu/nanos6/nanos6_priv.h @@ -17,6 +17,7 @@ enum nanos6_chan { CH_SUBSYSTEM, CH_RANK, CH_THREAD, + CH_IDLE, CH_MAX, }; @@ -60,6 +61,10 @@ enum nanos6_thread_type { ST_TH_EXTERNAL = 4, }; +enum nanos6_worker_idle { + ST_WORKER_IDLE = 1, +}; + struct nanos6_thread { struct model_thread m; struct task_stack task_stack; diff --git a/src/emu/nanos6/setup.c b/src/emu/nanos6/setup.c index c5dc32f..3054b7e 100644 --- a/src/emu/nanos6/setup.c +++ b/src/emu/nanos6/setup.c @@ -47,11 +47,13 @@ static const char *chan_name[CH_MAX] = { [CH_SUBSYSTEM] = "subsystem", [CH_RANK] = "rank", [CH_THREAD] = "thread_type", + [CH_IDLE] = "idle", }; static const int chan_stack[CH_MAX] = { [CH_SUBSYSTEM] = 1, [CH_THREAD] = 1, + [CH_IDLE] = 1, }; static const int chan_dup[CH_MAX] = { @@ -68,6 +70,7 @@ static const int pvt_type[] = { [CH_SUBSYSTEM] = PRV_NANOS6_SUBSYSTEM, [CH_RANK] = PRV_NANOS6_RANK, [CH_THREAD] = PRV_NANOS6_THREAD, + [CH_IDLE] = PRV_NANOS6_IDLE, }; static const char *pcf_prefix[CH_MAX] = { @@ -76,6 +79,7 @@ static const char *pcf_prefix[CH_MAX] = { [CH_SUBSYSTEM] = "Nanos6 subsystem", [CH_RANK] = "Nanos6 task MPI rank", [CH_THREAD] = "Nanos6 thread type", + [CH_IDLE] = "Nanos6 idle state", }; static const struct pcf_value_label nanos6_ss_values[] = { @@ -119,9 +123,15 @@ static const struct pcf_value_label nanos6_thread_type[] = { { -1, NULL }, }; -static const struct pcf_value_label *pcf_labels[CH_MAX] = { - [CH_SUBSYSTEM] = nanos6_ss_values, - [CH_THREAD] = nanos6_thread_type, +static const struct pcf_value_label nanos6_worker_idle[] = { + { ST_WORKER_IDLE, "Idle" }, + { -1, NULL }, +}; + +static const struct pcf_value_label (*pcf_labels[CH_MAX])[] = { + [CH_SUBSYSTEM] = &nanos6_ss_values, + [CH_THREAD] = &nanos6_thread_type, + [CH_IDLE] = &nanos6_worker_idle, }; static const long prv_flags[CH_MAX] = { @@ -130,6 +140,7 @@ static const long prv_flags[CH_MAX] = { [CH_SUBSYSTEM] = PRV_SKIPDUP, [CH_RANK] = PRV_EMITDUP, /* Switch to task of same rank */ [CH_THREAD] = PRV_SKIPDUP, + [CH_IDLE] = PRV_SKIPDUP, }; static const struct model_pvt_spec pvt_spec = { @@ -147,6 +158,7 @@ static const int th_track[CH_MAX] = { [CH_SUBSYSTEM] = TRACK_TH_ACT, [CH_RANK] = TRACK_TH_RUN, [CH_THREAD] = TRACK_TH_ANY, + [CH_IDLE] = TRACK_TH_ANY, }; static const int cpu_track[CH_MAX] = { @@ -155,6 +167,7 @@ static const int cpu_track[CH_MAX] = { [CH_SUBSYSTEM] = TRACK_TH_RUN, [CH_RANK] = TRACK_TH_RUN, [CH_THREAD] = TRACK_TH_RUN, + [CH_IDLE] = TRACK_TH_RUN, }; /* ----------------- chan_spec ------------------ */