Define all static PRV types in a global enum

This commit is contained in:
Rodrigo Arias 2023-02-24 11:51:37 +01:00 committed by Rodrigo Arias Mallo
parent 55624d4c68
commit 68690b4127
8 changed files with 65 additions and 22 deletions

View File

@ -8,20 +8,21 @@
#include "value.h"
#include "utlist.h"
#include "pv/pvt.h"
#include "emu_prv.h"
static const char chan_fmt[] = "cpu%ld.%s";
static const char *chan_name[] = {
[CPU_CHAN_NRUN] = "nrunning",
[CPU_CHAN_PID] = "pid_running",
[CPU_CHAN_TID] = "tid_running",
[CPU_CHAN_NRUN] = "nrunning",
[CPU_CHAN_PID] = "pid_running",
[CPU_CHAN_TID] = "tid_running",
[CPU_CHAN_THRUN] = "th_running",
[CPU_CHAN_THACT] = "th_active",
};
static int chan_type[] = {
[CPU_CHAN_PID] = 1,
[CPU_CHAN_TID] = 2,
[CPU_CHAN_NRUN] = 3,
[CPU_CHAN_PID] = PRV_CPU_PID,
[CPU_CHAN_TID] = PRV_CPU_TID,
[CPU_CHAN_NRUN] = PRV_CPU_NRUN,
[CPU_CHAN_THRUN] = -1,
[CPU_CHAN_THACT] = -1,
};

31
src/emu/emu_prv.h Normal file
View File

@ -0,0 +1,31 @@
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef EMU_PRV_H
#define EMU_PRV_H
/* Global table of static PRV types */
enum emu_prv_types {
PRV_CPU_PID = 1,
PRV_CPU_TID = 2,
PRV_CPU_NRUN = 3,
PRV_THREAD_TID = PRV_CPU_TID,
PRV_THREAD_STATE = 4,
PRV_THREAD_CPU = 6,
PRV_OVNI_FLUSH = 7,
PRV_NOSV_TASKID = 10,
PRV_NOSV_TYPE = 11,
PRV_NOSV_APPID = 12,
PRV_NOSV_SUBSYSTEM = 13,
PRV_NOSV_RANK = 14,
PRV_NODES_SUBSYSTEM = 30,
PRV_NANOS6_TASKID = 35,
PRV_NANOS6_TYPE = 36,
PRV_NANOS6_SUBSYSTEM = 37,
PRV_NANOS6_RANK = 38,
PRV_NANOS6_THREAD = 39,
PRV_KERNEL_CS = 45,
PRV_RESERVED = 100,
};
#endif /* EMU_PRV_H */

View File

@ -1,5 +1,7 @@
#include "kernel_priv.h"
#include "emu_prv.h"
static const char model_name[] = "kernel";
enum { model_id = 'K' };
@ -25,7 +27,7 @@ static const int chan_stack[CH_MAX] = {
/* ----------------- pvt ------------------ */
static const int pvt_type[] = {
[CH_CS] = 45,
[CH_CS] = PRV_KERNEL_CS,
};
static const char *pcf_prefix[CH_MAX] = {

View File

@ -1,5 +1,7 @@
#include "nanos6_priv.h"
#include "emu_prv.h"
static const char model_name[] = "nanos6";
enum { model_id = '6' };
@ -31,11 +33,11 @@ static const int chan_stack[CH_MAX] = {
/* ----------------- pvt ------------------ */
static const int pvt_type[] = {
[CH_TASKID] = 35,
[CH_TYPE] = 36,
[CH_SUBSYSTEM] = 37,
[CH_RANK] = 38,
[CH_THREAD] = 39,
[CH_TASKID] = PRV_NANOS6_TASKID,
[CH_TYPE] = PRV_NANOS6_TYPE,
[CH_SUBSYSTEM] = PRV_NANOS6_SUBSYSTEM,
[CH_RANK] = PRV_NANOS6_RANK,
[CH_THREAD] = PRV_NANOS6_THREAD,
};
static const char *pcf_prefix[CH_MAX] = {

View File

@ -1,5 +1,7 @@
#include "nodes_priv.h"
#include "emu_prv.h"
static const char model_name[] = "nodes";
enum { model_id = 'D' };
@ -26,7 +28,7 @@ static const int chan_stack[CH_MAX] = {
/* ----------------- pvt ------------------ */
static const int pvt_type[] = {
[CH_SUBSYSTEM] = 30,
[CH_SUBSYSTEM] = PRV_NODES_SUBSYSTEM,
};
static const char *pcf_prefix[CH_MAX] = {

View File

@ -1,5 +1,7 @@
#include "nosv_priv.h"
#include "emu_prv.h"
static const char model_name[] = "nosv";
enum { model_id = 'V' };
@ -35,11 +37,11 @@ static const int chan_dup[CH_MAX] = {
/* ----------------- pvt ------------------ */
static const int pvt_type[] = {
[CH_TASKID] = 10,
[CH_TYPE] = 11,
[CH_APPID] = 12,
[CH_SUBSYSTEM] = 13,
[CH_RANK] = 14,
[CH_TASKID] = PRV_NOSV_TASKID,
[CH_TYPE] = PRV_NOSV_TYPE,
[CH_APPID] = PRV_NOSV_APPID,
[CH_SUBSYSTEM] = PRV_NOSV_SUBSYSTEM,
[CH_RANK] = PRV_NOSV_RANK,
};
static const char *pcf_prefix[CH_MAX] = {

View File

@ -1,5 +1,7 @@
#include "ovni_priv.h"
#include "emu_prv.h"
static const char model_name[] = "ovni";
enum { model_id = 'O' };
@ -24,7 +26,7 @@ static const int chan_stack[CH_MAX] = { 0 };
/* ----------------- pvt ------------------ */
static const int pvt_type[] = {
[CH_FLUSH] = 7,
[CH_FLUSH] = PRV_OVNI_FLUSH,
};
static const char *pcf_prefix[CH_MAX] = {

View File

@ -3,6 +3,7 @@
#include "thread.h"
#include "emu_prv.h"
#include "path.h"
#include "bay.h"
#include <errno.h>
@ -15,9 +16,9 @@ static const char *chan_name[] = {
};
static const int chan_type[] = {
[TH_CHAN_CPU] = 6,
[TH_CHAN_TID] = 2,
[TH_CHAN_STATE] = 4,
[TH_CHAN_CPU] = PRV_THREAD_CPU,
[TH_CHAN_TID] = PRV_THREAD_TID,
[TH_CHAN_STATE] = PRV_THREAD_STATE,
};
static const long prv_flags[] = {