Add include-what-you-use
Adds forwards declarations in headers and includes all headers in sources, even if they are found by transitive includes.
This commit is contained in:
parent
e471df9c1a
commit
ddbb7dd9f4
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC)
|
||||
# Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
@ -15,6 +15,7 @@ add_compile_options(-Wall -Wextra -Wformat
|
||||
)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_C_EXTENSIONS FALSE)
|
||||
|
||||
option(ENABLE_DEBUG_LOG "Enable debug messages (very verbose)")
|
||||
@ -23,6 +24,8 @@ if(ENABLE_DEBUG_LOG)
|
||||
add_definitions(-DENABLE_DEBUG)
|
||||
endif()
|
||||
|
||||
add_definitions(-D_POSIX_C_SOURCE=200809L)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
||||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Asan UBsan." FORCE)
|
||||
@ -59,6 +62,15 @@ set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_DEBUG} \
|
||||
set(CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined"
|
||||
CACHE STRING "Flags used by the C compiler during UndefinedBehaviorSanitizer builds." FORCE)
|
||||
|
||||
find_program(IWYU NAMES include-what-you-use iwyu)
|
||||
|
||||
if(IWYU)
|
||||
set(IWYU_CMD ${IWYU} -Xiwyu --no_comments)
|
||||
set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_CMD})
|
||||
else()
|
||||
message(WARNING "IWYU not found, skipping")
|
||||
endif()
|
||||
|
||||
# Required for clock_gettime() in glibc <= 2.17
|
||||
include(CheckLibraryExists)
|
||||
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *progname = NULL;
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
#define COMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Debug macros */
|
||||
|
||||
|
@ -4,7 +4,9 @@
|
||||
//#define ENABLE_DEBUG
|
||||
|
||||
#include "bay.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "uthash.h"
|
||||
#include "utlist.h"
|
||||
|
@ -4,15 +4,12 @@
|
||||
#ifndef BAY_H
|
||||
#define BAY_H
|
||||
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "uthash.h"
|
||||
struct chan;
|
||||
|
||||
/* Handle connections between channels and callbacks */
|
||||
|
||||
struct bay;
|
||||
struct bay_cb;
|
||||
struct bay_chan;
|
||||
|
||||
enum bay_cb_type {
|
||||
BAY_CB_DIRTY = 0,
|
||||
BAY_CB_EMIT,
|
||||
|
@ -4,9 +4,10 @@
|
||||
//#define ENABLE_DEBUG
|
||||
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
void
|
||||
chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...)
|
||||
|
@ -4,8 +4,9 @@
|
||||
#ifndef CHAN_H
|
||||
#define CHAN_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
#include "value.h"
|
||||
struct chan;
|
||||
|
||||
#define MAX_CHAN_STACK 512
|
||||
#define MAX_CHAN_NAME 512
|
||||
@ -39,8 +40,6 @@ union chan_data {
|
||||
struct value value;
|
||||
};
|
||||
|
||||
struct chan;
|
||||
|
||||
typedef int (*chan_cb_t)(struct chan *chan, void *ptr);
|
||||
|
||||
struct chan {
|
||||
|
@ -2,9 +2,10 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "clkoff.h"
|
||||
|
||||
#include "common.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
static struct clkoff_entry *
|
||||
cfind(struct clkoff *off, const char *name)
|
||||
|
@ -4,12 +4,12 @@
|
||||
#ifndef CLKOFF_H
|
||||
#define CLKOFF_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "uthash.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
struct clkoff_entry {
|
||||
int64_t index;
|
||||
char name[PATH_MAX];
|
||||
|
@ -2,13 +2,20 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
#include "loom.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "bay.h"
|
||||
#include "chan.h"
|
||||
#include "value.h"
|
||||
#include "utlist.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "emu_prv.h"
|
||||
#include "loom.h"
|
||||
#include "proc.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "recorder.h"
|
||||
#include "thread.h"
|
||||
#include "utlist.h"
|
||||
#include "value.h"
|
||||
|
||||
static const char chan_fmt[] = "cpu%ld.%s";
|
||||
static const char *chan_name[] = {
|
||||
|
@ -4,17 +4,18 @@
|
||||
#ifndef CPU_H
|
||||
#define CPU_H
|
||||
|
||||
struct cpu; /* Needed for thread and loom */
|
||||
struct loom;
|
||||
|
||||
#include "thread.h"
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "chan.h"
|
||||
#include "track.h"
|
||||
#include "bay.h"
|
||||
#include "uthash.h"
|
||||
#include "recorder.h"
|
||||
#include "common.h"
|
||||
#include "extend.h"
|
||||
#include <linux/limits.h>
|
||||
#include "uthash.h"
|
||||
struct bay;
|
||||
struct loom;
|
||||
struct pcf_type;
|
||||
struct recorder;
|
||||
struct thread;
|
||||
|
||||
enum cpu_chan {
|
||||
CPU_CHAN_NRUN = 0,
|
||||
|
@ -1,14 +1,13 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _POSIX_C_SOURCE 2
|
||||
|
||||
//#define ENABLE_DEBUG
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "emu_ev.h"
|
||||
#include "models.h"
|
||||
#include "stream.h"
|
||||
|
||||
int
|
||||
emu_init(struct emu *emu, int argc, char *argv[])
|
||||
|
@ -5,14 +5,14 @@
|
||||
#define EMU_H
|
||||
|
||||
#include "bay.h"
|
||||
#include "trace.h"
|
||||
#include "common.h"
|
||||
#include "emu_args.h"
|
||||
#include "system.h"
|
||||
#include "player.h"
|
||||
#include "model.h"
|
||||
#include "emu_ev.h"
|
||||
#include "recorder.h"
|
||||
#include "emu_stat.h"
|
||||
#include "model.h"
|
||||
#include "player.h"
|
||||
#include "recorder.h"
|
||||
#include "system.h"
|
||||
#include "trace.h"
|
||||
|
||||
struct emu {
|
||||
struct bay bay;
|
||||
|
@ -1,14 +1,13 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _POSIX_C_SOURCE 2
|
||||
|
||||
#include "emu_args.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "path.h"
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static char progname[] = "ovniemu";
|
||||
static char version[] = "1.0.0";
|
||||
|
@ -2,6 +2,7 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "emu_ev.h"
|
||||
#include "ovni.h"
|
||||
|
||||
void
|
||||
emu_ev(struct emu_ev *ev, const struct ovni_ev *oev,
|
||||
|
@ -4,8 +4,9 @@
|
||||
#ifndef EMU_EV_H
|
||||
#define EMU_EV_H
|
||||
|
||||
#include "ovni.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
struct ovni_ev;
|
||||
|
||||
/* Easier to parse emulation event */
|
||||
struct emu_ev {
|
||||
|
@ -1,12 +1,11 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
|
||||
#include "emu_stat.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "common.h"
|
||||
#include "player.h"
|
||||
|
||||
static double
|
||||
get_time(void)
|
||||
|
@ -4,7 +4,8 @@
|
||||
#ifndef EMU_STAT_H
|
||||
#define EMU_STAT_H
|
||||
|
||||
#include "player.h"
|
||||
#include <stdint.h>
|
||||
struct player;
|
||||
|
||||
/* Easier to parse emulation event */
|
||||
struct emu_stat {
|
||||
|
@ -2,11 +2,19 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "kernel_priv.h"
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_ev.h"
|
||||
#include "extend.h"
|
||||
#include "model_thread.h"
|
||||
#include "thread.h"
|
||||
#include "value.h"
|
||||
|
||||
static int
|
||||
context_switch(struct emu *emu)
|
||||
{
|
||||
struct kernel_thread *th = EXT(emu->thread, 'K');
|
||||
struct kernel_thread *th = extend_get(&emu->thread->ext, 'K');
|
||||
struct chan *ch = &th->m.ch[CH_CS];
|
||||
|
||||
switch (emu->ev->v) {
|
||||
|
@ -2,8 +2,19 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "kernel_priv.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_prv.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_cpu.h"
|
||||
#include "model_pvt.h"
|
||||
#include "model_thread.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "system.h"
|
||||
#include "track.h"
|
||||
|
||||
static const char model_name[] = "kernel";
|
||||
enum { model_id = 'K' };
|
||||
|
@ -2,14 +2,13 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "loom.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cpu.h"
|
||||
#include "proc.h"
|
||||
#include "thread.h"
|
||||
#include "uthash.h"
|
||||
#include "utlist.h"
|
||||
#include "path.h"
|
||||
#include "proc.h"
|
||||
#include "uthash.h"
|
||||
|
||||
static const char *loom_prefix = "loom.";
|
||||
|
||||
|
@ -4,16 +4,14 @@
|
||||
#ifndef LOOM_H
|
||||
#define LOOM_H
|
||||
|
||||
struct loom;
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <linux/limits.h>
|
||||
#include <sys/types.h>
|
||||
#include "cpu.h"
|
||||
#include "proc.h"
|
||||
#include "thread.h"
|
||||
#include "common.h"
|
||||
#include "cpu.h"
|
||||
#include "extend.h"
|
||||
struct proc;
|
||||
|
||||
struct loom {
|
||||
size_t gindex;
|
||||
|
@ -2,9 +2,13 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cpu.h"
|
||||
#include "loom.h"
|
||||
#include "ovni.h"
|
||||
#include "parson.h"
|
||||
#include "proc.h"
|
||||
|
||||
static JSON_Object *
|
||||
load_json(const char *path)
|
||||
|
@ -4,9 +4,9 @@
|
||||
#ifndef METADATA_H
|
||||
#define METADATA_H
|
||||
|
||||
#include "loom.h"
|
||||
#include "proc.h"
|
||||
#include "common.h"
|
||||
struct loom;
|
||||
struct proc;
|
||||
|
||||
USE_RET int metadata_load(const char *path, struct loom *loom, struct proc *proc);
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
//#define ENABLE_DEBUG
|
||||
|
||||
#include "model.h"
|
||||
|
||||
#include "common.h"
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
struct emu;
|
||||
|
||||
void
|
||||
model_init(struct model *model)
|
||||
|
@ -4,8 +4,9 @@
|
||||
#ifndef MODEL_H
|
||||
#define MODEL_H
|
||||
|
||||
#include "emu_hook.h"
|
||||
#include "common.h"
|
||||
#include "emu_hook.h"
|
||||
struct emu;
|
||||
|
||||
struct model_spec {
|
||||
const char *name;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#ifndef MODEL_CHAN_H
|
||||
#define MODEL_CHAN_H
|
||||
|
||||
#include "model_pvt.h"
|
||||
struct model_pvt_spec;
|
||||
|
||||
struct model_chan_spec {
|
||||
int nch;
|
||||
|
@ -2,8 +2,21 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "model_cpu.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "cpu.h"
|
||||
#include "emu.h"
|
||||
#include "extend.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_pvt.h"
|
||||
#include "model_thread.h"
|
||||
#include "system.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
struct bay;
|
||||
|
||||
static struct model_cpu *
|
||||
get_model_cpu(struct cpu *cpu, int id)
|
||||
|
@ -4,14 +4,9 @@
|
||||
#ifndef MODEL_CPU_H
|
||||
#define MODEL_CPU_H
|
||||
|
||||
struct model_cpu_spec;
|
||||
|
||||
#include "emu.h"
|
||||
#include "bay.h"
|
||||
#include "track.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include <stddef.h>
|
||||
#include "common.h"
|
||||
struct emu;
|
||||
|
||||
struct model_cpu_spec {
|
||||
size_t size;
|
||||
|
@ -2,6 +2,22 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "model_pvt.h"
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "cpu.h"
|
||||
#include "emu.h"
|
||||
#include "extend.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_cpu.h"
|
||||
#include "model_thread.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "recorder.h"
|
||||
#include "system.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
|
||||
static const char *pcf_suffix[TRACK_TH_MAX] = {
|
||||
[TRACK_TH_ANY] = "",
|
||||
|
@ -4,9 +4,10 @@
|
||||
#ifndef MODEL_PRV_H
|
||||
#define MODEL_PRV_H
|
||||
|
||||
#include "emu.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "common.h"
|
||||
struct emu;
|
||||
struct model_cpu_spec;
|
||||
struct model_thread_spec;
|
||||
|
||||
struct model_pvt_spec {
|
||||
const int *type;
|
||||
@ -16,9 +17,6 @@ struct model_pvt_spec {
|
||||
const struct pcf_value_label **label;
|
||||
};
|
||||
|
||||
#include "model_cpu.h"
|
||||
#include "model_thread.h"
|
||||
|
||||
USE_RET int model_pvt_connect_cpu(struct emu *emu, const struct model_cpu_spec *spec);
|
||||
USE_RET int model_pvt_connect_thread(struct emu *emu, const struct model_thread_spec *spec);
|
||||
|
||||
|
@ -2,8 +2,19 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "model_thread.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "bay.h"
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "extend.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_pvt.h"
|
||||
#include "system.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
|
||||
static int
|
||||
init_chan(struct model_thread *th, const struct model_chan_spec *spec, int64_t gindex)
|
||||
|
@ -4,14 +4,9 @@
|
||||
#ifndef MODEL_THREAD_H
|
||||
#define MODEL_THREAD_H
|
||||
|
||||
struct model_thread_spec;
|
||||
|
||||
#include "emu.h"
|
||||
#include "bay.h"
|
||||
#include "track.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include <stddef.h>
|
||||
#include "common.h"
|
||||
struct emu;
|
||||
|
||||
struct model_thread_spec {
|
||||
size_t size;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "models.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "model.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
extern struct model_spec model_ovni;
|
||||
|
@ -4,7 +4,8 @@
|
||||
#ifndef MODELS_H
|
||||
#define MODELS_H
|
||||
|
||||
#include "model.h"
|
||||
#include "common.h"
|
||||
struct model;
|
||||
|
||||
USE_RET int models_register(struct model *model);
|
||||
|
||||
|
@ -4,6 +4,10 @@
|
||||
//#define ENABLE_DEBUG
|
||||
|
||||
#include "mux.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "bay.h"
|
||||
#include "chan.h"
|
||||
|
||||
static int
|
||||
default_select(struct mux *mux,
|
||||
|
@ -5,9 +5,10 @@
|
||||
#define MUX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bay.h"
|
||||
#include "uthash.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "value.h"
|
||||
struct bay;
|
||||
struct chan;
|
||||
struct mux;
|
||||
|
||||
struct mux_input {
|
||||
|
@ -2,6 +2,19 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nanos6_priv.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_ev.h"
|
||||
#include "extend.h"
|
||||
#include "model_thread.h"
|
||||
#include "ovni.h"
|
||||
#include "proc.h"
|
||||
#include "task.h"
|
||||
#include "thread.h"
|
||||
#include "value.h"
|
||||
|
||||
enum { PUSH = 1, POP = 2, IGN = 3 };
|
||||
|
||||
|
@ -2,8 +2,29 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nanos6_priv.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_args.h"
|
||||
#include "emu_prv.h"
|
||||
#include "extend.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_cpu.h"
|
||||
#include "model_pvt.h"
|
||||
#include "model_thread.h"
|
||||
#include "proc.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "recorder.h"
|
||||
#include "system.h"
|
||||
#include "task.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
#include "value.h"
|
||||
|
||||
static const char model_name[] = "nanos6";
|
||||
enum { model_id = '6' };
|
||||
|
@ -2,6 +2,14 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nodes_priv.h"
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_ev.h"
|
||||
#include "extend.h"
|
||||
#include "model_thread.h"
|
||||
#include "thread.h"
|
||||
#include "value.h"
|
||||
|
||||
enum { PUSH = 1, POP = 2, IGN = 3 };
|
||||
|
||||
|
@ -2,8 +2,24 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nodes_priv.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_args.h"
|
||||
#include "emu_prv.h"
|
||||
#include "extend.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_cpu.h"
|
||||
#include "model_pvt.h"
|
||||
#include "model_thread.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "system.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
#include "value.h"
|
||||
|
||||
static const char model_name[] = "nodes";
|
||||
enum { model_id = 'D' };
|
||||
|
@ -2,6 +2,19 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nosv_priv.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_ev.h"
|
||||
#include "extend.h"
|
||||
#include "model_thread.h"
|
||||
#include "ovni.h"
|
||||
#include "proc.h"
|
||||
#include "task.h"
|
||||
#include "thread.h"
|
||||
#include "value.h"
|
||||
|
||||
enum { PUSH = 1, POP = 2, IGN = 3 };
|
||||
|
||||
|
@ -2,8 +2,29 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nosv_priv.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_args.h"
|
||||
#include "emu_prv.h"
|
||||
#include "extend.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_cpu.h"
|
||||
#include "model_pvt.h"
|
||||
#include "model_thread.h"
|
||||
#include "proc.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "recorder.h"
|
||||
#include "system.h"
|
||||
#include "task.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
#include "value.h"
|
||||
|
||||
static const char model_name[] = "nosv";
|
||||
enum { model_id = 'V' };
|
||||
|
@ -4,10 +4,20 @@
|
||||
//#define ENABLE_DEBUG
|
||||
|
||||
#include "ovni_priv.h"
|
||||
|
||||
#include "emu.h"
|
||||
#include "loom.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "cpu.h"
|
||||
#include "emu.h"
|
||||
#include "emu_ev.h"
|
||||
#include "extend.h"
|
||||
#include "loom.h"
|
||||
#include "model_thread.h"
|
||||
#include "ovni.h"
|
||||
#include "proc.h"
|
||||
#include "thread.h"
|
||||
#include "value.h"
|
||||
|
||||
static int
|
||||
pre_thread_execute(struct emu *emu, struct thread *th)
|
||||
|
@ -2,8 +2,20 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "ovni_priv.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "common.h"
|
||||
#include "emu.h"
|
||||
#include "emu_prv.h"
|
||||
#include "model.h"
|
||||
#include "model_chan.h"
|
||||
#include "model_cpu.h"
|
||||
#include "model_pvt.h"
|
||||
#include "model_thread.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "system.h"
|
||||
#include "thread.h"
|
||||
#include "track.h"
|
||||
|
||||
static const char model_name[] = "ovni";
|
||||
enum { model_id = 'O' };
|
||||
|
@ -1,11 +1,15 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "emu_ev.h"
|
||||
#include "ovni.h"
|
||||
#include "player.h"
|
||||
#include "stream.h"
|
||||
#include "trace.h"
|
||||
|
||||
char *tracedir;
|
||||
|
@ -11,23 +11,14 @@
|
||||
* that we will look back is limited by N.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/limits.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "emu.h"
|
||||
#include "common.h"
|
||||
#include "ovni.h"
|
||||
#include "stream.h"
|
||||
#include "trace.h"
|
||||
|
||||
struct ring {
|
||||
|
@ -1,20 +1,16 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <mpi.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ovni.h"
|
||||
|
||||
const char progname[] = "ovnisync";
|
||||
|
@ -2,8 +2,11 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "player.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "heap.h"
|
||||
#include "stream.h"
|
||||
#include "trace.h"
|
||||
#include "utlist.h"
|
||||
|
||||
/*
|
||||
|
@ -4,10 +4,11 @@
|
||||
#ifndef EMU_PLAYER_H
|
||||
#define EMU_PLAYER_H
|
||||
|
||||
#include "trace.h"
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
#include "emu_ev.h"
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include "heap.h"
|
||||
struct trace;
|
||||
|
||||
struct player {
|
||||
struct trace *trace;
|
||||
|
@ -2,10 +2,11 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "proc.h"
|
||||
|
||||
#include "utlist.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "path.h"
|
||||
#include <errno.h>
|
||||
#include "thread.h"
|
||||
|
||||
static int
|
||||
get_pid(const char *id, int *pid)
|
||||
|
@ -4,14 +4,14 @@
|
||||
#ifndef PROC_H
|
||||
#define PROC_H
|
||||
|
||||
/* No loom dependency here */
|
||||
#include "thread.h"
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
#include "extend.h"
|
||||
#include "parson.h"
|
||||
#include "uthash.h"
|
||||
#include "extend.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <linux/limits.h>
|
||||
struct loom;
|
||||
struct thread;
|
||||
|
||||
struct proc {
|
||||
int64_t gindex;
|
||||
|
@ -1,17 +1,13 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
|
||||
#include "cfg.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <linux/limits.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "pcf.h"
|
||||
|
||||
#include "common.h"
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
|
@ -4,15 +4,12 @@
|
||||
#ifndef PCF_H
|
||||
#define PCF_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "uthash.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_PCF_LABEL 512
|
||||
|
||||
struct pcf_value;
|
||||
struct pcf_type;
|
||||
|
||||
struct pcf_value {
|
||||
int value;
|
||||
char label[MAX_PCF_LABEL];
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "prf.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
int
|
||||
|
@ -5,7 +5,11 @@
|
||||
|
||||
#include "prv.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "bay.h"
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
|
||||
static void
|
||||
write_header(FILE *f, long long duration, int nrows)
|
||||
|
@ -4,12 +4,13 @@
|
||||
#ifndef PRV_H
|
||||
#define PRV_H
|
||||
|
||||
#include "chan.h"
|
||||
#include "bay.h"
|
||||
#include "uthash.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct prv;
|
||||
#include "common.h"
|
||||
#include "uthash.h"
|
||||
#include "value.h"
|
||||
struct bay;
|
||||
struct chan;
|
||||
|
||||
enum prv_flags {
|
||||
PRV_EMITDUP = 1<<0, /* Emit duplicates (no error, emit) */
|
||||
|
@ -2,6 +2,11 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "pvt.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prf.h"
|
||||
#include "pv/prv.h"
|
||||
|
||||
int
|
||||
pvt_open(struct pvt *pvt, long nrows, const char *dir, const char *name)
|
||||
|
@ -4,11 +4,13 @@
|
||||
#ifndef PVT_H
|
||||
#define PVT_H
|
||||
|
||||
#include "prv.h"
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
#include "pcf.h"
|
||||
#include "prf.h"
|
||||
#include "prv.h"
|
||||
#include "uthash.h"
|
||||
#include <linux/limits.h>
|
||||
|
||||
struct pvt {
|
||||
char dir[PATH_MAX];
|
||||
|
@ -1,11 +1,13 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define ENABLE_DEBUG
|
||||
|
||||
#include "recorder.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "pv/cfg.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "uthash.h"
|
||||
|
||||
int
|
||||
recorder_init(struct recorder *rec, const char *dir)
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
/* Records data into files (Paraver traces only for now) */
|
||||
|
||||
#include "pv/pvt.h"
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
|
||||
struct recorder {
|
||||
char dir[PATH_MAX]; /* To place the traces */
|
||||
|
@ -2,13 +2,14 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "ovni.h"
|
||||
#include "path.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int
|
||||
check_stream_header(struct stream *stream)
|
||||
|
@ -4,12 +4,11 @@
|
||||
#ifndef STREAM_H
|
||||
#define STREAM_H
|
||||
|
||||
#include "ovni.h"
|
||||
#include "heap.h"
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
struct stream;
|
||||
#include "common.h"
|
||||
#include "heap.h"
|
||||
struct ovni_ev;
|
||||
|
||||
struct stream {
|
||||
struct ovni_ev *cur_ev;
|
||||
|
@ -2,9 +2,26 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "system.h"
|
||||
#include "utlist.h"
|
||||
#include "metadata.h"
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cpu.h"
|
||||
#include "emu_args.h"
|
||||
#include "loom.h"
|
||||
#include "metadata.h"
|
||||
#include "proc.h"
|
||||
#include "pv/prf.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "recorder.h"
|
||||
#include "stream.h"
|
||||
#include "thread.h"
|
||||
#include "trace.h"
|
||||
#include "uthash.h"
|
||||
#include "utlist.h"
|
||||
struct bay;
|
||||
|
||||
static struct thread *
|
||||
create_thread(struct proc *proc, const char *relpath)
|
||||
|
@ -4,16 +4,14 @@
|
||||
#ifndef EMU_SYSTEM_H
|
||||
#define EMU_SYSTEM_H
|
||||
|
||||
#include "emu_args.h"
|
||||
#include "trace.h"
|
||||
#include "stream.h"
|
||||
#include "loom.h"
|
||||
#include "proc.h"
|
||||
#include "thread.h"
|
||||
#include "cpu.h"
|
||||
#include "clkoff.h"
|
||||
#include "recorder.h"
|
||||
#include <stddef.h>
|
||||
#include "clkoff.h"
|
||||
#include "common.h"
|
||||
struct bay;
|
||||
struct emu_args;
|
||||
struct recorder;
|
||||
struct stream;
|
||||
struct trace;
|
||||
|
||||
/* Map from stream to lpt */
|
||||
struct lpt {
|
||||
|
@ -2,7 +2,10 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "task.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "thread.h"
|
||||
#include "utlist.h"
|
||||
|
||||
struct task *
|
||||
|
@ -5,9 +5,9 @@
|
||||
#define TASK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "uthash.h"
|
||||
#include "common.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "thread.h"
|
||||
#include "uthash.h"
|
||||
|
||||
enum task_state {
|
||||
TASK_ST_CREATED,
|
||||
|
@ -2,11 +2,21 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "thread.h"
|
||||
|
||||
#include "emu_prv.h"
|
||||
#include "path.h"
|
||||
#include "bay.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "bay.h"
|
||||
#include "cpu.h"
|
||||
#include "emu_prv.h"
|
||||
#include "mux.h"
|
||||
#include "path.h"
|
||||
#include "pv/pcf.h"
|
||||
#include "pv/prv.h"
|
||||
#include "pv/pvt.h"
|
||||
#include "recorder.h"
|
||||
#include "value.h"
|
||||
struct proc;
|
||||
|
||||
static const char chan_fmt[] = "thread%lu.%s";
|
||||
static const char *chan_name[] = {
|
||||
|
@ -4,18 +4,21 @@
|
||||
#ifndef THREAD_H
|
||||
#define THREAD_H
|
||||
|
||||
struct thread; /* Needed for cpu */
|
||||
|
||||
#include "cpu.h"
|
||||
#include "proc.h"
|
||||
#include "chan.h"
|
||||
#include "bay.h"
|
||||
#include "uthash.h"
|
||||
#include "recorder.h"
|
||||
#include "extend.h"
|
||||
#include "mux.h"
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <linux/limits.h>
|
||||
#include <stdint.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "extend.h"
|
||||
#include "uthash.h"
|
||||
struct bay;
|
||||
struct cpu;
|
||||
struct mux;
|
||||
struct mux_input;
|
||||
struct pcf;
|
||||
struct proc;
|
||||
struct recorder;
|
||||
struct value;
|
||||
|
||||
/* Emulated thread runtime status */
|
||||
enum thread_state {
|
||||
|
@ -4,11 +4,14 @@
|
||||
#define _XOPEN_SOURCE 500
|
||||
|
||||
#include "trace.h"
|
||||
#include "utlist.h"
|
||||
#include "path.h"
|
||||
#include <ftw.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ftw.h>
|
||||
#include "ovni.h"
|
||||
#include "path.h"
|
||||
#include "stream.h"
|
||||
#include "utlist.h"
|
||||
|
||||
/* See the nftw(3) manual to see why we need a global variable here:
|
||||
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/nftw.html */
|
||||
|
@ -4,9 +4,8 @@
|
||||
#ifndef EMU_TRACE_H
|
||||
#define EMU_TRACE_H
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include <limits.h>
|
||||
#include "common.h"
|
||||
|
||||
struct trace {
|
||||
char tracedir[PATH_MAX];
|
||||
|
@ -2,9 +2,10 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "track.h"
|
||||
|
||||
#include "thread.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "bay.h"
|
||||
#include "thread.h"
|
||||
|
||||
static const char *th_suffix[TRACK_TH_MAX] = {
|
||||
[TRACK_TH_ANY] = ".any",
|
||||
|
@ -4,7 +4,11 @@
|
||||
#ifndef TRACK_H
|
||||
#define TRACK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "chan.h"
|
||||
#include "common.h"
|
||||
#include "mux.h"
|
||||
struct bay;
|
||||
|
||||
enum track_type {
|
||||
TRACK_TYPE_TH = 0,
|
||||
|
@ -4,19 +4,49 @@
|
||||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
pid_t gettid(void);
|
||||
|
||||
/* Define gettid for older glibc versions (below 2.30) */
|
||||
#if defined(__GLIBC__)
|
||||
#if !__GLIBC_PREREQ(2, 30)
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static inline pid_t
|
||||
gettid(void)
|
||||
{
|
||||
return (pid_t) syscall(SYS_gettid);
|
||||
}
|
||||
|
||||
#endif /* !__GLIBC_PREREQ(2, 30) */
|
||||
#endif /* defined(__GLIBC__) */
|
||||
|
||||
/* usleep is deprecated */
|
||||
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
static inline int
|
||||
sleep_us(long usec)
|
||||
{
|
||||
struct timespec ts;
|
||||
int res;
|
||||
|
||||
if (usec < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ts.tv_sec = usec / 1000000L;
|
||||
ts.tv_nsec = (usec % 1000000L) * 1000L;
|
||||
|
||||
do {
|
||||
res = nanosleep(&ts, &ts);
|
||||
} while (res && errno == EINTR);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif /* COMPAT_H */
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: MIT */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
@ -1,20 +1,18 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: MIT */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "compat.h"
|
||||
#include "ovni.h"
|
||||
#include "parson.h"
|
||||
#include "version.h"
|
||||
|
@ -1,6 +1,13 @@
|
||||
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
|
||||
# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
function(test_emu)
|
||||
ovni_test(${ARGN})
|
||||
target_link_libraries("${OVNI_TEST_NAME}"
|
||||
PRIVATE instr-static)
|
||||
endfunction()
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(ovni)
|
||||
add_subdirectory(nosv)
|
||||
add_subdirectory(nanos6)
|
||||
|
11
test/emu/common/CMakeLists.txt
Normal file
11
test/emu/common/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
add_library(instr-static STATIC instr.c)
|
||||
target_include_directories(instr-static
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/src"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/src/include"
|
||||
PRIVATE "${CMAKE_SOURCE_DIR}/include"
|
||||
)
|
||||
target_link_libraries(ovni-static parson-static common-static)
|
@ -4,20 +4,13 @@
|
||||
#ifndef INSTR_H
|
||||
#define INSTR_H
|
||||
|
||||
#define _GNU_SOURCE /* For gethostname() */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "common.h"
|
||||
#include "compat.h"
|
||||
#include "ovni.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern int first_clock_set;
|
||||
extern int64_t first_clock;
|
||||
extern int64_t last_clock;
|
||||
@ -88,7 +81,7 @@ instr_start(int rank, int nranks)
|
||||
char hostname[OVNI_MAX_HOSTNAME];
|
||||
char rankname[OVNI_MAX_HOSTNAME + 64];
|
||||
|
||||
if (gethostname(hostname, HOST_NAME_MAX) != 0)
|
||||
if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0)
|
||||
die("gethostname failed");
|
||||
|
||||
sprintf(rankname, "%s.%d", hostname, rank);
|
@ -1,12 +1,12 @@
|
||||
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
|
||||
# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
ovni_test(nested-tasks.c)
|
||||
ovni_test(nested-tasks-bad.c SHOULD_FAIL
|
||||
test_emu(nested-tasks.c)
|
||||
test_emu(nested-tasks-bad.c SHOULD_FAIL
|
||||
REGEX "cannot execute task 1: state is not created")
|
||||
ovni_test(task-types.c MP)
|
||||
ovni_test(blocking.c MP)
|
||||
ovni_test(ss-mismatch.c SHOULD_FAIL
|
||||
test_emu(task-types.c MP)
|
||||
test_emu(blocking.c MP)
|
||||
test_emu(ss-mismatch.c SHOULD_FAIL
|
||||
REGEX "thread [0-9]\\+ ended with 1 stacked nanos6 subsystems")
|
||||
ovni_test(delayed-connect-ss.c)
|
||||
ovni_test(switch-same-type.c)
|
||||
test_emu(delayed-connect-ss.c)
|
||||
test_emu(switch-same-type.c)
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "compat.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
int
|
||||
@ -17,13 +21,13 @@ main(void)
|
||||
instr_nanos6_type_create(typeid);
|
||||
|
||||
instr_nanos6_task_create_and_execute(taskid, typeid);
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
instr_nanos6_block_enter();
|
||||
instr_nanos6_task_pause(taskid);
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
instr_nanos6_task_resume(taskid);
|
||||
instr_nanos6_block_exit();
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
instr_nanos6_task_end(taskid);
|
||||
instr_nanos6_task_body_exit();
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "emu_prv.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
#include "nanos6/nanos6_priv.h"
|
||||
|
||||
int
|
||||
|
@ -4,7 +4,7 @@
|
||||
#ifndef INSTR_NANOS6_H
|
||||
#define INSTR_NANOS6_H
|
||||
|
||||
#include "../instr.h"
|
||||
#include "instr.h"
|
||||
|
||||
#include "task.h"
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
int
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include "compat.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
int
|
||||
@ -17,7 +20,7 @@ main(void)
|
||||
for (int i = 0; i < ntasks; i++) {
|
||||
instr_nanos6_handle_task_enter();
|
||||
instr_nanos6_task_create_and_execute(i + 1, typeid);
|
||||
usleep(500);
|
||||
sleep_us(500);
|
||||
}
|
||||
|
||||
/* End the tasks in the opposite order */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
int
|
||||
|
@ -1,9 +1,12 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "emu_prv.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "compat.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nanos6.h"
|
||||
|
||||
int
|
||||
@ -19,7 +22,7 @@ main(void)
|
||||
|
||||
for (int i = 0; i < ntasks; i++) {
|
||||
instr_nanos6_task_create_and_execute(i + 1, (i % ntypes) + 1);
|
||||
usleep(500);
|
||||
sleep_us(500);
|
||||
instr_nanos6_task_end(i + 1);
|
||||
instr_nanos6_task_body_exit();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
|
||||
# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
ovni_test(nested-tasks.c)
|
||||
ovni_test(nested-tasks-bad.c SHOULD_FAIL
|
||||
test_emu(nested-tasks.c)
|
||||
test_emu(nested-tasks-bad.c SHOULD_FAIL
|
||||
REGEX "cannot execute task 1: state is not created")
|
||||
ovni_test(task-types.c MP)
|
||||
ovni_test(pause.c MP)
|
||||
ovni_test(mp-rank.c MP)
|
||||
ovni_test(switch-same-type.c)
|
||||
test_emu(task-types.c MP)
|
||||
test_emu(pause.c MP)
|
||||
test_emu(mp-rank.c MP)
|
||||
test_emu(switch-same-type.c)
|
||||
|
@ -4,7 +4,7 @@
|
||||
#ifndef INSTR_NOSV_H
|
||||
#define INSTR_NOSV_H
|
||||
|
||||
#include "../instr.h"
|
||||
#include "instr.h"
|
||||
|
||||
#include "task.h"
|
||||
|
||||
|
@ -1,19 +1,13 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "compat.h"
|
||||
#include "ovni.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include "compat.h"
|
||||
#include "ovni.h"
|
||||
|
||||
static void
|
||||
fail(const char *msg)
|
||||
@ -52,9 +46,9 @@ instr_thread_end(void)
|
||||
static inline void
|
||||
instr_start(int rank, int nranks)
|
||||
{
|
||||
char hostname[HOST_NAME_MAX];
|
||||
char hostname[OVNI_MAX_HOSTNAME];
|
||||
|
||||
if (gethostname(hostname, HOST_NAME_MAX) != 0)
|
||||
if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0)
|
||||
fail("gethostname failed");
|
||||
|
||||
ovni_proc_init(1, hostname, getpid());
|
||||
@ -125,7 +119,7 @@ task(int32_t id, uint32_t typeid, int us)
|
||||
ovni_payload_add(&ev, (uint8_t *) &id, sizeof(id));
|
||||
ovni_ev_emit(&ev);
|
||||
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include "instr.h"
|
||||
#include "instr_nosv.h"
|
||||
|
||||
int
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include "compat.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nosv.h"
|
||||
|
||||
static void
|
||||
@ -10,7 +13,7 @@ create_and_run(int32_t id, uint32_t typeid, int us)
|
||||
/* Change subsystem to prevent duplicates */
|
||||
instr_nosv_submit_enter();
|
||||
instr_nosv_task_execute(id);
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "compat.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nosv.h"
|
||||
|
||||
int
|
||||
@ -16,11 +20,11 @@ main(void)
|
||||
instr_nosv_type_create(typeid);
|
||||
instr_nosv_task_create(1, typeid);
|
||||
instr_nosv_task_execute(1);
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
instr_nosv_task_pause(1);
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
instr_nosv_task_resume(1);
|
||||
usleep(us);
|
||||
sleep_us(us);
|
||||
instr_nosv_task_end(1);
|
||||
|
||||
instr_end();
|
||||
|
@ -1,9 +1,12 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "instr_nosv.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "common.h"
|
||||
#include "emu_prv.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nosv.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "compat.h"
|
||||
#include "instr.h"
|
||||
#include "instr_nosv.h"
|
||||
|
||||
int
|
||||
@ -20,7 +23,7 @@ main(void)
|
||||
for (int i = 0; i < ntasks; i++) {
|
||||
instr_nosv_task_create(i + 1, (i % ntypes) + 1);
|
||||
instr_nosv_task_execute(i + 1);
|
||||
usleep(500);
|
||||
sleep_us(500);
|
||||
instr_nosv_task_end(i + 1);
|
||||
}
|
||||
|
||||
|
@ -3,17 +3,17 @@
|
||||
|
||||
# Only run performance sensitive tests on Release builds
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
ovni_test(flush-overhead.c)
|
||||
test_emu(flush-overhead.c)
|
||||
endif()
|
||||
|
||||
ovni_test(flush.c)
|
||||
ovni_test(sort.c SORT)
|
||||
ovni_test(empty-sort.c SORT)
|
||||
ovni_test(sort-first-and-full-ring.c SORT
|
||||
test_emu(flush.c)
|
||||
test_emu(sort.c SORT)
|
||||
test_emu(empty-sort.c SORT)
|
||||
test_emu(sort-first-and-full-ring.c SORT
|
||||
SHOULD_FAIL REGEX "cannot find a event previous to clock")
|
||||
ovni_test(burst-stats.c REGEX "burst stats: median/avg/max = 33/ 33/ 33 ns")
|
||||
ovni_test(mp-simple.c MP)
|
||||
ovni_test(version-good.c)
|
||||
ovni_test(version-bad.c SHOULD_FAIL REGEX "version mismatch")
|
||||
ovni_test(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate")
|
||||
ovni_test(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs")
|
||||
test_emu(burst-stats.c REGEX "burst stats: median/avg/max = 33/ 33/ 33 ns")
|
||||
test_emu(mp-simple.c MP)
|
||||
test_emu(version-good.c)
|
||||
test_emu(version-bad.c SHOULD_FAIL REGEX "version mismatch")
|
||||
test_emu(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate")
|
||||
test_emu(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs")
|
||||
|
@ -1,21 +1,10 @@
|
||||
/* Copyright (c) 2021-2023 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 "instr.h"
|
||||
#include "ovni.h"
|
||||
#include "../instr.h"
|
||||
|
||||
static void
|
||||
emit(char *mcv, uint64_t clock)
|
||||
@ -41,7 +30,7 @@ main(void)
|
||||
|
||||
/* Sleep a bit to prevent unsorted events */
|
||||
while (ovni_clock_now() < t)
|
||||
usleep(10);
|
||||
sleep_us(10);
|
||||
|
||||
instr_end();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user