2021-10-26 18:42:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021 Barcelona Supercomputing Center (BSC)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-09-28 19:21:22 +02:00
|
|
|
#define _POSIX_C_SOURCE 200112L
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
|
2021-07-22 12:36:02 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdio.h>
|
2021-09-28 12:27:14 +02:00
|
|
|
#include <unistd.h>
|
2021-07-22 12:36:02 +02:00
|
|
|
#include <sys/types.h>
|
2021-07-24 10:53:41 +02:00
|
|
|
#include <linux/limits.h>
|
2021-09-28 19:21:22 +02:00
|
|
|
#include <limits.h>
|
2021-07-22 12:36:02 +02:00
|
|
|
|
|
|
|
#include "ovni.h"
|
2022-01-11 15:47:17 +01:00
|
|
|
#include "compat.h"
|
2021-07-22 12:36:02 +02:00
|
|
|
|
2021-09-28 12:27:14 +02:00
|
|
|
static inline void
|
2021-10-18 12:44:43 +02:00
|
|
|
init(void)
|
2021-09-28 12:27:14 +02:00
|
|
|
{
|
|
|
|
char hostname[HOST_NAME_MAX];
|
|
|
|
|
|
|
|
if(gethostname(hostname, HOST_NAME_MAX) != 0)
|
|
|
|
{
|
|
|
|
perror("gethostname failed");
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
ovni_proc_init(0, hostname, getpid());
|
|
|
|
ovni_thread_init(gettid());
|
|
|
|
ovni_add_cpu(0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
2021-07-22 12:36:02 +02:00
|
|
|
{
|
2021-07-24 10:53:41 +02:00
|
|
|
struct ovni_ev ev = {0};
|
2021-09-28 12:27:14 +02:00
|
|
|
int i, n;
|
|
|
|
|
2021-10-18 12:44:43 +02:00
|
|
|
if(argc > 1)
|
2021-09-28 12:27:14 +02:00
|
|
|
n = atoi(argv[1]);
|
|
|
|
else
|
|
|
|
n = 1000;
|
2021-07-22 12:36:02 +02:00
|
|
|
|
2021-09-28 12:27:14 +02:00
|
|
|
init();
|
2021-07-22 12:36:02 +02:00
|
|
|
|
2021-07-24 10:53:41 +02:00
|
|
|
ovni_ev_set_mcv(&ev, "OB.");
|
|
|
|
|
2021-09-28 12:27:14 +02:00
|
|
|
for(i=0; i<n; i++)
|
2021-07-22 12:36:02 +02:00
|
|
|
{
|
2021-11-16 14:35:39 +01:00
|
|
|
ovni_ev_set_clock(&ev, ovni_clock_now());
|
2021-10-29 17:04:42 +02:00
|
|
|
ovni_ev_emit(&ev);
|
2021-07-22 12:36:02 +02:00
|
|
|
}
|
|
|
|
|
2021-07-24 10:53:41 +02:00
|
|
|
ovni_flush();
|
2021-09-28 12:27:14 +02:00
|
|
|
ovni_proc_fini();
|
2021-07-22 12:36:02 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|