From 8f407d6ad2993fe1c2194dc592f7fbc0a88f0c8d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 14 Oct 2021 07:30:27 +0200 Subject: [PATCH] Prefix subsystem values with "NOSV_" --- emu.h | 32 +++++++++++++++----------------- emu_nosv.c | 30 +++++++++++++++--------------- pcf.c | 44 ++++++++++++++++++++++---------------------- 3 files changed, 52 insertions(+), 54 deletions(-) diff --git a/emu.h b/emu.h index bbc8145..da7da68 100644 --- a/emu.h +++ b/emu.h @@ -33,18 +33,23 @@ enum nosv_task_state { TASK_ST_DEAD, }; -enum nosv_thread_ss_state { +enum nosv_ss_values { ST_NULL = 0, - ST_SCHED_HUNGRY = 6, - ST_SCHED_SERVING = 7, - ST_SCHED_SUBMITTING = 8, - ST_MEM_ALLOCATING = 9, - ST_TASK_RUNNING = 10, + ST_NOSV_SCHED_HUNGRY = 6, + ST_NOSV_SCHED_SERVING = 7, + ST_NOSV_SCHED_SUBMITTING = 8, + ST_NOSV_MEM_ALLOCATING = 9, + ST_NOSV_TASK_RUNNING = 10, ST_NOSV_CODE = 11, - ST_PAUSE = 12, - ST_YIELD = 13, - ST_WAITFOR = 14, - ST_SCHEDPOINT = 15, + ST_NOSV_PAUSE = 12, + ST_NOSV_YIELD = 13, + ST_NOSV_WAITFOR = 14, + ST_NOSV_SCHEDPOINT = 15, + + EV_NOSV_SCHED_RECV = 50, + EV_NOSV_SCHED_SEND = 51, + EV_NOSV_SCHED_SELF = 52, + ST_BAD = 666, }; @@ -62,13 +67,6 @@ enum nosv_openmp_state { ST_OPENMP_PARALLEL = 2, }; -enum nosv_thread_ss_event { - EV_NULL = 0, - EV_SCHED_RECV = 50, - EV_SCHED_SEND = 51, - EV_SCHED_SELF = 52, -}; - struct ovni_ethread; struct ovni_eproc; diff --git a/emu_nosv.c b/emu_nosv.c index 045d256..221b2b2 100644 --- a/emu_nosv.c +++ b/emu_nosv.c @@ -206,7 +206,7 @@ pre_task_running(struct ovni_emu *emu, struct nosv_task *task) chan_set(&th->chan[CHAN_NOSV_TYPEID], task->type_id + 1); chan_set(&th->chan[CHAN_NOSV_APPID], proc->appid + 1); - chan_push(&th->chan[CHAN_NOSV_SUBSYSTEM], ST_TASK_RUNNING); + chan_push(&th->chan[CHAN_NOSV_SUBSYSTEM], ST_NOSV_TASK_RUNNING); } static void @@ -220,7 +220,7 @@ pre_task_not_running(struct ovni_emu *emu, struct nosv_task *task) chan_set(&th->chan[CHAN_NOSV_TYPEID], 0); chan_set(&th->chan[CHAN_NOSV_APPID], 0); - chan_pop(&th->chan[CHAN_NOSV_SUBSYSTEM], ST_TASK_RUNNING); + chan_pop(&th->chan[CHAN_NOSV_SUBSYSTEM], ST_NOSV_TASK_RUNNING); } static void @@ -326,25 +326,25 @@ pre_sched(struct ovni_emu *emu) switch(emu->cur_ev->header.value) { case 'h': - chan_push(chan_th, ST_SCHED_HUNGRY); + chan_push(chan_th, ST_NOSV_SCHED_HUNGRY); break; case 'f': /* Fill: no longer hungry */ - chan_pop(chan_th, ST_SCHED_HUNGRY); + chan_pop(chan_th, ST_NOSV_SCHED_HUNGRY); break; case '[': /* Server enter */ - chan_push(chan_th, ST_SCHED_SERVING); + chan_push(chan_th, ST_NOSV_SCHED_SERVING); break; case ']': /* Server exit */ - chan_pop(chan_th, ST_SCHED_SERVING); + chan_pop(chan_th, ST_NOSV_SCHED_SERVING); break; case '@': - chan_ev(chan_th, EV_SCHED_SELF); + chan_ev(chan_th, EV_NOSV_SCHED_SELF); break; case 'r': - chan_ev(chan_th, EV_SCHED_RECV); + chan_ev(chan_th, EV_NOSV_SCHED_RECV); break; case 's': - chan_ev(chan_th, EV_SCHED_SEND); + chan_ev(chan_th, EV_NOSV_SCHED_SEND); break; default: break; @@ -385,12 +385,12 @@ hook_pre_nosv(struct ovni_emu *emu) case 'T': pre_task(emu); break; case 'Y': pre_type(emu); break; case 'S': pre_sched(emu); break; - case 'U': pre_ss(emu, ST_SCHED_SUBMITTING); break; - case 'M': pre_ss(emu, ST_MEM_ALLOCATING); break; - case 'P': pre_ss(emu, ST_PAUSE); break; - case 'I': pre_ss(emu, ST_YIELD); break; - case 'W': pre_ss(emu, ST_WAITFOR); break; - case 'D': pre_ss(emu, ST_SCHEDPOINT); break; + case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); break; + case 'M': pre_ss(emu, ST_NOSV_MEM_ALLOCATING); break; + case 'P': pre_ss(emu, ST_NOSV_PAUSE); break; + case 'I': pre_ss(emu, ST_NOSV_YIELD); break; + case 'W': pre_ss(emu, ST_NOSV_WAITFOR); break; + case 'D': pre_ss(emu, ST_NOSV_SCHEDPOINT); break; case 'C': pre_ss(emu, ST_NOSV_CODE); break; default: break; diff --git a/pcf.c b/pcf.c index a4dba98..e768cf4 100644 --- a/pcf.c +++ b/pcf.c @@ -117,33 +117,33 @@ struct event_type thread_tid = { thread_tid_values }; -struct event_value ss_values[] = { - { ST_NULL, "NULL" }, - { ST_BAD, "Unknown subsystem: multiple threads" }, - { ST_SCHED_HUNGRY, "Scheduler: Hungry" }, - { ST_SCHED_SERVING, "Scheduler: Serving" }, - { ST_SCHED_SUBMITTING, "Scheduler: Submitting" }, - { ST_TASK_RUNNING, "Task: Running" }, - { ST_NOSV_CODE, "nOS-V code" }, - { ST_PAUSE, "API: Pause" }, - { ST_YIELD, "API: Yield" }, - { ST_WAITFOR, "API: Waitfor" }, - { ST_SCHEDPOINT, "API: Scheduling point" }, - { EV_SCHED_SEND, "EV Scheduler: Send task" }, - { EV_SCHED_RECV, "EV Scheduler: Recv task" }, - { EV_SCHED_SELF, "EV Scheduler: Self-assign task" }, - { ST_MEM_ALLOCATING, "Memory: Allocating" }, +struct event_value nosv_ss_values[] = { + { ST_NULL, "NULL" }, + { ST_BAD, "Unknown subsystem: multiple threads" }, + { ST_NOSV_SCHED_HUNGRY, "Scheduler: Hungry" }, + { ST_NOSV_SCHED_SERVING, "Scheduler: Serving" }, + { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" }, + { ST_NOSV_TASK_RUNNING, "Task: Running" }, + { ST_NOSV_CODE, "nOS-V code" }, + { ST_NOSV_PAUSE, "API: Pause" }, + { ST_NOSV_YIELD, "API: Yield" }, + { ST_NOSV_WAITFOR, "API: Waitfor" }, + { ST_NOSV_SCHEDPOINT, "API: Scheduling point" }, + { EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" }, + { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" }, + { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" }, + { ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" }, { -1, NULL }, }; -struct event_type thread_ss = { +struct event_type thread_nosv_ss = { 0, 23, "Thread: Subsystem", - ss_values + nosv_ss_values }; -struct event_type cpu_ss = { +struct event_type cpu_nosv_ss = { 0, 73, "CPU: Current thread subsystem", - ss_values + nosv_ss_values }; struct event_value tampi_mode_values[] = { @@ -266,8 +266,8 @@ write_events(FILE *f, struct ovni_emu *emu) { write_event_type(f, &thread_state); write_event_type(f, &thread_tid); - write_event_type(f, &thread_ss); - write_event_type(f, &cpu_ss); + write_event_type(f, &thread_nosv_ss); + write_event_type(f, &cpu_nosv_ss); write_event_type(f, &cpu_tampi_mode); write_event_type(f, &thread_tampi_mode); write_event_type(f, &cpu_openmp_mode);