Changeset 8546 for trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
- Timestamp:
- Aug 23, 2006, 5:31:09 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
r8424 r8546 55 55 void *CheckSystem_Threaded (void *data) { 56 56 57 struct timeval now; 58 float dtime; 57 int Njobchecks, Nhostchecks, Nlivechecks; 58 59 Nlivechecks = 0; 59 60 60 61 gprintInit (); … … 66 67 // don't run the system checks if RunSystem is FALSE 67 68 if (!RunSystem) { 68 usleep (50000); 69 usleep (50000); // idle if RunSystem is FALSE 69 70 continue; 70 71 } 71 72 73 Njobchecks = 0; 74 Nhostchecks = 0; 75 72 76 // we want to give each block a maximum allowed time 73 CheckIdleHosts(0.020); /* submit a new job */74 75 CheckBusyJobs(0.020); /* get job status */76 CheckDoneJobs(0.020); /* harvest job stdout/stderr */77 CheckKillJobs(0.020); /* harvest job stdout/stderr */78 79 CheckDoneHosts(0.020); /* reset the host */80 CheckDownHosts(0.100); /* launch the host */77 Nhostchecks += CheckIdleHosts(0.020); /* submit a new job */ 78 79 Njobchecks += CheckBusyJobs(0.020); /* get job status */ 80 Njobchecks += CheckDoneJobs(0.020); /* harvest job stdout/stderr */ 81 Njobchecks += CheckKillJobs(0.020); /* harvest job stdout/stderr */ 82 83 Nhostchecks += CheckDoneHosts(0.020); /* reset the host */ 84 Nhostchecks += CheckDownHosts(0.100); /* launch the host */ 81 85 82 86 /* always allow at least one test */ … … 84 88 CheckDoneJobs must depend on the size of the output buffer */ 85 89 86 gettimeofday (&now, (void *) NULL); 87 dtime = DTIME (now, lastlive); 88 if (dtime > 1.0) { 90 // there is nothing on the stacks. test the hosts and wait a bit 91 if (!Njobchecks && !Nhostchecks) { 89 92 CheckLiveHosts(0.040); 90 lastlive = now;93 usleep (100000); // idle if no jobs are waiting 91 94 } 92 95 … … 145 148 } 146 149 if (DEBUG && (Nobject > 0)) gprint (GP_ERR, "checked %d of %d jobs\n", i, Nobject); 147 return ( TRUE);150 return (i); 148 151 } 149 152 … … 182 185 } 183 186 if (DEBUG && (Nobject > 0)) gprint (GP_ERR, "checked %d of %d jobs\n", i, Nobject); 184 return ( TRUE);187 return (i); 185 188 } 186 189 … … 219 222 } 220 223 if (DEBUG && (Nobject > 0)) gprint (GP_ERR, "checked %d of %d jobs\n", i, Nobject); 221 return ( TRUE);224 return (i); 222 225 } 223 226 … … 245 248 } 246 249 if (DEBUG) gprint (GP_ERR, "checked %d hosts\n", i); 247 return ( TRUE);250 return (i); 248 251 } 249 252 … … 281 284 } 282 285 if (DEBUG) gprint (GP_ERR, "checked %d hosts\n", i); 283 return ( TRUE);286 return (i); 284 287 } 285 288 … … 294 297 /* check if there are any pending jobs, otherwise skip step */ 295 298 stack = GetJobStack (PCONTROL_JOB_PENDING); 296 if (!stack[0].Nobject) return ( TRUE);299 if (!stack[0].Nobject) return (0); 297 300 298 301 /* Loop through objects on the stack, no more than once. see note above */ … … 311 314 } 312 315 if (DEBUG) gprint (GP_ERR, "checked %d hosts\n", i); 313 return ( TRUE);316 return (i); 314 317 } 315 318
Note:
See TracChangeset
for help on using the changeset viewer.
