Add nos-v scheduler subsystem events
This commit is contained in:
parent
10b14a90a3
commit
31e3f1218f
2
Makefile
2
Makefile
@ -24,7 +24,7 @@ dump: ovni.o dump.o parson.o
|
||||
|
||||
test_speed: test_speed.c ovni.o parson.o
|
||||
|
||||
emu: emu.o emu_ovni.o emu_nosv.o ovni.o prv.o pcf.o parson.o
|
||||
emu: emu.o emu_ovni.o emu_nosv.o emu_nosv_ss.o ovni.o prv.o pcf.o parson.o
|
||||
|
||||
libovni.so: ovni.o parson.o
|
||||
$(LINK.c) -shared $^ -o $@
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ParaverCFG
|
||||
ConfigFile.Version: 3.4
|
||||
ConfigFile.NumWindows: 2
|
||||
ConfigFile.NumWindows: 3
|
||||
|
||||
|
||||
################################################################################
|
||||
@ -12,7 +12,7 @@ window_id 1
|
||||
window_position_x 960
|
||||
window_position_y 24
|
||||
window_width 954
|
||||
window_height 499
|
||||
window_height 323
|
||||
window_comm_lines_enabled true
|
||||
window_flags_enabled true
|
||||
window_noncolor_mode true
|
||||
@ -38,7 +38,7 @@ 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 60
|
||||
window_filter_module evt_type_label 1 "Unknown"
|
||||
window_filter_module evt_type_label 1 "Thread: State"
|
||||
window_synchronize 1
|
||||
|
||||
################################################################################
|
||||
@ -48,9 +48,9 @@ window_name Thread: TID
|
||||
window_type single
|
||||
window_id 2
|
||||
window_position_x 960
|
||||
window_position_y 550
|
||||
window_position_y 374
|
||||
window_width 954
|
||||
window_height 499
|
||||
window_height 324
|
||||
window_comm_lines_enabled true
|
||||
window_flags_enabled true
|
||||
window_noncolor_mode true
|
||||
@ -60,8 +60,8 @@ window_comm_fromto true
|
||||
window_comm_tagsize true
|
||||
window_comm_typeval true
|
||||
window_units Microseconds
|
||||
window_maximum_y 426239.000000000000
|
||||
window_minimum_y 426112.000000000000
|
||||
window_maximum_y 638614.000000000000
|
||||
window_minimum_y 638608.000000000000
|
||||
window_compute_y_max false
|
||||
window_level thread
|
||||
window_scale_relative 1.000000000000
|
||||
@ -79,3 +79,41 @@ window_filter_module evt_type 1 61
|
||||
window_filter_module evt_type_label 1 "Unknown"
|
||||
window_synchronize 1
|
||||
|
||||
################################################################################
|
||||
< NEW DISPLAYING WINDOW Thread: Subsystem >
|
||||
################################################################################
|
||||
window_name Thread: Subsystem
|
||||
window_type single
|
||||
window_id 3
|
||||
window_position_x 960
|
||||
window_position_y 725
|
||||
window_width 954
|
||||
window_height 324
|
||||
window_comm_lines_enabled true
|
||||
window_flags_enabled true
|
||||
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 3.000000000000
|
||||
window_minimum_y 1.000000000000
|
||||
window_compute_y_max false
|
||||
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_maximum
|
||||
window_drawmode_rows draw_maximum
|
||||
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 62
|
||||
window_filter_module evt_type_label 1 "Unknown"
|
||||
window_synchronize 1
|
||||
|
||||
|
28
emu.h
28
emu.h
@ -31,6 +31,20 @@ enum nosv_task_state {
|
||||
TASK_ST_DEAD,
|
||||
};
|
||||
|
||||
enum nosv_thread_ss_state {
|
||||
ST_NULL = 0,
|
||||
ST_SCHED_HUNGRY = 6,
|
||||
ST_SCHED_SERVING = 7,
|
||||
ST_SCHED_SUBMITTING = 8,
|
||||
};
|
||||
|
||||
enum nosv_thread_ss_event {
|
||||
EV_NULL = 0,
|
||||
EV_SCHED_RECV = 11,
|
||||
EV_SCHED_SEND = 12,
|
||||
EV_SCHED_SELF = 13,
|
||||
};
|
||||
|
||||
struct ovni_ethread;
|
||||
struct ovni_eproc;
|
||||
|
||||
@ -48,6 +62,8 @@ struct nosv_task_type {
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
#define MAX_SS_STACK 128
|
||||
|
||||
/* State of each emulated thread */
|
||||
struct ovni_ethread {
|
||||
/* Emulated thread tid */
|
||||
@ -70,6 +86,14 @@ struct ovni_ethread {
|
||||
/* Current cpu */
|
||||
struct ovni_cpu *cpu;
|
||||
|
||||
/* Number of subsystem states in the stack */
|
||||
int nss;
|
||||
|
||||
/* Stack of subsystem states */
|
||||
int ss[MAX_SS_STACK];
|
||||
|
||||
int ss_event;
|
||||
|
||||
/* FIXME: Use a table with registrable pointers to custom data
|
||||
* structures */
|
||||
|
||||
@ -219,6 +243,10 @@ void hook_pre_nosv(struct ovni_emu *emu);
|
||||
void hook_emit_nosv(struct ovni_emu *emu);
|
||||
void hook_post_nosv(struct ovni_emu *emu);
|
||||
|
||||
void hook_pre_nosv_ss(struct ovni_emu *emu);
|
||||
void hook_emit_nosv_ss(struct ovni_emu *emu);
|
||||
void hook_post_nosv_ss(struct ovni_emu *emu);
|
||||
|
||||
struct ovni_cpu *emu_get_cpu(struct ovni_loom *loom, int cpuid);
|
||||
|
||||
struct ovni_ethread *emu_get_thread(struct ovni_eproc *proc, int tid);
|
||||
|
@ -221,6 +221,7 @@ pre_type(struct ovni_emu *emu)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hook_pre_nosv(struct ovni_emu *emu)
|
||||
{
|
||||
@ -231,6 +232,8 @@ hook_pre_nosv(struct ovni_emu *emu)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
hook_pre_nosv_ss(emu);
|
||||
}
|
||||
|
||||
/* --------------------------- emit ------------------------------- */
|
||||
@ -283,6 +286,8 @@ hook_emit_nosv(struct ovni_emu *emu)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
hook_emit_nosv_ss(emu);
|
||||
}
|
||||
|
||||
struct hook_entry pre_hooks[] = {
|
||||
|
162
emu_nosv_ss.c
Normal file
162
emu_nosv_ss.c
Normal file
@ -0,0 +1,162 @@
|
||||
#include <assert.h>
|
||||
#include "uthash.h"
|
||||
|
||||
#include "ovni.h"
|
||||
#include "ovni_trace.h"
|
||||
#include "emu.h"
|
||||
#include "prv.h"
|
||||
|
||||
/* This module manages the nos-v subsystem (ss) events, to track which
|
||||
* actions are being performed by each thread at a given time. A stack
|
||||
* of states is stored in each thread, so we remember the path of
|
||||
* execution. Events such as task received by a thread are emitted as
|
||||
* fake events with very short period. */
|
||||
|
||||
|
||||
/* --------------------------- ss helpers ------------------------------- */
|
||||
|
||||
static void
|
||||
ss_init(struct ovni_ethread *t)
|
||||
{
|
||||
t->nss = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ss_push(struct ovni_ethread *t, int st)
|
||||
{
|
||||
if(t->nss >= MAX_SS_STACK)
|
||||
{
|
||||
err("thread %d subsystem stack full\n", t->tid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
t->ss[t->nss] = st;
|
||||
t->nss++;
|
||||
}
|
||||
|
||||
static int
|
||||
ss_pop(struct ovni_ethread *t)
|
||||
{
|
||||
int st;
|
||||
|
||||
if(t->nss <= 0)
|
||||
{
|
||||
err("thread %d subsystem stack empty\n", t->tid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
st = t->ss[t->nss - 1];
|
||||
t->nss--;
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
static void
|
||||
ss_ev(struct ovni_ethread *th, int ev)
|
||||
{
|
||||
th->ss_event = ev;
|
||||
}
|
||||
|
||||
/* --------------------------- pre ------------------------------- */
|
||||
|
||||
static void
|
||||
pre_sched(struct ovni_emu *emu)
|
||||
{
|
||||
struct ovni_ethread *th;
|
||||
|
||||
th = emu->cur_thread;
|
||||
switch(emu->cur_ev->header.value)
|
||||
{
|
||||
case 'h':
|
||||
ss_push(th, ST_SCHED_HUNGRY);
|
||||
break;
|
||||
case 'f': /* Fill: no longer hungry */
|
||||
ss_pop(th);
|
||||
break;
|
||||
case '[': /* Server enter */
|
||||
ss_push(th, ST_SCHED_SERVING);
|
||||
break;
|
||||
case ']': /* Server exit */
|
||||
ss_pop(th);
|
||||
break;
|
||||
case '@': ss_ev(th, EV_SCHED_SELF); break;
|
||||
case 'r': ss_ev(th, EV_SCHED_RECV); break;
|
||||
case 's': ss_ev(th, EV_SCHED_SEND); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pre_submit(struct ovni_emu *emu)
|
||||
{
|
||||
struct ovni_ethread *th;
|
||||
|
||||
th = emu->cur_thread;
|
||||
switch(emu->cur_ev->header.value)
|
||||
{
|
||||
case '[': ss_push(th, ST_SCHED_SUBMITTING); break;
|
||||
case ']': ss_pop(th); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
hook_pre_nosv_ss(struct ovni_emu *emu)
|
||||
{
|
||||
switch(emu->cur_ev->header.class)
|
||||
{
|
||||
case 'S': pre_sched(emu); break;
|
||||
case 'U': pre_submit(emu); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------- emit ------------------------------- */
|
||||
|
||||
static void
|
||||
emit_thread_state(struct ovni_emu *emu, struct ovni_ethread *th,
|
||||
int type, int st)
|
||||
{
|
||||
int row;
|
||||
|
||||
row = th->gindex + 1;
|
||||
|
||||
prv_ev_thread(emu, row, type, st);
|
||||
}
|
||||
|
||||
void
|
||||
hook_emit_nosv_ss(struct ovni_emu *emu)
|
||||
{
|
||||
struct ovni_ethread *th;
|
||||
|
||||
th = emu->cur_thread;
|
||||
|
||||
// /* Only emit a state if needed */
|
||||
// if(th->ss_event != EV_NULL)
|
||||
// {
|
||||
// emit_thread_state(emu, th, PTT_SUBSYSTEM,
|
||||
// th->ss_event);
|
||||
// }
|
||||
// else
|
||||
|
||||
if(th->nss > 0)
|
||||
{
|
||||
emit_thread_state(emu, th, PTT_SUBSYSTEM,
|
||||
th->ss[th->nss - 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit_thread_state(emu, th, PTT_SUBSYSTEM, ST_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------- post ------------------------------- */
|
||||
|
||||
void
|
||||
hook_post_nosv_ss(struct ovni_emu *emu)
|
||||
{
|
||||
emu->cur_thread->ss_event = EV_NULL;
|
||||
}
|
14
pcf.c
14
pcf.c
@ -114,6 +114,19 @@ struct event_type thread_tid = {
|
||||
thread_tid_values
|
||||
};
|
||||
|
||||
struct event_value thread_ss_values[] = {
|
||||
{ ST_NULL, "NULL" },
|
||||
{ ST_SCHED_HUNGRY, "Scheduler: Hungry" },
|
||||
{ ST_SCHED_SERVING, "Scheduler: Serving" },
|
||||
{ ST_SCHED_SUBMITTING, "Scheduler: Submitting" },
|
||||
{ -1, NULL },
|
||||
};
|
||||
|
||||
struct event_type thread_ss = {
|
||||
0, PTT_SUBSYSTEM, "Thread: Subsystem",
|
||||
thread_ss_values
|
||||
};
|
||||
|
||||
static void
|
||||
decompose_rgb(uint32_t col, uint8_t *r, uint8_t *g, uint8_t *b)
|
||||
{
|
||||
@ -176,6 +189,7 @@ write_events(FILE *f)
|
||||
{
|
||||
write_event_type(f, &thread_state);
|
||||
write_event_type(f, &thread_tid);
|
||||
write_event_type(f, &thread_ss);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user