IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42886


Ignore:
Timestamp:
Jun 3, 2025, 5:02:21 PM (14 months ago)
Author:
eugene
Message:

add ptstats to monitor throughput of pantasks

Location:
tags/ipp-unions-20250528/Ohana/src/opihi/pantasks
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/CheckController.c

    r40424 r42886  
    11# include "pantasks.h"
    22
    3 void TimerMark (struct timeval *start);
    4 float TimerElapsed (struct timeval *start, int reset);
     3static int NjobsTotalSum = 0;
     4static int NpassTotalSum = 0;
     5static float NtimeTotalSum = 0.0;
     6
     7void CheckControllerStats (int reset) {
     8
     9  gprint (GP_LOG, "CC: Npass: %d, Njobs: %d, rate: %f\n",
     10          NpassTotalSum, NjobsTotalSum, NjobsTotalSum / NtimeTotalSum);
     11
     12  if (reset) {
     13    NjobsTotalSum = 0;
     14    NpassTotalSum = 0;
     15    NtimeTotalSum = 0.0;
     16  }
     17}
    518
    619int CheckController () {
     
    1124  Job *job;
    1225  IOBuffer buffer;
    13   struct timeval start;
    1426
    1527  /* get the list of completed jobs (exit / crash), update the job status */
    1628  if (!CheckControllerStatus()) return (TRUE);
    1729
     30  // count the number of times this function was called while controller was active
     31  NpassTotalSum ++;
     32 
    1833  /*** check EXIT jobs ***/
    1934  InitIOBuffer (&buffer, 0x100);
    2035
     36  struct timeval start;
    2137  TimerMark (&start);
    2238  FlushIOBuffer (&buffer);
     
    7995  if (VerboseMode()) gprint (GP_ERR, "clear %d exit jobs %f\n", i, TimerElapsed(&start, TRUE));
    8096
     97  // track the number of jobs actually cleared (might not equal number in the list)
     98  int NjobsExit = i;
     99
    81100  /*** check CRASH jobs ***/
    82101  FlushIOBuffer (&buffer);
     
    130149  if (VerboseMode()) gprint (GP_ERR, "clear %d crash jobs %f\n", i, TimerElapsed(&start, TRUE));
    131150
     151  // add in the crash jobs actually cleared (i, not Njobs) and increment the time
     152  NjobsTotalSum += i + NjobsExit;
     153  NtimeTotalSum += TimerElapsed(&start, TRUE);
     154
    132155  FlushIOBuffer (&buffer);
    133156  FreeIOBuffer (&buffer);
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/CheckJobs.c

    r38986 r42886  
    11# include "pantasks.h"
    22static int Ncheck = 0;
     3
     4static int NjobsTotalSum = 0;
     5static int NpassTotalSum = 0;
     6static float NtimeTotalSum = 0.0;
     7
     8void CheckJobsStats (int reset) {
     9
     10  gprint (GP_LOG, "CJ: Npass: %d, Njobs: %d, rate: %f\n",
     11          NpassTotalSum, NjobsTotalSum, NjobsTotalSum / NtimeTotalSum);
     12
     13  if (reset) {
     14    NjobsTotalSum = 0;
     15    NpassTotalSum = 0;
     16    NtimeTotalSum = 0.0;
     17  }
     18}
    319
    420float CheckJobs () {
     
    1531  Ncheck ++;
    1632
     33  // count the number of times this function was called while controller was active
     34  NpassTotalSum ++;
     35 
     36  struct timeval start;
     37  TimerMark (&start);
     38
    1739  // actual maximum delay is controlled in job_threads.c
    1840  next_timeout = 1.0;
     41
     42  int NjobsCheck = 0;
    1943
    2044  JobTaskLock();
    2145  /** test all jobs: ready to test?  finished? **/
    2246  while ((job = NextJob ()) != NULL) {
     47    NjobsCheck ++;
    2348
    2449    task = job[0].task;
     
    221246
    222247  JobTaskUnlock();
     248
     249  NjobsTotalSum += NjobsCheck;
     250  NtimeTotalSum += TimerElapsed(&start, TRUE);
     251
    223252  return (next_timeout);
    224253}
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/CheckTasks.c

    r41483 r42886  
    11# include "pantasks.h"
    22static int Ncheck = 0;
     3
     4static int NtaskTotalSum = 0;
     5static int NpassTotalSum = 0;
     6static float NtimeTotalSum = 0.0;
     7
     8void CheckTasksStats (int reset) {
     9
     10  gprint (GP_LOG, "CT: Npass: %d, Ntask: %d, rate: %f\n",
     11          NpassTotalSum, NtaskTotalSum, NtaskTotalSum / NtimeTotalSum);
     12
     13  if (reset) {
     14    NtaskTotalSum = 0;
     15    NpassTotalSum = 0;
     16    NtimeTotalSum = 0.0;
     17  }
     18}
    319
    420float CheckTasks () {
     
    1127  Ncheck ++;
    1228
     29  // count the number of times this function was called while controller was active
     30  NpassTotalSum ++;
     31 
     32  struct timeval start;
     33  TimerMark (&start);
     34
    1335  // actual maximum delay is controlled in job_threads.c
    1436  next_timeout = 1.0;
     37
     38  int NtaskCheck = 0;
    1539
    1640  JobTaskLock();
    1741  /** test all tasks: ready to test? ready to run? **/
    1842  while ((task = NextTask ()) != NULL) {
     43    NtaskCheck ++;
    1944
    2045    /*** test for all reasons we should skip this task ***/
     
    6085      JobTaskUnlock();
    6186      CommandLock();
     87      // XXX measure time to execute this loop?
    6288      status = exec_loop (task[0].exec);
    6389      CommandUnlock();
     
    7197    /* check if there are errors with this task */
    7298    if (!ValidateTask (task, TRUE)) {
     99      // XXX increment Nskipexec here?  If we skip because the task.exec did not generate a valid
     100      // command + host, then we need to know...
    73101      continue;
    74102    }
     
    77105    job = CreateJob (task);
    78106    if (!job) {
     107      // this failure should not happen : jobID is not valid, probably a programming error
    79108      continue;
    80109    }
     
    84113    /* execute job */
    85114    if (!SubmitJob (job)) {
     115      // this can only fail if there is a communication error with the controller, or if pcontrol cannot
     116      // start, or if the host is not defined (but that is required to define a job on the controller)
    86117      DeleteJob (job);
    87118      continue;
     
    93124  }
    94125  JobTaskUnlock();
     126
     127  NtaskTotalSum += NtaskCheck;
     128  NtimeTotalSum += TimerElapsed(&start, TRUE);
     129
    95130  return (next_timeout);
    96131}
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/ControllerOps.c

    r36623 r42886  
    481481}
    482482
     483static int   NreadTotalSum = 0;
     484static int   NpassTotalSum = 0;
     485static float NtimeTotalSum = 0.0;
     486
     487void CheckControllerOutputStats (int reset) {
     488
     489  gprint (GP_LOG, "CO: Npass: %d, Nread: %d, rate: %f\n",
     490          NpassTotalSum, NreadTotalSum, NreadTotalSum / NtimeTotalSum);
     491
     492  if (reset) {
     493    NreadTotalSum = 0;
     494    NpassTotalSum = 0;
     495    NtimeTotalSum = 0.0;
     496  }
     497}
     498
    483499int CheckControllerOutput () {
    484500
     
    486502
    487503  if (!ControllerStatus) return (TRUE);
     504
     505  struct timeval start;
     506  TimerMark (&start);
     507
     508  // count the number of times this function was called while controller was active
     509  NpassTotalSum ++;
    488510
    489511  /* read stdout buffer */
     
    510532      break;
    511533  }
     534
     535  NreadTotalSum += stdout_buffer.Nbuffer + stderr_buffer.Nbuffer;
     536  NtimeTotalSum += TimerElapsed(&start, TRUE);
     537
    512538  return (TRUE);
    513539}
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/JobOps.c

    r40424 r42886  
    101101  if (job[0].JobID < 0) {
    102102    free (job);
     103    fprintf (stderr, "invalid JobID, programming error?\n");
    103104    return NULL;
    104105  }
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/Makefile

    r41341 r42886  
    3232$(SRC)/run.$(ARCH).o \
    3333$(SRC)/stop.$(ARCH).o \
     34$(SRC)/ptstats.$(ARCH).o \
    3435$(SRC)/pantasks.$(ARCH).o \
    3536$(SRC)/thread_locks.$(ARCH).o \
     
    4344$(SRC)/server.$(ARCH).o \
    4445$(SRC)/status_server.$(ARCH).o \
     46$(SRC)/ptstats.$(ARCH).o \
    4547$(SRC)/init_server.$(ARCH).o \
    4648$(SRC)/CheckPassword.$(ARCH).o \
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/init.c

    r41341 r42886  
    2525int verbose         PROTO((int, char **));
    2626int version         PROTO((int, char **));
     27int ptstats         PROTO((int, char **));
    2728
    2829static Command cmds[] = { 
     
    4142  {1, "run",        run,           "run the scheduler"},
    4243  {1, "flush",      flush_jobs,    "flush all jobs from the queue"},
     44  {1, "ptstats",    ptstats,       "show pantasks througput stats"},
    4345  {1, "showtask",   showtask,      "list a task"},
    4446  {1, "status",     status_sys,    "get system or task status"},
  • tags/ipp-unions-20250528/Ohana/src/opihi/pantasks/init_server.c

    r41341 r42886  
    2222int verbose         PROTO((int, char **));
    2323int version         PROTO((int, char **));
     24int ptstats         PROTO((int, char **));
     25
    2426int server          PROTO((int, char **));
    2527
     
    4042  {1, "npending",   task_npending, "define maximum number of outstanding jobs for a task"},
    4143  {1, "periods",    task_periods,  "define time scales for a task"},
     44  {1, "ptstats",    ptstats,       "show pantasks througput stats"},
    4245  {1, "flush",      flush_jobs,    "flush all jobs from the queue"},
    4346  {1, "server",     server,        "server-specific commands"},
Note: See TracChangeset for help on using the changeset viewer.