Prefix subsystem values with "NOSV_"

This commit is contained in:
Rodrigo Arias 2021-10-14 07:30:27 +02:00
parent 351419a04d
commit 8f407d6ad2
3 changed files with 52 additions and 54 deletions

32
emu.h
View File

@ -33,18 +33,23 @@ enum nosv_task_state {
TASK_ST_DEAD, TASK_ST_DEAD,
}; };
enum nosv_thread_ss_state { enum nosv_ss_values {
ST_NULL = 0, ST_NULL = 0,
ST_SCHED_HUNGRY = 6, ST_NOSV_SCHED_HUNGRY = 6,
ST_SCHED_SERVING = 7, ST_NOSV_SCHED_SERVING = 7,
ST_SCHED_SUBMITTING = 8, ST_NOSV_SCHED_SUBMITTING = 8,
ST_MEM_ALLOCATING = 9, ST_NOSV_MEM_ALLOCATING = 9,
ST_TASK_RUNNING = 10, ST_NOSV_TASK_RUNNING = 10,
ST_NOSV_CODE = 11, ST_NOSV_CODE = 11,
ST_PAUSE = 12, ST_NOSV_PAUSE = 12,
ST_YIELD = 13, ST_NOSV_YIELD = 13,
ST_WAITFOR = 14, ST_NOSV_WAITFOR = 14,
ST_SCHEDPOINT = 15, ST_NOSV_SCHEDPOINT = 15,
EV_NOSV_SCHED_RECV = 50,
EV_NOSV_SCHED_SEND = 51,
EV_NOSV_SCHED_SELF = 52,
ST_BAD = 666, ST_BAD = 666,
}; };
@ -62,13 +67,6 @@ enum nosv_openmp_state {
ST_OPENMP_PARALLEL = 2, 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_ethread;
struct ovni_eproc; struct ovni_eproc;

View File

@ -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_TYPEID], task->type_id + 1);
chan_set(&th->chan[CHAN_NOSV_APPID], proc->appid + 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 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_TYPEID], 0);
chan_set(&th->chan[CHAN_NOSV_APPID], 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 static void
@ -326,25 +326,25 @@ pre_sched(struct ovni_emu *emu)
switch(emu->cur_ev->header.value) switch(emu->cur_ev->header.value)
{ {
case 'h': case 'h':
chan_push(chan_th, ST_SCHED_HUNGRY); chan_push(chan_th, ST_NOSV_SCHED_HUNGRY);
break; break;
case 'f': /* Fill: no longer hungry */ case 'f': /* Fill: no longer hungry */
chan_pop(chan_th, ST_SCHED_HUNGRY); chan_pop(chan_th, ST_NOSV_SCHED_HUNGRY);
break; break;
case '[': /* Server enter */ case '[': /* Server enter */
chan_push(chan_th, ST_SCHED_SERVING); chan_push(chan_th, ST_NOSV_SCHED_SERVING);
break; break;
case ']': /* Server exit */ case ']': /* Server exit */
chan_pop(chan_th, ST_SCHED_SERVING); chan_pop(chan_th, ST_NOSV_SCHED_SERVING);
break; break;
case '@': case '@':
chan_ev(chan_th, EV_SCHED_SELF); chan_ev(chan_th, EV_NOSV_SCHED_SELF);
break; break;
case 'r': case 'r':
chan_ev(chan_th, EV_SCHED_RECV); chan_ev(chan_th, EV_NOSV_SCHED_RECV);
break; break;
case 's': case 's':
chan_ev(chan_th, EV_SCHED_SEND); chan_ev(chan_th, EV_NOSV_SCHED_SEND);
break; break;
default: default:
break; break;
@ -385,12 +385,12 @@ hook_pre_nosv(struct ovni_emu *emu)
case 'T': pre_task(emu); break; case 'T': pre_task(emu); break;
case 'Y': pre_type(emu); break; case 'Y': pre_type(emu); break;
case 'S': pre_sched(emu); break; case 'S': pre_sched(emu); break;
case 'U': pre_ss(emu, ST_SCHED_SUBMITTING); break; case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); break;
case 'M': pre_ss(emu, ST_MEM_ALLOCATING); break; case 'M': pre_ss(emu, ST_NOSV_MEM_ALLOCATING); break;
case 'P': pre_ss(emu, ST_PAUSE); break; case 'P': pre_ss(emu, ST_NOSV_PAUSE); break;
case 'I': pre_ss(emu, ST_YIELD); break; case 'I': pre_ss(emu, ST_NOSV_YIELD); break;
case 'W': pre_ss(emu, ST_WAITFOR); break; case 'W': pre_ss(emu, ST_NOSV_WAITFOR); break;
case 'D': pre_ss(emu, ST_SCHEDPOINT); break; case 'D': pre_ss(emu, ST_NOSV_SCHEDPOINT); break;
case 'C': pre_ss(emu, ST_NOSV_CODE); break; case 'C': pre_ss(emu, ST_NOSV_CODE); break;
default: default:
break; break;

38
pcf.c
View File

@ -117,33 +117,33 @@ struct event_type thread_tid = {
thread_tid_values thread_tid_values
}; };
struct event_value ss_values[] = { struct event_value nosv_ss_values[] = {
{ ST_NULL, "NULL" }, { ST_NULL, "NULL" },
{ ST_BAD, "Unknown subsystem: multiple threads" }, { ST_BAD, "Unknown subsystem: multiple threads" },
{ ST_SCHED_HUNGRY, "Scheduler: Hungry" }, { ST_NOSV_SCHED_HUNGRY, "Scheduler: Hungry" },
{ ST_SCHED_SERVING, "Scheduler: Serving" }, { ST_NOSV_SCHED_SERVING, "Scheduler: Serving" },
{ ST_SCHED_SUBMITTING, "Scheduler: Submitting" }, { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" },
{ ST_TASK_RUNNING, "Task: Running" }, { ST_NOSV_TASK_RUNNING, "Task: Running" },
{ ST_NOSV_CODE, "nOS-V code" }, { ST_NOSV_CODE, "nOS-V code" },
{ ST_PAUSE, "API: Pause" }, { ST_NOSV_PAUSE, "API: Pause" },
{ ST_YIELD, "API: Yield" }, { ST_NOSV_YIELD, "API: Yield" },
{ ST_WAITFOR, "API: Waitfor" }, { ST_NOSV_WAITFOR, "API: Waitfor" },
{ ST_SCHEDPOINT, "API: Scheduling point" }, { ST_NOSV_SCHEDPOINT, "API: Scheduling point" },
{ EV_SCHED_SEND, "EV Scheduler: Send task" }, { EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" },
{ EV_SCHED_RECV, "EV Scheduler: Recv task" }, { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" },
{ EV_SCHED_SELF, "EV Scheduler: Self-assign task" }, { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" },
{ ST_MEM_ALLOCATING, "Memory: Allocating" }, { ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" },
{ -1, NULL }, { -1, NULL },
}; };
struct event_type thread_ss = { struct event_type thread_nosv_ss = {
0, 23, "Thread: Subsystem", 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", 0, 73, "CPU: Current thread subsystem",
ss_values nosv_ss_values
}; };
struct event_value tampi_mode_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_state);
write_event_type(f, &thread_tid); write_event_type(f, &thread_tid);
write_event_type(f, &thread_ss); write_event_type(f, &thread_nosv_ss);
write_event_type(f, &cpu_ss); write_event_type(f, &cpu_nosv_ss);
write_event_type(f, &cpu_tampi_mode); write_event_type(f, &cpu_tampi_mode);
write_event_type(f, &thread_tampi_mode); write_event_type(f, &thread_tampi_mode);
write_event_type(f, &cpu_openmp_mode); write_event_type(f, &cpu_openmp_mode);