Add CPU idle and active events

This commit is contained in:
Rodrigo Arias 2022-09-06 10:28:55 +02:00
parent 982bc39490
commit 576936ef01
3 changed files with 28 additions and 4 deletions

View File

@ -187,4 +187,7 @@ KCI Is back in the CPU due to a context switch
6HL Unsets itself as leader thread 6HL Unsets itself as leader thread
6Hm Sets itself as main thread 6Hm Sets itself as main thread
6HM Unsets itself as main thread 6HM Unsets itself as main thread
6Ci CPU becomes idle
6Ca CPU becomes active
``` ```

6
emu.h
View File

@ -120,8 +120,10 @@ enum nanos6_ss_state {
/* Value 51 is broken in old Paraver */ /* Value 51 is broken in old Paraver */
EV_NANOS6_SCHED_RECV = 60, EV_NANOS6_SCHED_RECV = 60,
EV_NANOS6_SCHED_SEND = 61, EV_NANOS6_SCHED_SEND,
EV_NANOS6_SCHED_SELF = 62, EV_NANOS6_SCHED_SELF,
EV_NANOS6_CPU_IDLE,
EV_NANOS6_CPU_ACTIVE,
}; };
enum nanos6_thread_type { enum nanos6_thread_type {

View File

@ -379,7 +379,6 @@ pre_worker(struct ovni_emu *emu)
} }
} }
static void static void
pre_sched(struct ovni_emu *emu) pre_sched(struct ovni_emu *emu)
{ {
@ -427,6 +426,25 @@ pre_thread(struct ovni_emu *emu)
} }
} }
static void
pre_cpu(struct ovni_emu *emu)
{
struct ovni_ethread *th;
struct ovni_chan *chan_th;
th = emu->cur_thread;
chan_th = &th->chan[CHAN_NANOS6_SUBSYSTEM];
switch(emu->cur_ev->header.value)
{
case 'i': chan_ev(chan_th, EV_NANOS6_CPU_IDLE); break;
case 'a': chan_ev(chan_th, EV_NANOS6_CPU_ACTIVE); break;
default:
die("unknown Nanos6 cpu event %c\n",
emu->cur_ev->header.value);
}
}
static void static void
pre_ss(struct ovni_emu *emu, int st) pre_ss(struct ovni_emu *emu, int st)
{ {
@ -487,6 +505,7 @@ hook_pre_nanos6(struct ovni_emu *emu)
case 'D': pre_deps(emu); break; case 'D': pre_deps(emu); break;
case 'B': pre_blocking(emu); break; case 'B': pre_blocking(emu); break;
case 'W': pre_worker(emu); break; case 'W': pre_worker(emu); break;
case 'C': pre_cpu(emu); break;
default: default:
die("unknown Nanos6 event category %c\n", die("unknown Nanos6 event category %c\n",
emu->cur_ev->header.category); emu->cur_ev->header.category);