Always create task types in the tests

This commit is contained in:
Rodrigo Arias 2022-06-02 15:46:22 +02:00
parent 880bdb48d4
commit a62ba4eef5
2 changed files with 52 additions and 6 deletions

View File

@ -107,9 +107,29 @@ static inline void instr_end(void)
} }
static void static void
task(int32_t id, int us) type_create(int32_t typeid)
{
struct ovni_ev ev = {0};
ovni_ev_set_mcv(&ev, "VYc");
ovni_ev_set_clock(&ev, ovni_clock_now());
char buf[256];
char *p = buf;
size_t nbytes = 0;
memcpy(buf, &typeid, sizeof(typeid));
p += sizeof(typeid);
nbytes += sizeof(typeid);
sprintf(p, "testtype%d", typeid);
nbytes += strlen(p) + 1;
ovni_ev_jumbo_emit(&ev, (uint8_t *) buf, nbytes);
}
static void
task(int32_t id, uint32_t typeid, int us)
{ {
int32_t typeid = 1;
struct ovni_ev ev = {0}; struct ovni_ev ev = {0};
ovni_ev_set_mcv(&ev, "VTc"); ovni_ev_set_mcv(&ev, "VTc");
@ -139,12 +159,15 @@ int main(void)
{ {
int rank = atoi(getenv("OVNI_RANK")); int rank = atoi(getenv("OVNI_RANK"));
int nranks = atoi(getenv("OVNI_NRANKS")); int nranks = atoi(getenv("OVNI_NRANKS"));
uint32_t typeid = 1;
instr_start(rank, nranks); instr_start(rank, nranks);
type_create(typeid);
/* Create some fake nosv tasks */ /* Create some fake nosv tasks */
for(int i=0; i<10; i++) for(int i=0; i<10; i++)
task(i + 1, 50 * 1000); task(i + 1, typeid, 5000);
instr_end(); instr_end();

View File

@ -112,9 +112,29 @@ instr_end(void)
} }
static void static void
task_begin(int32_t id, int us) type_create(int32_t typeid)
{
struct ovni_ev ev = {0};
ovni_ev_set_mcv(&ev, "VYc");
ovni_ev_set_clock(&ev, ovni_clock_now());
char buf[256];
char *p = buf;
size_t nbytes = 0;
memcpy(buf, &typeid, sizeof(typeid));
p += sizeof(typeid);
nbytes += sizeof(typeid);
sprintf(p, "testtype%d", typeid);
nbytes += strlen(p) + 1;
ovni_ev_jumbo_emit(&ev, (uint8_t *) buf, nbytes);
}
static void
task_begin(int32_t id, uint32_t typeid, int us)
{ {
int32_t typeid = 1;
struct ovni_ev ev = {0}; struct ovni_ev ev = {0};
ovni_ev_set_mcv(&ev, "VTc"); ovni_ev_set_mcv(&ev, "VTc");
@ -150,10 +170,13 @@ main(void)
instr_start(0, 1); instr_start(0, 1);
int ntasks = 100; int ntasks = 100;
uint32_t typeid = 1;
type_create(typeid);
/* Create and run the tasks, one nested into another */ /* Create and run the tasks, one nested into another */
for(int i=0; i<ntasks; i++) for(int i=0; i<ntasks; i++)
task_begin(i + 1, 500); task_begin(i + 1, typeid, 500);
/* End the tasks in the opposite order */ /* End the tasks in the opposite order */
for(int i=ntasks-1; i>=0; i--) for(int i=ntasks-1; i>=0; i--)