Avoid clang-format in pcf tables

This commit is contained in:
Rodrigo Arias 2022-09-29 18:34:57 +02:00
parent 8370c33194
commit 73aa7887ae

271
src/pcf.c
View File

@ -9,6 +9,8 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
/* clang-format off */
const char *pcf_def_header = const char *pcf_def_header =
"DEFAULT_OPTIONS\n" "DEFAULT_OPTIONS\n"
"\n" "\n"
@ -25,22 +27,22 @@ const char *pcf_def_header =
"\n" "\n"
"THREAD_FUNC State As Is\n"; "THREAD_FUNC State As Is\n";
#define RGB(r, g, b) (r << 16 | g << 8 | b) #define RGB(r, g, b) (r<<16 | g<<8 | b)
#define ARRAY_LEN(x) (sizeof(x) / sizeof((x)[0])) #define ARRAY_LEN(x) (sizeof(x) / sizeof((x)[0]))
/* Define colors for the trace */ /* Define colors for the trace */
#define DEEPBLUE RGB(0, 0, 255) #define DEEPBLUE RGB( 0, 0, 255)
#define LIGHTGREY RGB(217, 217, 217) #define LIGHTGREY RGB(217, 217, 217)
#define RED RGB(230, 25, 75) #define RED RGB(230, 25, 75)
#define GREEN RGB(60, 180, 75) #define GREEN RGB(60, 180, 75)
#define YELLOW RGB(255, 225, 25) #define YELLOW RGB(255, 225, 25)
#define ORANGE RGB(245, 130, 48) #define ORANGE RGB(245, 130, 48)
#define PURPLE RGB(145, 30, 180) #define PURPLE RGB(145, 30, 180)
#define CYAN RGB(70, 240, 240) #define CYAN RGB( 70, 240, 240)
#define MAGENTA RGB(240, 50, 230) #define MAGENTA RGB(240, 50, 230)
#define LIME RGB(210, 245, 60) #define LIME RGB(210, 245, 60)
#define PINK RGB(250, 190, 212) #define PINK RGB(250, 190, 212)
#define TEAL RGB(0, 128, 128) #define TEAL RGB( 0, 128, 128)
#define LAVENDER RGB(220, 190, 255) #define LAVENDER RGB(220, 190, 255)
#define BROWN RGB(170, 110, 40) #define BROWN RGB(170, 110, 40)
#define BEIGE RGB(255, 250, 200) #define BEIGE RGB(255, 250, 200)
@ -48,10 +50,10 @@ const char *pcf_def_header =
#define MINT RGB(170, 255, 195) #define MINT RGB(170, 255, 195)
#define OLIVE RGB(128, 128, 0) #define OLIVE RGB(128, 128, 0)
#define APRICOT RGB(255, 215, 180) #define APRICOT RGB(255, 215, 180)
#define NAVY RGB(0, 0, 128) #define NAVY RGB( 0, 0, 128)
#define BLUE RGB(0, 130, 200) #define BLUE RGB( 0, 130, 200)
#define GREY RGB(128, 128, 128) #define GREY RGB(128, 128, 128)
#define BLACK RGB(0, 0, 0) #define BLACK RGB( 0, 0, 0)
const uint32_t pcf_def_palette[] = { const uint32_t pcf_def_palette[] = {
BLACK, /* (never shown anyways) */ BLACK, /* (never shown anyways) */
@ -61,7 +63,8 @@ const uint32_t pcf_def_palette[] = {
GREEN, GREEN,
YELLOW, ORANGE, PURPLE, CYAN, MAGENTA, LIME, PINK, YELLOW, ORANGE, PURPLE, CYAN, MAGENTA, LIME, PINK,
TEAL, GREY, LAVENDER, BROWN, BEIGE, MAROON, MINT, TEAL, GREY, LAVENDER, BROWN, BEIGE, MAROON, MINT,
OLIVE, APRICOT, NAVY, DEEPBLUE}; OLIVE, APRICOT, NAVY, DEEPBLUE
};
const uint32_t *pcf_palette = pcf_def_palette; const uint32_t *pcf_palette = pcf_def_palette;
const int pcf_palette_len = ARRAY_LEN(pcf_def_palette); const int pcf_palette_len = ARRAY_LEN(pcf_def_palette);
@ -69,136 +72,136 @@ const int pcf_palette_len = ARRAY_LEN(pcf_def_palette);
/* ------------------ Value labels --------------------- */ /* ------------------ Value labels --------------------- */
struct pcf_value_label default_values[] = { struct pcf_value_label default_values[] = {
{ST_TOO_MANY_TH, "Unknown: Multiple threads running"}, { ST_TOO_MANY_TH, "Unknown: Multiple threads running" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label ovni_state_values[] = { struct pcf_value_label ovni_state_values[] = {
{TH_ST_UNKNOWN, "Unknown"}, { TH_ST_UNKNOWN, "Unknown" },
{TH_ST_RUNNING, "Running"}, { TH_ST_RUNNING, "Running" },
{TH_ST_PAUSED, "Paused"}, { TH_ST_PAUSED, "Paused" },
{TH_ST_DEAD, "Dead"}, { TH_ST_DEAD, "Dead" },
{TH_ST_COOLING, "Cooling"}, { TH_ST_COOLING, "Cooling" },
{TH_ST_WARMING, "Warming"}, { TH_ST_WARMING, "Warming" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label ovni_flush_values[] = { struct pcf_value_label ovni_flush_values[] = {
{0, "None"}, { 0, "None" },
{ST_OVNI_FLUSHING, "Flushing"}, { ST_OVNI_FLUSHING, "Flushing" },
{ST_TOO_MANY_TH, "Unknown flushing state: Multiple threads running"}, { ST_TOO_MANY_TH, "Unknown flushing state: Multiple threads running" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label nosv_ss_values[] = { struct pcf_value_label nosv_ss_values[] = {
/* Errors */ /* Errors */
{ST_BAD, "Unknown: bad happened (report bug)"}, { ST_BAD, "Unknown: bad happened (report bug)" },
{ST_TOO_MANY_TH, "Unknown: multiple threads running"}, { ST_TOO_MANY_TH, "Unknown: multiple threads running" },
/* Good values */ /* Good values */
{ST_NULL, "No subsystem"}, { ST_NULL, "No subsystem" },
{ST_NOSV_SCHED_HUNGRY, "Scheduler: Hungry"}, { ST_NOSV_SCHED_HUNGRY, "Scheduler: Hungry" },
{ST_NOSV_SCHED_SERVING, "Scheduler: Serving"}, { ST_NOSV_SCHED_SERVING, "Scheduler: Serving" },
{ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting"}, { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" },
{ST_NOSV_MEM_ALLOCATING, "Memory: Allocating"}, { ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" },
{ST_NOSV_MEM_FREEING, "Memory: Freeing"}, { ST_NOSV_MEM_FREEING, "Memory: Freeing" },
{ST_NOSV_TASK_RUNNING, "Task: Running"}, { ST_NOSV_TASK_RUNNING, "Task: Running" },
{ST_NOSV_API_SUBMIT, "API: Submit"}, { ST_NOSV_API_SUBMIT, "API: Submit" },
{ST_NOSV_API_PAUSE, "API: Pause"}, { ST_NOSV_API_PAUSE, "API: Pause" },
{ST_NOSV_API_YIELD, "API: Yield"}, { ST_NOSV_API_YIELD, "API: Yield" },
{ST_NOSV_API_WAITFOR, "API: Waitfor"}, { ST_NOSV_API_WAITFOR, "API: Waitfor" },
{ST_NOSV_API_SCHEDPOINT, "API: Scheduling point"}, { ST_NOSV_API_SCHEDPOINT, "API: Scheduling point" },
{ST_NOSV_ATTACH, "Thread: Attached"}, { ST_NOSV_ATTACH, "Thread: Attached" },
{ST_NOSV_WORKER, "Thread: Worker"}, { ST_NOSV_WORKER, "Thread: Worker" },
{ST_NOSV_DELEGATE, "Thread: Delegate"}, { ST_NOSV_DELEGATE, "Thread: Delegate" },
{EV_NOSV_SCHED_SEND, "EV Scheduler: Send task"}, { EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" },
{EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task"}, { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" },
{EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task"}, { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label tampi_mode_values[] = { struct pcf_value_label tampi_mode_values[] = {
{ST_NULL, "NULL"}, { ST_NULL, "NULL" },
{ST_TOO_MANY_TH, "TAMPI: Unknown, multiple threads running"}, { ST_TOO_MANY_TH, "TAMPI: Unknown, multiple threads running" },
{ST_TAMPI_SEND, "TAMPI: Send"}, { ST_TAMPI_SEND, "TAMPI: Send" },
{ST_TAMPI_RECV, "TAMPI: Recv"}, { ST_TAMPI_RECV, "TAMPI: Recv" },
{ST_TAMPI_ISEND, "TAMPI: Isend"}, { ST_TAMPI_ISEND, "TAMPI: Isend" },
{ST_TAMPI_IRECV, "TAMPI: Irecv"}, { ST_TAMPI_IRECV, "TAMPI: Irecv" },
{ST_TAMPI_WAIT, "TAMPI: Wait"}, { ST_TAMPI_WAIT, "TAMPI: Wait" },
{ST_TAMPI_WAITALL, "TAMPI: Waitall"}, { ST_TAMPI_WAITALL, "TAMPI: Waitall" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label openmp_mode_values[] = { struct pcf_value_label openmp_mode_values[] = {
{ST_NULL, "NULL"}, { ST_NULL, "NULL" },
{ST_TOO_MANY_TH, "OpenMP: Unknown, multiple threads running"}, { ST_TOO_MANY_TH, "OpenMP: Unknown, multiple threads running" },
{ST_OPENMP_TASK, "OpenMP: Task"}, { ST_OPENMP_TASK, "OpenMP: Task" },
{ST_OPENMP_PARALLEL, "OpenMP: Parallel"}, { ST_OPENMP_PARALLEL, "OpenMP: Parallel" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label nodes_mode_values[] = { struct pcf_value_label nodes_mode_values[] = {
{ST_NULL, "NULL"}, { ST_NULL, "NULL" },
{ST_TOO_MANY_TH, "NODES: Multiple threads running"}, { ST_TOO_MANY_TH, "NODES: Multiple threads running" },
{ST_NODES_REGISTER, "Dependencies: Registering task accesses"}, { ST_NODES_REGISTER, "Dependencies: Registering task accesses" },
{ST_NODES_UNREGISTER, "Dependencies: Unregistering task accesses"}, { ST_NODES_UNREGISTER, "Dependencies: Unregistering task accesses" },
{ST_NODES_IF0_WAIT, "If0: Waiting for an If0 task"}, { ST_NODES_IF0_WAIT, "If0: Waiting for an If0 task" },
{ST_NODES_IF0_INLINE, "If0: Executing an If0 task inline"}, { ST_NODES_IF0_INLINE, "If0: Executing an If0 task inline" },
{ST_NODES_TASKWAIT, "Taskwait: Taskwait"}, { ST_NODES_TASKWAIT, "Taskwait: Taskwait" },
{ST_NODES_CREATE, "Add Task: Creating a task"}, { ST_NODES_CREATE, "Add Task: Creating a task" },
{ST_NODES_SUBMIT, "Add Task: Submitting a task"}, { ST_NODES_SUBMIT, "Add Task: Submitting a task" },
{ST_NODES_SPAWN, "Spawn Function: Spawning a function"}, { ST_NODES_SPAWN, "Spawn Function: Spawning a function" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label kernel_cs_values[] = { struct pcf_value_label kernel_cs_values[] = {
{ST_NULL, "NULL"}, { ST_NULL, "NULL" },
{ST_TOO_MANY_TH, "Unknown: multiple threads running"}, { ST_TOO_MANY_TH, "Unknown: multiple threads running" },
{ST_KERNEL_CSOUT, "Context switch: Out of the CPU"}, { ST_KERNEL_CSOUT, "Context switch: Out of the CPU" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label nanos6_ss_values[] = { struct pcf_value_label nanos6_ss_values[] = {
{ST_NULL, "No subsystem"}, { ST_NULL, "No subsystem" },
{ST_TOO_MANY_TH, "Unknown: multiple threads running"}, { ST_TOO_MANY_TH, "Unknown: multiple threads running" },
{ST_NANOS6_TASK_BODY, "Task: Running body"}, { ST_NANOS6_TASK_BODY, "Task: Running body" },
{ST_NANOS6_TASK_CREATING, "Task: Creating"}, { ST_NANOS6_TASK_CREATING, "Task: Creating" },
{ST_NANOS6_TASK_SUBMIT, "Task: Submitting"}, { ST_NANOS6_TASK_SUBMIT, "Task: Submitting" },
{ST_NANOS6_TASK_SPAWNING, "Task: Spawning function"}, { ST_NANOS6_TASK_SPAWNING, "Task: Spawning function" },
{ST_NANOS6_TASK_FOR, "Task: Running task for"}, { ST_NANOS6_TASK_FOR, "Task: Running task for" },
{ST_NANOS6_SCHED_SERVING, "Scheduler: Serving tasks"}, { ST_NANOS6_SCHED_SERVING, "Scheduler: Serving tasks" },
{ST_NANOS6_SCHED_ADDING, "Scheduler: Adding ready tasks"}, { ST_NANOS6_SCHED_ADDING, "Scheduler: Adding ready tasks" },
{ST_NANOS6_SCHED_PROCESSING, "Scheduler: Processing ready tasks"}, { ST_NANOS6_SCHED_PROCESSING, "Scheduler: Processing ready tasks" },
{ST_NANOS6_DEP_REG, "Dependency: Registering"}, { ST_NANOS6_DEP_REG, "Dependency: Registering" },
{ST_NANOS6_DEP_UNREG, "Dependency: Unregistering"}, { ST_NANOS6_DEP_UNREG, "Dependency: Unregistering" },
{ST_NANOS6_BLK_TASKWAIT, "Blocking: Taskwait"}, { ST_NANOS6_BLK_TASKWAIT, "Blocking: Taskwait" },
{ST_NANOS6_BLK_BLOCKING, "Blocking: Blocking current task"}, { ST_NANOS6_BLK_BLOCKING, "Blocking: Blocking current task" },
{ST_NANOS6_BLK_UNBLOCKING, "Blocking: Unblocking remote task"}, { ST_NANOS6_BLK_UNBLOCKING, "Blocking: Unblocking remote task" },
{ST_NANOS6_BLK_WAITFOR, "Blocking: Wait for deadline"}, { ST_NANOS6_BLK_WAITFOR, "Blocking: Wait for deadline" },
{ST_NANOS6_HANDLING_TASK, "Worker: Handling task"}, { ST_NANOS6_HANDLING_TASK, "Worker: Handling task" },
{ST_NANOS6_WORKER_LOOP, "Worker: Looking for work"}, { ST_NANOS6_WORKER_LOOP, "Worker: Looking for work" },
{ST_NANOS6_SWITCH_TO, "Worker: Switching to another thread"}, { ST_NANOS6_SWITCH_TO, "Worker: Switching to another thread" },
{ST_NANOS6_MIGRATE, "Worker: Migrating CPU"}, { ST_NANOS6_MIGRATE, "Worker: Migrating CPU" },
{ST_NANOS6_SUSPEND, "Worker: Suspending thread"}, { ST_NANOS6_SUSPEND, "Worker: Suspending thread" },
{ST_NANOS6_RESUME, "Worker: Resuming another thread"}, { ST_NANOS6_RESUME, "Worker: Resuming another thread" },
{ST_NANOS6_ALLOCATING, "Memory: Allocating"}, { ST_NANOS6_ALLOCATING, "Memory: Allocating" },
{ST_NANOS6_FREEING, "Memory: Freeing"}, { ST_NANOS6_FREEING, "Memory: Freeing" },
{EV_NANOS6_SCHED_SEND, "EV Scheduler: Send task"}, { EV_NANOS6_SCHED_SEND, "EV Scheduler: Send task" },
{EV_NANOS6_SCHED_RECV, "EV Scheduler: Recv task"}, { EV_NANOS6_SCHED_RECV, "EV Scheduler: Recv task" },
{EV_NANOS6_SCHED_SELF, "EV Scheduler: Self-assign task"}, { EV_NANOS6_SCHED_SELF, "EV Scheduler: Self-assign task" },
{EV_NANOS6_CPU_IDLE, "EV CPU: Becomes idle"}, { EV_NANOS6_CPU_IDLE, "EV CPU: Becomes idle" },
{EV_NANOS6_CPU_ACTIVE, "EV CPU: Becomes active"}, { EV_NANOS6_CPU_ACTIVE, "EV CPU: Becomes active" },
{EV_NANOS6_SIGNAL, "EV Worker: Wakening another thread"}, { EV_NANOS6_SIGNAL, "EV Worker: Wakening another thread" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label nanos6_thread_type[] = { struct pcf_value_label nanos6_thread_type[] = {
{ST_NULL, "No type"}, { ST_NULL, "No type" },
{ST_TOO_MANY_TH, "Unknown: multiple threads running"}, { ST_TOO_MANY_TH, "Unknown: multiple threads running" },
{ST_NANOS6_TH_EXTERNAL, "External"}, { ST_NANOS6_TH_EXTERNAL, "External" },
{ST_NANOS6_TH_WORKER, "Worker"}, { ST_NANOS6_TH_WORKER, "Worker" },
{ST_NANOS6_TH_LEADER, "Leader"}, { ST_NANOS6_TH_LEADER, "Leader" },
{ST_NANOS6_TH_MAIN, "Main"}, { ST_NANOS6_TH_MAIN, "Main" },
{-1, NULL}, { -1, NULL },
}; };
struct pcf_value_label (*pcf_chan_value_labels[CHAN_MAX])[] = { struct pcf_value_label (*pcf_chan_value_labels[CHAN_MAX])[] = {
@ -259,11 +262,7 @@ char *pcf_chan_name[CHAN_MAX] = {
[CHAN_KERNEL_CS] = "Context switches", [CHAN_KERNEL_CS] = "Context switches",
}; };
enum pcf_suffix { NONE = 0, enum pcf_suffix { NONE = 0, CUR_TH, RUN_TH, ACT_TH, SUFFIX_MAX };
CUR_TH,
RUN_TH,
ACT_TH,
SUFFIX_MAX };
char *pcf_suffix_name[SUFFIX_MAX] = { char *pcf_suffix_name[SUFFIX_MAX] = {
[NONE] = "", [NONE] = "",
@ -274,33 +273,35 @@ char *pcf_suffix_name[SUFFIX_MAX] = {
int pcf_chan_suffix[CHAN_MAX][CHAN_MAXTYPE] = { int pcf_chan_suffix[CHAN_MAX][CHAN_MAXTYPE] = {
/* Thread CPU */ /* Thread CPU */
[CHAN_OVNI_PID] = {CUR_TH, CUR_TH}, [CHAN_OVNI_PID] = { CUR_TH, CUR_TH },
[CHAN_OVNI_TID] = {CUR_TH, CUR_TH}, [CHAN_OVNI_TID] = { CUR_TH, CUR_TH },
[CHAN_OVNI_NRTHREADS] = {NONE, NONE}, [CHAN_OVNI_NRTHREADS] = { NONE, NONE },
[CHAN_OVNI_STATE] = {CUR_TH, NONE}, [CHAN_OVNI_STATE] = { CUR_TH, NONE },
[CHAN_OVNI_APPID] = {NONE, RUN_TH}, [CHAN_OVNI_APPID] = { NONE, RUN_TH },
[CHAN_OVNI_CPU] = {CUR_TH, NONE}, [CHAN_OVNI_CPU] = { CUR_TH, NONE },
[CHAN_OVNI_FLUSH] = {CUR_TH, RUN_TH}, [CHAN_OVNI_FLUSH] = { CUR_TH, RUN_TH },
[CHAN_NOSV_TASKID] = {RUN_TH, RUN_TH}, [CHAN_NOSV_TASKID] = { RUN_TH, RUN_TH },
[CHAN_NOSV_TYPE] = {RUN_TH, RUN_TH}, [CHAN_NOSV_TYPE] = { RUN_TH, RUN_TH },
[CHAN_NOSV_APPID] = {RUN_TH, RUN_TH}, [CHAN_NOSV_APPID] = { RUN_TH, RUN_TH },
[CHAN_NOSV_SUBSYSTEM] = {ACT_TH, RUN_TH}, [CHAN_NOSV_SUBSYSTEM] = { ACT_TH, RUN_TH },
[CHAN_NOSV_RANK] = {RUN_TH, RUN_TH}, [CHAN_NOSV_RANK] = { RUN_TH, RUN_TH },
[CHAN_TAMPI_MODE] = {RUN_TH, RUN_TH}, [CHAN_TAMPI_MODE] = { RUN_TH, RUN_TH },
[CHAN_OPENMP_MODE] = {RUN_TH, RUN_TH}, [CHAN_OPENMP_MODE] = { RUN_TH, RUN_TH },
[CHAN_NODES_SUBSYSTEM] = {RUN_TH, RUN_TH}, [CHAN_NODES_SUBSYSTEM] = { RUN_TH, RUN_TH },
[CHAN_NANOS6_TASKID] = {RUN_TH, RUN_TH}, [CHAN_NANOS6_TASKID] = { RUN_TH, RUN_TH },
[CHAN_NANOS6_TYPE] = {RUN_TH, RUN_TH}, [CHAN_NANOS6_TYPE] = { RUN_TH, RUN_TH },
[CHAN_NANOS6_SUBSYSTEM] = {ACT_TH, RUN_TH}, [CHAN_NANOS6_SUBSYSTEM] = { ACT_TH, RUN_TH },
[CHAN_NANOS6_RANK] = {RUN_TH, RUN_TH}, [CHAN_NANOS6_RANK] = { RUN_TH, RUN_TH },
[CHAN_NANOS6_THREAD] = {ACT_TH, NONE}, [CHAN_NANOS6_THREAD] = { ACT_TH, NONE },
[CHAN_KERNEL_CS] = {RUN_TH, ACT_TH}, [CHAN_KERNEL_CS] = { RUN_TH, ACT_TH },
}; };
/* clang-format on */
/* ----------------------------------------------- */ /* ----------------------------------------------- */
static void static void