IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42897


Ignore:
Timestamp:
Jun 17, 2025, 4:31:01 PM (13 months ago)
Author:
eugene
Message:

add pcontrol hoststats command (and stats for host I/O rates)

Location:
tags/ipp-unions-20250528/Ohana/src/opihi
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/Makefile

    r42895 r42897  
    7676$(SRC)/controller_jobstack.$(ARCH).o \
    7777$(SRC)/controller_hoststack.$(ARCH).o \
     78$(SRC)/controller_hoststats.$(ARCH).o \
    7879$(SRC)/controller_machines.$(ARCH).o \
    7980$(SRC)/controller_parameters.$(ARCH).o \
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/controller.c

    r42895 r42897  
    66int controller_jobstack   PROTO((int, char **));
    77int controller_hoststack  PROTO((int, char **));
     8int controller_hoststats  PROTO((int, char **));
    89int controller_machines   PROTO((int, char **));
    910int controller_parameters PROTO((int, char **));
     
    2324  {1, "host",      controller_host,       "define host for controller"},
    2425  {1, "hoststack", controller_hoststack,  "define host for controller"},
     26  {1, "hoststats", controller_hoststats,  "show processing stats for each host"},
    2527  // {1, "job",       controller_job,      "add jobs to controller"},
    2628  {1, "jobstack",  controller_jobstack,   "check controller status"},
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/controller_hoststack.c

    r42895 r42897  
    99  if (argc != 2) {
    1010    gprint (GP_ERR, "USAGE: controller hoststack (hoststack)\n");
    11     gprint (GP_ERR, "       (hoststack) : idle, busy, done, down, off\n");
     11    gprint (GP_ERR, "       (hoststack) : all, idle, busy, done, down, off, resp\n");
    1212    return (FALSE);
    1313  }
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/CheckSystem.c

    r42895 r42897  
    131131      CheckLiveHosts(0.040);
    132132      // fprintf (stderr, "sleep a bit\n");
    133       usleep (100000); // idle if no jobs are waiting
     133      usleep (10000); // idle if no jobs are waiting
    134134    } else {
    135135      // if we only have busy jobs, pause a moment before trying again
    136136      if (!Ndonejobs) {
    137137        // fprintf (stderr, "sleep a bit\n");
    138         usleep (100000);
     138        usleep (10000);
    139139      }
    140140    }
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/GetJobOutput.c

    r20047 r42897  
    1212  int i, status;
    1313  struct timespec request, remain;
     14
     15  struct timeval start;
     16  gettimeofday (&start, (void *) NULL);
    1417
    1518  ASSERT (command, "command missing");
     
    3033  }
    3134
    32   if (output[0].completed) return PCLIENT_GOOD;
     35  if (output[0].completed) {
     36    struct timeval stop;
     37    gettimeofday (&stop, (void *) NULL);
     38   
     39    float dtime = DTIME (stop, start);
     40    host[0].read_time += dtime;
     41    host[0].read_N_GetJobOutput ++;
     42    return PCLIENT_GOOD;
     43  }
    3344
    3445  // attempt to read the output->size bytes from the host
     
    4253      if (status == 0) {
    4354          if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
     55          struct timeval stop;
     56          gettimeofday (&stop, (void *) NULL);
     57   
     58          float dtime = DTIME (stop, start);
     59          host[0].read_time += dtime;
     60          host[0].read_N_GetJobOutput ++;
    4461          return PCLIENT_DOWN;
    4562      }
    4663      if (output[0].buffer.Nbuffer < output[0].size) {
    4764          if (VerboseMode()) gprint (GP_ERR, "host %s still has data, keep trying\n", host[0].hostname);
     65          struct timeval stop;
     66          gettimeofday (&stop, (void *) NULL);
     67   
     68          float dtime = DTIME (stop, start);
     69          host[0].read_time += dtime;
     70          host[0].read_N_GetJobOutput ++;
    4871          return PCLIENT_HUNG;
    4972      }
     
    6184  if (status == 0) {
    6285    if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
     86
     87    struct timeval stop;
     88    gettimeofday (&stop, (void *) NULL);
     89   
     90    float dtime = DTIME (stop, start);
     91    host[0].read_time += dtime;
     92    host[0].read_N_GetJobOutput ++;
     93
    6394    return PCLIENT_DOWN;
    6495  }
    6596  if (line == NULL) {
    6697    if (VerboseMode()) gprint (GP_ERR, "host %s not yet at prompt, keep trying\n", host[0].hostname);
     98
     99    struct timeval stop;
     100    gettimeofday (&stop, (void *) NULL);
     101   
     102    float dtime = DTIME (stop, start);
     103    host[0].read_time += dtime;
     104    host[0].read_N_GetJobOutput ++;
     105
    67106    return PCLIENT_HUNG;
    68107  }
     108
     109  struct timeval stop;
     110  gettimeofday (&stop, (void *) NULL);
     111   
     112  float dtime = DTIME (stop, start);
     113  host[0].read_time += dtime;
     114  host[0].read_N_GetJobOutput ++;
    69115
    70116  output[0].completed = TRUE;
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/HostOps.c

    r34844 r42897  
    211211  host[0].response = NULL;
    212212
     213  host[0].read_time = 0.0;
     214  host[0].read_N_Pclient = 0;
     215  host[0].read_N_GetJobOutput = 0;
     216  host[0].N_jobs_total = 0;
     217
    213218  host[0].markoff  = FALSE;
    214219  host[0].job      = NULL;
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/Makefile

    r42895 r42897  
    5151$(SRC)/jobstack.$(ARCH).o \
    5252$(SRC)/hoststack.$(ARCH).o \
     53$(SRC)/hoststats.$(ARCH).o \
    5354$(SRC)/kill.$(ARCH).o \
    5455$(SRC)/pulse.$(ARCH).o \
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/PclientCommand.c

    r37070 r42897  
    4545  struct timespec request, remain;
    4646
     47  struct timeval start;
     48  gettimeofday (&start, (void *) NULL);
     49
    4750  ASSERT (response != NULL, "response missing");
    4851  ASSERT (buffer != NULL, "buffer missing");
     
    6467    if (status == -1) nanosleep (&request, &remain);
    6568  }
     69
     70  struct timeval stop;
     71  gettimeofday (&stop, (void *) NULL);
     72
     73  float dtime = DTIME (stop, start);
     74  host[0].read_time += dtime;
     75  host[0].read_N_Pclient ++;
     76
    6677  if (status ==  0) {
    6778    gprint (GP_ERR, "pclient read returns 0 for %s\n", response);
     
    6980  }
    7081  if (line == NULL) {
    71       // MARKTIME ("-- client hung (line NULL): %s : %f sec\n", host[0].hostname, dtime);
    72       return (PCLIENT_HUNG);
     82    // this is really a timeout: data was received, but not the full message, in the allotted time (0.1 sec),
     83    // MARKTIME ("-- client hung (line NULL): %s : %f sec\n", host[0].hostname, dtime);
     84    return (PCLIENT_HUNG);
    7385  }
    7486  if (status == -1) {
    75       // MARKTIME ("-- client hung (status -1): %s : %f sec\n", host[0].hostname, dtime);
    76       return (PCLIENT_HUNG);
     87    // this is really a timeout: no response was received in the allotted time (0.1 sec),
     88    // MARKTIME ("-- client hung (status -1): %s : %f sec\n", host[0].hostname, dtime);
     89    return (PCLIENT_HUNG);
    7790  }
    7891
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/StackOps.c

    r39457 r42897  
    5252/* this code correctly handles the negative 'where' and Nobject == 0 */
    5353
     54static int   Np_PushStack = 0;
     55static float dT_PushStack = 0.0;
     56
     57void Stats_PushStack (int reset) {
     58
     59  gprint (GP_LOG, "CPS: Npass: %d, time: %f\n", Np_PushStack, dT_PushStack);
     60
     61  if (reset) {
     62    Np_PushStack = 0;
     63    dT_PushStack = 0.0;
     64  }
     65}
     66
    5467/* push object on stack at given location */
    5568int PushStack (Stack *stack, int where, void *object, int id, char *name) {
     
    6073  ASSERT (stack != NULL, "stack not set");
    6174  LockStack (stack);
     75
     76  struct timeval start, stop;
     77  gettimeofday (&start, (void *) NULL);
    6278
    6379  if (where < 0) where += stack[0].Nobject + 1;
     
    89105  stack[0].Nobject ++;
    90106
     107  gettimeofday (&stop, (void *) NULL);
     108  float dtime = DTIME (stop, start);
     109  dT_PushStack += dtime;
     110  Np_PushStack ++;
     111
    91112  UnlockStack (stack);
    92113  return (TRUE);
    93114}
    94115
     116static int   Np_PullStackLoc = 0;
     117static float dT_PullStackLoc = 0.0;
     118
     119void Stats_PullStackLoc (int reset) {
     120
     121  gprint (GP_LOG, "CLS: Npass: %d, time: %f\n", Np_PullStackLoc, dT_PullStackLoc);
     122
     123  if (reset) {
     124    Np_PullStackLoc = 0;
     125    dT_PullStackLoc = 0.0;
     126  }
     127}
     128
    95129/* get object from specified point in stack (negative == distance from end) */
    96130void *PullStackByLocation (Stack *stack, int where) {
     
    102136  LockStack (stack);
    103137
     138  struct timeval start, stop;
     139  gettimeofday (&start, (void *) NULL);
     140
    104141  if (where < 0) where += stack[0].Nobject;
    105142  if (where < 0) {
     
    114151  object = stack[0].object[where];
    115152  RemoveStackEntry (stack, where);
     153
     154  gettimeofday (&stop, (void *) NULL);
     155  float dtime = DTIME (stop, start);
     156  dT_PullStackLoc += dtime;
     157  Np_PullStackLoc ++;
     158
    116159  UnlockStack (stack);
    117160  return (object);
     
    141184}
    142185
     186static int   Np_PullStack = 0;
     187static float dT_PullStack = 0.0;
     188
     189void Stats_PullStack (int reset) {
     190
     191  gprint (GP_LOG, "CpS: Npass: %d, time: %f\n", Np_PullStack, dT_PullStack);
     192
     193  if (reset) {
     194    Np_PullStack = 0;
     195    dT_PullStack = 0.0;
     196  }
     197}
     198
    143199/* get object from point in stack (negative == distance from end) */
    144200void *PullStackByID (Stack *stack, int id) {
     
    150206  ASSERT (stack != NULL, "stack not set");
    151207  LockStack (stack);
     208
     209  struct timeval start, stop;
     210  gettimeofday (&start, (void *) NULL);
    152211
    153212  for (i = 0; i < stack[0].Nobject; i++) {
     
    157216    object = stack[0].object[i];
    158217    RemoveStackEntry (stack, i);
     218
     219    gettimeofday (&stop, (void *) NULL);
     220    float dtime = DTIME (stop, start);
     221    dT_PullStack += dtime;
     222    Np_PullStack ++;
     223
    159224    UnlockStack (stack);
    160225    return (object);
    161226  }
     227
     228  gettimeofday (&stop, (void *) NULL);
     229  float dtime = DTIME (stop, start);
     230  dT_PullStack += dtime;
     231  Np_PullStack ++;
     232
    162233  UnlockStack (stack);
    163234  return (NULL);
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/StartJob.c

    r36623 r42897  
    6262      job[0].pid = -1;
    6363      gettimeofday (&job[0].start, (void *) NULL);
     64      host[0].N_jobs_total ++;
    6465
    6566      if (VerboseMode()) gprint (GP_ERR, "started job on host %s\n", host[0].hostname); 
     
    9596      PutHost (host, PCONTROL_HOST_BUSY, STACK_BOTTOM);
    9697      PutJob (job, PCONTROL_JOB_BUSY, STACK_BOTTOM);
    97       gettimeofday (&job[0].start, NULL);
     98      // XXX this time stamp overrides the original start of the command, in StartJob
     99      // gettimeofday (&job[0].start, NULL);
    98100      return (TRUE);
    99101  }
     
    122124      PutHost (host, PCONTROL_HOST_BUSY, STACK_BOTTOM);
    123125      PutJob (job, PCONTROL_JOB_BUSY, STACK_BOTTOM);
    124       gettimeofday (&job[0].start, NULL);
     126      // XXX this time stamp overrides the original start of the command, in StartJob
     127      // gettimeofday (&job[0].start, NULL);
    125128      return (TRUE);
    126129  }
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/hoststack.c

    r8296 r42897  
    99  if (argc != 2) {
    1010    gprint (GP_ERR, "USAGE: hoststack (hoststack)\n");
    11     gprint (GP_ERR, "       (hoststack) : idle, busy, done, down, off\n");
     11    gprint (GP_ERR, "       (hoststack) : all, idle, busy, done, down, off, resp\n");
    1212    return (FALSE);
    1313  }
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/init.c

    r42895 r42897  
    55int host        PROTO((int, char **));
    66int hoststack   PROTO((int, char **));
     7int hoststats   PROTO((int, char **));
    78int job         PROTO((int, char **));
    89int jobstack    PROTO((int, char **));
     
    2627  {1, "host",       host,       "add / delete / modify host"},
    2728  {1, "hoststack",  hoststack,  "list hosts for a single stack"},
     29  {1, "hoststats",  hoststats,  "list host statistics for a single stack"},
    2830  {1, "job",        job,        "add job"},
    2931  {1, "jobstack",   jobstack,   "list jobs for a single stack"},
  • tags/ipp-unions-20250528/Ohana/src/opihi/pcontrol/pcstats.c

    r42895 r42897  
    2626  Stats_CheckLiveHosts (Reset);
    2727
     28  Stats_PushStack (Reset);
     29  Stats_PullStack (Reset);
     30  Stats_PullStackLoc (Reset);
     31
    2832  return (TRUE);
    2933
Note: See TracChangeset for help on using the changeset viewer.