From c74ab17d2feafe19973f05b8dc5c60afdb27e55c Mon Sep 17 00:00:00 2001 From: "vdeo@aorts" Date: Wed, 20 Sep 2023 08:56:46 +0000 Subject: [PATCH 1/2] Increase max allowed FPS kwnodes past 1000. Add tracepoints. --- src/CommandLineInterface/fps/fps_connect.c | 16 ++++++++++-- src/CommandLineInterface/fps/fps_scan.c | 26 ++++++++----------- .../function_parameters.h | 4 +-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/CommandLineInterface/fps/fps_connect.c b/src/CommandLineInterface/fps/fps_connect.c index 8a502c01..d873d49d 100644 --- a/src/CommandLineInterface/fps/fps_connect.c +++ b/src/CommandLineInterface/fps/fps_connect.c @@ -35,6 +35,8 @@ long function_parameter_struct_connect( int fpsconnectmode ) { + DEBUG_TRACEPOINT("Launching function_parameter_struct_connect for %s", name); + int stringmaxlen = 500; char SM_fname[stringmaxlen]; int SM_fd; // shared memory file descriptor @@ -106,7 +108,7 @@ long function_parameter_struct_connect( { PRINT_ERROR("snprintf error"); } - DEBUG_TRACEPOINT("File : %s\n", SM_fname); + DEBUG_TRACEPOINT("File: %s\n", SM_fname); SM_fd = open(SM_fname, O_RDWR); if(SM_fd == -1) { @@ -117,6 +119,7 @@ long function_parameter_struct_connect( { fps->SMfd = SM_fd; } + DEBUG_TRACEPOINT("File: %s - attempting mapping\n", SM_fname); struct stat file_stat; fstat(SM_fd, &file_stat); @@ -136,6 +139,8 @@ long function_parameter_struct_connect( exit(EXIT_FAILURE); } + DEBUG_TRACEPOINT("File: %s - attempting connect\n", SM_fname); + if(fpsconnectmode == FPSCONNECT_CONF) { fps->md->confpid = getpid(); // write process PID into FPS @@ -157,6 +162,8 @@ long function_parameter_struct_connect( printf(" Connected to %s, %ld entries\n", SM_fname, NBparamMAX); fflush(stdout); + DEBUG_TRACEPOINT("File: %s - successful connect.\n", SM_fname); + // decompose full name into pname and indices int NBi = 0; char tmpstring[stringmaxlen]; @@ -195,6 +202,8 @@ long function_parameter_struct_connect( pch = strtok(NULL, "-"); } + DEBUG_TRACEPOINT("File: %s - Successful fps parse.\n", SM_fname); + fps->md->NBnameindex = NBi; // count active parameters @@ -207,7 +216,8 @@ long function_parameter_struct_connect( } } fps->NBparamActive = pactivecnt; - + + DEBUG_TRACEPOINT("File: %s - Successful parameter count.\n", SM_fname); //function_parameter_printlist(fps->parray, NBparamMAX); if((fpsconnectmode == FPSCONNECT_CONF) || @@ -225,6 +235,7 @@ long function_parameter_struct_connect( } } } + DEBUG_TRACEPOINT("File: %s - Successful LoadStream.\n", SM_fname); // if available, get process settings from FPS entries if(fpsconnectmode == FPSCONNECT_RUN) @@ -384,6 +395,7 @@ long function_parameter_struct_connect( } } } + DEBUG_TRACEPOINT("File: %s - Successful termination of function_parameter_struct_connect.\n", SM_fname); return (NBparamMAX); } diff --git a/src/CommandLineInterface/fps/fps_scan.c b/src/CommandLineInterface/fps/fps_scan.c index 22d63b51..ebe1e3c3 100644 --- a/src/CommandLineInterface/fps/fps_scan.c +++ b/src/CommandLineInterface/fps/fps_scan.c @@ -149,6 +149,8 @@ errno_t functionparameter_scan_fps( { char *pch = strstr(dir->d_name, ".fps.shm"); + DEBUG_TRACEPOINT("Processing fps file %s\n", dir->d_name); + int matchOK = 0; // name filtering @@ -354,7 +356,7 @@ errno_t functionparameter_scan_fps( - + DEBUG_TRACEPOINT("A tracepoint here (%s); fpskeep = %d\n", dir->d_name, fpskeep); if(fpskeep == 1) { @@ -378,6 +380,7 @@ errno_t functionparameter_scan_fps( // scan existing nodes looking for match for(kwnindex = 0; kwnindex < NBkwn; kwnindex++) { + if(keywnode[kwnindex].keywordlevel == level) // levels have to match { @@ -458,11 +461,7 @@ errno_t functionparameter_scan_fps( if(verbose > 0) { printf( - "CREATI" - "NG " - "NODE " - "%d ", - kwnindex); + "CREATING NODE %d ", kwnindex); } keywnode[kwnindex].keywordlevel = level; @@ -489,29 +488,24 @@ errno_t functionparameter_scan_fps( tmpstring); } } + if(verbose > 0) { - printf( - " %d " - "%d\n", + printf(" %d %d -- %s\n", keywnode[kwnindex].keywordlevel, - fps[fpsindex] - .parray[pindex0] - .keywordlevel); + fps[fpsindex].parray[pindex0].keywordlevel, + keywnode[kwnindex].keywordfull); } if(keywnode[kwnindex].keywordlevel == fps[fpsindex].parray[pindex0].keywordlevel) { - // strcpy(keywnode[kwnindex].keywordfull, fps[fpsindex].parray[i].keywordfull); - keywnode[kwnindex].leaf = 1; keywnode[kwnindex].fpsindex = fpsindex; keywnode[kwnindex].pindex = pindex0; } else { - keywnode[kwnindex].leaf = 0; keywnode[kwnindex].fpsindex = fpsindex; keywnode[kwnindex].pindex = 0; @@ -526,6 +520,8 @@ errno_t functionparameter_scan_fps( } } + DEBUG_TRACEPOINT("Another tracepoint %s\n", dir->d_name); + if(verbose > 0) { printf("--- FPS %4d %-20s %ld parameters\n", diff --git a/src/CommandLineInterface/function_parameters.h b/src/CommandLineInterface/function_parameters.h index fbfe7c4c..456233ca 100644 --- a/src/CommandLineInterface/function_parameters.h +++ b/src/CommandLineInterface/function_parameters.h @@ -641,8 +641,8 @@ typedef struct int scheduler_wrowstart; } FPSCTRL_PROCESS_VARS; -#define NB_KEYWNODE_MAX 1000 -#define MAX_NB_CHILD 500 +#define NB_KEYWNODE_MAX 6000 +#define MAX_NB_CHILD 3000 typedef struct { From 7a13fa2ca7cca3736203e1f139db49099d830bb5 Mon Sep 17 00:00:00 2001 From: "vdeo@aorts" Date: Wed, 20 Sep 2023 08:57:51 +0000 Subject: [PATCH 2/2] Fix include deadlock over CLOCK_TAI through milkDebugTools.h --- src/CommandLineInterface/milkDebugTools.h | 3 ++- src/CommandLineInterface/timeutils.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CommandLineInterface/milkDebugTools.h b/src/CommandLineInterface/milkDebugTools.h index b86d009a..10bd11dc 100644 --- a/src/CommandLineInterface/milkDebugTools.h +++ b/src/CommandLineInterface/milkDebugTools.h @@ -17,6 +17,7 @@ typedef int errno_t; #endif #include "CommandLineInterface/CLIcore/CLIcore_signals.h" +#include "CommandLineInterface/timeutils.h" // error mode // defines function behavior on error @@ -227,7 +228,7 @@ typedef int errno_t; abort(); \ } \ data.testpoint.line = __LINE__; \ - clock_gettime(CLOCK_MILK, &data.testpoint.time); \ + clock_gettime(CLOCK_MILK, &data.testpoint.time); \ } while (0) /** diff --git a/src/CommandLineInterface/timeutils.h b/src/CommandLineInterface/timeutils.h index 1272f7d6..c7146948 100644 --- a/src/CommandLineInterface/timeutils.h +++ b/src/CommandLineInterface/timeutils.h @@ -5,17 +5,19 @@ #ifndef _CLICORE_TIMEUTILS_H #define _CLICORE_TIMEUTILS_H -#include "CommandLineInterface/CLIcore.h" // errno_t +//#include // errno_t // holds "%04d-%02d-%02dT%02d:%02d:%02d.%09ldZ" + \0 + 1 char extra #define TIMESTRINGLEN 32 - // handles leap seconds better than CLOCK_REALTIME #define CLOCK_MILK CLOCK_TAI #define TZ_MILK_STR "HST" // Name of timezone to use in FITS headers. #define TZ_MILK_UTC_OFF -36000.0 // Offset east of UTC in seconds for TZ_MILK_STR +// Don't move above #definitions, this an unresolved circular import of hell +#include "CommandLineInterface/CLIcore.h" // errno_t + errno_t milk_clock_gettime(struct timespec *tnow_p); errno_t mkUTtimestring_nanosec(char *timestring, struct timespec tnow);