Add burst stats test
This commit is contained in:
parent
3eac598e2c
commit
bacf33450d
@ -11,5 +11,6 @@ ovni_test(sort.c SORT)
|
|||||||
ovni_test(empty-sort.c SORT)
|
ovni_test(empty-sort.c SORT)
|
||||||
ovni_test(sort-first-and-full-ring.c SORT
|
ovni_test(sort-first-and-full-ring.c SORT
|
||||||
SHOULD_FAIL REGEX "cannot find a event previous to clock")
|
SHOULD_FAIL REGEX "cannot find a event previous to clock")
|
||||||
|
ovni_test(burst-stats.c REGEX "burst stats: median 33 ns, avg 33\.0 ns, max 33 ns")
|
||||||
ovni_test(mp-simple.c MP)
|
ovni_test(mp-simple.c MP)
|
||||||
ovni_test(mp-rank.c MP)
|
ovni_test(mp-rank.c MP)
|
||||||
|
49
test/emu/ovni/burst-stats.c
Normal file
49
test/emu/ovni/burst-stats.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/* Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC)
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
|
#include "ovni.h"
|
||||||
|
#include "../instr.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
emit(char *mcv, uint64_t clock)
|
||||||
|
{
|
||||||
|
struct ovni_ev ev = {0};
|
||||||
|
ovni_ev_set_mcv(&ev, mcv);
|
||||||
|
ovni_ev_set_clock(&ev, clock);
|
||||||
|
ovni_ev_emit(&ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
instr_start(0, 1);
|
||||||
|
|
||||||
|
uint64_t t = ovni_clock_now();
|
||||||
|
|
||||||
|
/* Emit bursts with controlled clocks */
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
emit("OB.", t);
|
||||||
|
t += 33;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sleep a bit to prevent unsorted events */
|
||||||
|
while (ovni_clock_now() < t)
|
||||||
|
usleep(10);
|
||||||
|
|
||||||
|
instr_end();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user