Gathering nOS-V API instrumentation as new subnamespace

This commit is contained in:
Kevin Sala 2021-10-15 11:31:23 +02:00 committed by Rodrigo Arias
parent 50990b6ac9
commit 52ba53ffda
3 changed files with 58 additions and 13 deletions

9
emu.h
View File

@ -41,10 +41,11 @@ enum nosv_ss_values {
ST_NOSV_MEM_ALLOCATING = 9, ST_NOSV_MEM_ALLOCATING = 9,
ST_NOSV_TASK_RUNNING = 10, ST_NOSV_TASK_RUNNING = 10,
ST_NOSV_CODE = 11, ST_NOSV_CODE = 11,
ST_NOSV_PAUSE = 12, ST_NOSV_API_SUBMIT = 12,
ST_NOSV_YIELD = 13, ST_NOSV_API_PAUSE = 13,
ST_NOSV_WAITFOR = 14, ST_NOSV_API_YIELD = 14,
ST_NOSV_SCHEDPOINT = 15, ST_NOSV_API_WAITFOR = 15,
ST_NOSV_API_SCHEDPOINT = 16,
EV_NOSV_SCHED_RECV = 50, EV_NOSV_SCHED_RECV = 50,
EV_NOSV_SCHED_SEND = 51, EV_NOSV_SCHED_SEND = 51,

View File

@ -351,6 +351,52 @@ pre_sched(struct ovni_emu *emu)
} }
} }
static void
pre_api(struct ovni_emu *emu)
{
struct ovni_ethread *th;
struct ovni_chan *chan_th;
th = emu->cur_thread;
chan_th = &th->chan[CHAN_NOSV_SUBSYSTEM];
switch(emu->cur_ev->header.value)
{
case 's':
chan_push(chan_th, ST_NOSV_API_SUBMIT);
break;
case 'S':
chan_pop(chan_th, ST_NOSV_API_SUBMIT);
break;
case 'p':
chan_push(chan_th, ST_NOSV_API_PAUSE);
break;
case 'P':
chan_pop(chan_th, ST_NOSV_API_PAUSE);
break;
case 'y':
chan_push(chan_th, ST_NOSV_API_YIELD);
break;
case 'Y':
chan_pop(chan_th, ST_NOSV_API_YIELD);
break;
case 'w':
chan_push(chan_th, ST_NOSV_API_WAITFOR);
break;
case 'W':
chan_pop(chan_th, ST_NOSV_API_WAITFOR);
break;
case 'c':
chan_push(chan_th, ST_NOSV_API_SCHEDPOINT);
break;
case 'C':
chan_pop(chan_th, ST_NOSV_API_SCHEDPOINT);
break;
default:
break;
}
}
static void static void
pre_ss(struct ovni_emu *emu, int st) pre_ss(struct ovni_emu *emu, int st)
{ {
@ -362,7 +408,7 @@ pre_ss(struct ovni_emu *emu, int st)
switch(emu->cur_ev->header.value) switch(emu->cur_ev->header.value)
{ {
case '[': case '[':
chan_push(chan_th, st); chan_push(chan_th, st);
break; break;
case ']': case ']':
@ -387,11 +433,8 @@ hook_pre_nosv(struct ovni_emu *emu)
case 'S': pre_sched(emu); break; case 'S': pre_sched(emu); break;
case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); break; case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); break;
case 'M': pre_ss(emu, ST_NOSV_MEM_ALLOCATING); 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; case 'C': pre_ss(emu, ST_NOSV_CODE); break;
case 'A': pre_api(emu); break;
default: default:
break; break;
} }

9
pcf.c
View File

@ -125,10 +125,11 @@ struct event_value nosv_ss_values[] = {
{ ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" }, { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" },
{ ST_NOSV_TASK_RUNNING, "Task: Running" }, { ST_NOSV_TASK_RUNNING, "Task: Running" },
{ ST_NOSV_CODE, "nOS-V code" }, { ST_NOSV_CODE, "nOS-V code" },
{ ST_NOSV_PAUSE, "API: Pause" }, { ST_NOSV_API_SUBMIT, "API: Submit" },
{ ST_NOSV_YIELD, "API: Yield" }, { ST_NOSV_API_PAUSE, "API: Pause" },
{ ST_NOSV_WAITFOR, "API: Waitfor" }, { ST_NOSV_API_YIELD, "API: Yield" },
{ ST_NOSV_SCHEDPOINT, "API: Scheduling point" }, { ST_NOSV_API_WAITFOR, "API: Waitfor" },
{ ST_NOSV_API_SCHEDPOINT, "API: Scheduling point" },
{ EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" }, { EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" },
{ EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" }, { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" },
{ EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" }, { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" },