ovni/test/emu/instr.c
Rodrigo Arias 864ce4222f Store the first and last clock of emu events
Allows the tests to know the relative clock that will appear in the PRV
trace (with one rank only).
2023-03-24 12:08:45 +00:00

25 lines
473 B
C

/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "instr.h"
int first_clock_set = 0;
int64_t first_clock; /* First clock */
int64_t last_clock; /* Clock from the last event */
int64_t get_clock(void)
{
last_clock = ovni_clock_now();
if (first_clock_set == 0) {
first_clock = last_clock;
first_clock_set = 1;
}
return last_clock;
}
int64_t get_delta(void)
{
return last_clock - first_clock;
}