Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/milk-org/milk into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oguyon committed Sep 20, 2023
2 parents ae85981 + 7a13fa2 commit 76e4815
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
16 changes: 14 additions & 2 deletions src/CommandLineInterface/fps/fps_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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];
Expand Down Expand Up @@ -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
Expand All @@ -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) ||
Expand All @@ -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)
Expand Down Expand Up @@ -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);
}
26 changes: 11 additions & 15 deletions src/CommandLineInterface/fps/fps_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{

Expand All @@ -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
{
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/CommandLineInterface/function_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion src/CommandLineInterface/milkDebugTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

/**
Expand Down
6 changes: 4 additions & 2 deletions src/CommandLineInterface/timeutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
#ifndef _CLICORE_TIMEUTILS_H
#define _CLICORE_TIMEUTILS_H

#include "CommandLineInterface/CLIcore.h" // errno_t
//#include <errno.h> // 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);
Expand Down

0 comments on commit 76e4815

Please sign in to comment.