- Added a sinq module for monitoring the Accelerator broadcast

- Added automatic notification via SMS


SKIPPED:
	psi/dgrambroadcast.c
	psi/dgrambroadcast.h
	psi/make_gen
	psi/psi.c
	psi/sinq.c
	psi/sinq.h
This commit is contained in:
koennecke
2005-07-08 12:32:38 +00:00
parent 96e8cdb2d5
commit 054e2133ee
20 changed files with 163 additions and 46 deletions

View File

@ -12,6 +12,7 @@
#include <assert.h>
#include <tcl.h>
#include <time.h>
#include <fcntl.h>
#include "stringdict.h"
#include "mccontrol.h"
/*========================= life and death ==================================*/
@ -294,14 +295,25 @@ int McStasStart(pMcStasController self, CounterMode mode, float fPreset){
static long readMonFile(pMcStasController self){
char pResult[256];
FILE *fd = NULL;
struct flock fl;
long monValue = -1;
int i;
if(!StringDictGet(self->scripts,"mcmonfile",pResult,255)){
return -1;
}
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 0;
fl.l_pid = getpid();
fd = fopen(pResult,"r");
if(fd != NULL){
fcntl(fileno(fd),F_SETLKW,&fl);
fscanf(fd,"%ld", &monValue);
fl.l_type = F_UNLCK;
fcntl(fileno(fd),F_SETLK,&fl);
fclose(fd);
}
return monValue;
@ -313,11 +325,10 @@ int McStasStatus(pMcStasController self, float *fControl){
int status, i;
/*
* check at max any second, else we keep the system busy and
* check at max any second, else SICS keeps the system busy and
* there is no CPU left for McStas
*/
SicsWait(1);
SicsWait(1);
status = invokeScript(self,"mcisrunning",pServ->pSics,pResult, 255);
if(status == 0){
strncpy(self->errorText,pResult,255);
@ -342,6 +353,7 @@ int McStasStatus(pMcStasController self, float *fControl){
* check only any three seconds, else SICS uses up all the CPU time
* and the simulation has no chance.
*/
*fControl = self->lastMon;
if(time(NULL) < self->lastMonitorRead + 3) {
return HWBusy;
}
@ -362,6 +374,7 @@ int McStasStatus(pMcStasController self, float *fControl){
self->lastMonitorRead = time(NULL);
monValue *= self->monitorScale;
*fControl = monValue;
self->lastMon = monValue;
if(monValue >= self->fPreset){
McStasStop(self);
}