Commit f6922d86 authored by Claes Sjofors's avatar Claes Sjofors

Process supervision modified

parent be472320
...@@ -319,7 +319,7 @@ static void *opcsrv_cyclic( void *arg) ...@@ -319,7 +319,7 @@ static void *opcsrv_cyclic( void *arg)
for (;;) { for (;;) {
time_GetTime( &current_time); time_GetTime( &current_time);
aproc_TimeStamp(); aproc_TimeStamp( ((float)tmo)/1000, 5);
get.maxSize = sizeof(mp); get.maxSize = sizeof(mp);
get.data = mp; get.data = mp;
......
...@@ -738,7 +738,7 @@ int main(int argc, char *argv[]) { ...@@ -738,7 +738,7 @@ int main(int argc, char *argv[]) {
/* Timestamp */ /* Timestamp */
aproc_TimeStamp(); aproc_TimeStamp(TIME_INCR, 5);
RemoteSleep(TIME_INCR); RemoteSleep(TIME_INCR);
......
...@@ -387,7 +387,7 @@ if (debug) printf("Before remtrans_init\n"); ...@@ -387,7 +387,7 @@ if (debug) printf("Before remtrans_init\n");
errh_SetStatus(PWR__SRVTERM); errh_SetStatus(PWR__SRVTERM);
exit(0); exit(0);
} }
aproc_TimeStamp(); aproc_TimeStamp(TIME_INCR, 5);
RemoteSleep(TIME_INCR); RemoteSleep(TIME_INCR);
time_since_scan += TIME_INCR; time_since_scan += TIME_INCR;
......
...@@ -791,7 +791,7 @@ int main(int argc, char *argv[]) ...@@ -791,7 +791,7 @@ int main(int argc, char *argv[])
/* Timestamp */ /* Timestamp */
aproc_TimeStamp(); aproc_TimeStamp(TIME_INCR, 5);
RemoteSleep(TIME_INCR); RemoteSleep(TIME_INCR);
......
...@@ -651,7 +651,7 @@ int main(int argc, char *argv[]) ...@@ -651,7 +651,7 @@ int main(int argc, char *argv[])
/* Timestamp */ /* Timestamp */
aproc_TimeStamp(); aproc_TimeStamp(TIME_INCR, 5);
RemoteSleep(TIME_INCR); RemoteSleep(TIME_INCR);
......
...@@ -445,7 +445,7 @@ int main() ...@@ -445,7 +445,7 @@ int main()
do { do {
if (!hotswap) errh_SetStatus(PWR__SRUN); if (!hotswap) errh_SetStatus(PWR__SRUN);
aproc_TimeStamp(); aproc_TimeStamp( 0.1, 5);
get.maxSize = sizeof(mp); get.maxSize = sizeof(mp);
get.data = mp; get.data = mp;
qcom_Get(&status, &qid, &get, 100); // TMO == 100 ms qcom_Get(&status, &qid, &get, 100); // TMO == 100 ms
......
...@@ -495,7 +495,7 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size) ...@@ -495,7 +495,7 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
if(msg->Items[i].attrnum > 1) { if(msg->Items[i].attrnum > 1) {
//printf( "Received: %s.%s AttrNum:%d\n", msg->Items[i].oname, msg->Items[i].attr[0].aname, msg->Items[i].attrnum); //printf( "Received: %s.%s AttrNum:%d\n", msg->Items[i].oname, msg->Items[i].attr[0].aname, msg->Items[i].attrnum);
sev_sHistItem *buffP = &msg->Items[i]; sev_sHistItem *buffP = &msg->Items[i];
while(buffP < &msg->Items[item_cnt-1]) { while(buffP < &msg->Items[item_cnt]) {
//for(size_t j = 0; j < buffP->attrnum; j++) { //for(size_t j = 0; j < buffP->attrnum; j++) {
// printf( "Received: %s.%s\n", buffP->oname, buffP->attr[j].aname); // printf( "Received: %s.%s\n", buffP->oname, buffP->attr[j].aname);
//} //}
......
...@@ -105,7 +105,7 @@ void MyAppl::close() ...@@ -105,7 +105,7 @@ void MyAppl::close()
void MyAppl::scan() void MyAppl::scan()
{ {
aproc_TimeStamp(); aproc_TimeStamp( scantime(), 1);
// Do something // Do something
} }
...@@ -133,7 +133,7 @@ int main() ...@@ -133,7 +133,7 @@ int main()
exit(0); exit(0);
} }
aproc_TimeStamp(); aproc_TimeStamp( appl.scantime(), 1);
errh_SetStatus( PWR__ARUN); errh_SetStatus( PWR__ARUN);
first_scan = true; first_scan = true;
......
...@@ -793,6 +793,8 @@ bck_file_process ( ...@@ -793,6 +793,8 @@ bck_file_process (
backup_confp->BytesFast = wrtblk->cyclehead.length; backup_confp->BytesFast = wrtblk->cyclehead.length;
backup_confp->SegFast = wrtblk->cyclehead.segments; backup_confp->SegFast = wrtblk->cyclehead.segments;
backup_confp->ObjTimeFast = wrtblk->cyclehead.objtime; backup_confp->ObjTimeFast = wrtblk->cyclehead.objtime;
aproc_TimeStamp( ((float)backup_confp->CycleFast)/10, 30);
} }
else { else {
backup_confp->CntSlow++; backup_confp->CntSlow++;
...@@ -801,7 +803,6 @@ bck_file_process ( ...@@ -801,7 +803,6 @@ bck_file_process (
backup_confp->ObjTimeSlow = wrtblk->cyclehead.objtime; backup_confp->ObjTimeSlow = wrtblk->cyclehead.objtime;
} }
aproc_TimeStamp();
/* Signal bck_write_done */ /* Signal bck_write_done */
...@@ -1456,6 +1457,8 @@ pwr_tUInt32 bck_init () ...@@ -1456,6 +1457,8 @@ pwr_tUInt32 bck_init ()
UNLOCK; UNLOCK;
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
aproc_TimeStamp( ((float)backup_confp->CycleFast)/10, 30);
/* Activate the disk process /* Activate the disk process
Activate the fast and slow cycle processes */ Activate the fast and slow cycle processes */
...@@ -1535,8 +1538,6 @@ int main( int argc, char *argv[]) ...@@ -1535,8 +1538,6 @@ int main( int argc, char *argv[])
sts = gdh_Init("pwr_bck"); sts = gdh_Init("pwr_bck");
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
aproc_TimeStamp();
sts = bck_init(); sts = bck_init();
if (EVEN(sts)) { if (EVEN(sts)) {
errh_Fatal( "Initialization error, %m", sts); errh_Fatal( "Initialization error, %m", sts);
......
...@@ -145,7 +145,7 @@ main () ...@@ -145,7 +145,7 @@ main ()
qcom_Free(&sts, get.data); qcom_Free(&sts, get.data);
} }
aproc_TimeStamp(); aproc_TimeStamp( lHelCB.ScanTime, 5.0);
} }
} }
......
...@@ -145,7 +145,7 @@ main () ...@@ -145,7 +145,7 @@ main ()
qcom_Free(&sts, get.data); qcom_Free(&sts, get.data);
} }
aproc_TimeStamp(); aproc_TimeStamp( lHelCB.ScanTime, 5.0);
} }
} }
......
...@@ -3400,7 +3400,7 @@ receive ( ...@@ -3400,7 +3400,7 @@ receive (
tmo = MIN(l.timerTime * 1000, tmo); tmo = MIN(l.timerTime * 1000, tmo);
} }
} }
aproc_TimeStamp(); aproc_TimeStamp( ((float)tmo)/1000, 2);
} }
} }
......
...@@ -410,7 +410,7 @@ void rt_fast::close() ...@@ -410,7 +410,7 @@ void rt_fast::close()
void rt_fast::scan() void rt_fast::scan()
{ {
aproc_TimeStamp(); aproc_TimeStamp( scantime(), 5);
for ( int i = 0; i < (int) objects.size(); i++) for ( int i = 0; i < (int) objects.size(); i++)
objects[i]->scan(); objects[i]->scan();
...@@ -476,7 +476,7 @@ int main() ...@@ -476,7 +476,7 @@ int main()
exit(0); exit(0);
} }
aproc_TimeStamp(); aproc_TimeStamp(fast.scantime(), 5);
errh_SetStatus( PWR__SRUN); errh_SetStatus( PWR__SRUN);
first_scan = true; first_scan = true;
......
...@@ -148,7 +148,7 @@ int main (int argc, char **argv) ...@@ -148,7 +148,7 @@ int main (int argc, char **argv)
if (delay_action == 2) if (delay_action == 2)
ihp->IOReadWriteFlag = FALSE; ihp->IOReadWriteFlag = FALSE;
aproc_TimeStamp(); aproc_TimeStamp(ihp->CycleTimeBus, 5);
} else { } else {
ini_mEvent new_event; ini_mEvent new_event;
qcom_sEvent *ep = (qcom_sEvent*) get.data; qcom_sEvent *ep = (qcom_sEvent*) get.data;
......
...@@ -157,7 +157,7 @@ int main (int argc, char ** argv) ...@@ -157,7 +157,7 @@ int main (int argc, char ** argv)
} }
qcom_Free(&sts, get.data); qcom_Free(&sts, get.data);
} }
aproc_TimeStamp(); aproc_TimeStamp(((float)cTimerTimeScan)/1000, 5);
} }
} }
......
...@@ -236,7 +236,7 @@ static void *statussrv_cyclic( void *arg) ...@@ -236,7 +236,7 @@ static void *statussrv_cyclic( void *arg)
for (;;) { for (;;) {
time_GetTime( &current_time); time_GetTime( &current_time);
aproc_TimeStamp(); aproc_TimeStamp( ((float)tmo)/1000, 5);
get.maxSize = sizeof(mp); get.maxSize = sizeof(mp);
get.data = mp; get.data = mp;
......
...@@ -160,7 +160,7 @@ void rt_sysmon::scan() ...@@ -160,7 +160,7 @@ void rt_sysmon::scan()
pwr_tStatus osts, sts; pwr_tStatus osts, sts;
errh_eSeverity severity, oseverity; errh_eSeverity severity, oseverity;
aproc_TimeStamp(); aproc_TimeStamp( scantime(), 5);
// Find most severe status // Find most severe status
sts = PWR__SRUN; sts = PWR__SRUN;
...@@ -237,7 +237,7 @@ int main() ...@@ -237,7 +237,7 @@ int main()
exit(0); exit(0);
} }
aproc_TimeStamp(); aproc_TimeStamp( sysmon.scantime(), 5);
errh_SetStatus( PWR__SRUN); errh_SetStatus( PWR__SRUN);
first_scan = true; first_scan = true;
......
...@@ -275,6 +275,8 @@ main ( ...@@ -275,6 +275,8 @@ main (
} }
#if defined OS_LINUX || defined OS_MACOS #if defined OS_LINUX || defined OS_MACOS
aproc_TimeStamp( ((float)tmo_ms)/1000, 5);
get.data = NULL; get.data = NULL;
qcom_Get(&sts, &my_q, &get, tmo_ms); qcom_Get(&sts, &my_q, &get, tmo_ms);
if (sts != QCOM__TMO && sts != QCOM__QEMPTY) { if (sts != QCOM__TMO && sts != QCOM__QEMPTY) {
...@@ -285,8 +287,6 @@ main ( ...@@ -285,8 +287,6 @@ main (
} }
#endif #endif
aproc_TimeStamp();
now_clock = time_Clock(NULL, NULL); now_clock = time_Clock(NULL, NULL);
if (now_clock < last_clock) { if (now_clock < last_clock) {
errh_Info("The uptime clock has wrapped"); errh_Info("The uptime clock has wrapped");
......
...@@ -154,7 +154,7 @@ int main (int argc, char **argv) ...@@ -154,7 +154,7 @@ int main (int argc, char **argv)
ScanDeltaTime.tv_sec = ScanTime; ScanDeltaTime.tv_sec = ScanTime;
ScanDeltaTime.tv_nsec = 0; ScanDeltaTime.tv_nsec = 0;
aproc_TimeStamp(); aproc_TimeStamp( ScanTime, 5.0);
errh_SetStatus( PWR__SRUN); errh_SetStatus( PWR__SRUN);
for (;;) { for (;;) {
...@@ -198,7 +198,7 @@ int main (int argc, char **argv) ...@@ -198,7 +198,7 @@ int main (int argc, char **argv)
LastScan = NextScan; LastScan = NextScan;
aproc_TimeStamp(); aproc_TimeStamp( ScanTime, 5.0);
} }
return 1; return 1;
......
...@@ -107,7 +107,7 @@ void rt_appl::mainloop() ...@@ -107,7 +107,7 @@ void rt_appl::mainloop()
exit(0); exit(0);
} }
aproc_TimeStamp(); aproc_TimeStamp( m_scantime, m_maxdelay);
errh_SetStatus( PWR__ARUN); errh_SetStatus( PWR__ARUN);
first_scan = true; first_scan = true;
...@@ -121,7 +121,7 @@ void rt_appl::mainloop() ...@@ -121,7 +121,7 @@ void rt_appl::mainloop()
qcom_Get( &sts, &m_qid, &get, tmo); qcom_Get( &sts, &m_qid, &get, tmo);
if (sts == QCOM__TMO || sts == QCOM__QEMPTY) { if (sts == QCOM__TMO || sts == QCOM__QEMPTY) {
if ( !swap) { if ( !swap) {
aproc_TimeStamp(); aproc_TimeStamp( m_scantime, m_maxdelay);
scan(); scan();
} }
} }
......
...@@ -44,7 +44,7 @@ class rt_appl { ...@@ -44,7 +44,7 @@ class rt_appl {
errh_eAnix anix, //< Application index. errh_eAnix anix, //< Application index.
double scantime = 1.0, //< Scantime for call of the scan() function. double scantime = 1.0, //< Scantime for call of the scan() function.
qcom_sQid qid = qcom_cNQid //< Qcom queue identity. qcom_sQid qid = qcom_cNQid //< Qcom queue identity.
) : m_anix(anix), m_scantime(scantime), m_qid(qid) ) : m_anix(anix), m_scantime(scantime), m_maxdelay(5), m_qid(qid)
{ strcpy( m_name, name); } { strcpy( m_name, name); }
void init(); void init();
...@@ -79,6 +79,7 @@ class rt_appl { ...@@ -79,6 +79,7 @@ class rt_appl {
private: private:
errh_eAnix m_anix; errh_eAnix m_anix;
double m_scantime; double m_scantime;
double m_maxdelay;
qcom_sQid m_qid; qcom_sQid m_qid;
char m_name[80]; char m_name[80];
pwr_tOid m_apploid; pwr_tOid m_apploid;
......
...@@ -52,10 +52,11 @@ pwr_tStatus aproc_RegisterObject( ...@@ -52,10 +52,11 @@ pwr_tStatus aproc_RegisterObject(
return PROC__SUCCESS; return PROC__SUCCESS;
} }
pwr_tStatus aproc_TimeStamp() pwr_tStatus aproc_TimeStamp( float cycletime, float maxdelay)
{ {
pwr_tStatus sts; pwr_tStatus sts;
pwr_tTime t; pwr_tTime t, tmo_time;
pwr_tDeltaTime dt;
errh_eAnix anix = errh_Anix(); errh_eAnix anix = errh_Anix();
if ( !anix) if ( !anix)
...@@ -72,7 +73,9 @@ pwr_tStatus aproc_TimeStamp() ...@@ -72,7 +73,9 @@ pwr_tStatus aproc_TimeStamp()
} }
time_GetTime( &t); time_GetTime( &t);
proc_np->ProcTimeStamp[anix-1] = t; time_FloatToD( &dt, cycletime + maxdelay);
time_Aadd( &tmo_time, &t, &dt);
proc_np->ProcTimeStamp[anix-1] = tmo_time;
return PROC__SUCCESS; return PROC__SUCCESS;
} }
......
...@@ -28,7 +28,7 @@ extern "C" { ...@@ -28,7 +28,7 @@ extern "C" {
#include "rt_errh.h" #include "rt_errh.h"
pwr_tStatus aproc_RegisterObject(pwr_tOid); pwr_tStatus aproc_RegisterObject(pwr_tOid);
pwr_tStatus aproc_TimeStamp(); pwr_tStatus aproc_TimeStamp( float scantime, float maxdelay);
#if defined __cplusplus #if defined __cplusplus
} }
......
...@@ -47,11 +47,11 @@ pwrs_Node_Exec ( ...@@ -47,11 +47,11 @@ pwrs_Node_Exec (
errh_eSeverity severity; errh_eSeverity severity;
errh_eSeverity system_severity; errh_eSeverity system_severity;
int new_idx = -1; int new_idx = -1;
static float timeout[40] = { static int supervise[40] = {
0,0,0,0,3,5,5,0,60,5, 0,0,0,0,1,1,1,0,1,1,
5,5,5,0,0,20,0,5,5,5, 1,1,1,0,0,1,0,1,1,1,
5,5,5,5,5,5,5,5,5,5, 1,1,1,1,1,1,1,1,1,1,
5,5,5,5,5,5,5,5,5,5}; 1,1,1,1,1,1,1,1,1,1};
static int reboot_done = 0; static int reboot_done = 0;
if ( !np) { if ( !np) {
...@@ -92,10 +92,10 @@ pwrs_Node_Exec ( ...@@ -92,10 +92,10 @@ pwrs_Node_Exec (
system_severity = errh_Severity( np->SystemStatus); system_severity = errh_Severity( np->SystemStatus);
time_GetTime( &current_time); time_GetTime( &current_time);
for ( i = 0; i < sizeof(np->ProcStatus)/sizeof(np->ProcStatus[0]); i++) { for ( i = 0; i < sizeof(np->ProcStatus)/sizeof(np->ProcStatus[0]); i++) {
if ( np->ProcStatus[i] != 0 && timeout[i] != 0.0) { if ( np->ProcStatus[i] != 0 && supervise[i]) {
time_Adiff( &diff, &current_time, &np->ProcTimeStamp[i]); time_Adiff( &diff, &np->ProcTimeStamp[i], &current_time);
if ( time_DToFloat( 0, &diff) > timeout[i]) { if ( time_Dcomp( &diff, 0) < 0) {
if ( errh_Severity( np->ProcStatus[i]) < errh_Severity(PWR__PTIMEOUT)) if ( errh_Severity( np->ProcStatus[i]) < errh_Severity(PWR__PTIMEOUT))
np->ProcStatus[i] = PWR__PTIMEOUT; np->ProcStatus[i] = PWR__PTIMEOUT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment