Fixed a bug in sicshipadaba which would not cause bin transfer mode properly honoured on hget

Added a total feature to histmemsec
This commit is contained in:
2014-06-03 12:01:52 +02:00
parent dc3a3c39c0
commit f1e3ae7c0b
2 changed files with 21 additions and 3 deletions

View File

@ -262,6 +262,22 @@ static int SumCmd(pSICSOBJ ccmd, SConnection * pCon,
}
return 1;
}
/*-------------------------------------------------------------------------*/
static int TotalCmd(pSICSOBJ ccmd, SConnection * pCon,
Hdb * cmdNode, Hdb * par[], int nPar)
{
pHdb dataNode = NULL;
long lSum = 0;
int i;
dataNode = GetHipadabaNode(ccmd->objectNode,"data");
assert(dataNode != NULL);
for(i = 0, lSum = 0; i < dataNode->value.arrayLength; i++){
lSum += dataNode->value.v.intArray[i];
}
SCPrintf(pCon,eValue,"%s.total = %ld", ccmd->objectNode->name, lSum);
return 1;
}
/*--------------------------------------------------------------------------*/
static int InitCmd(pSICSOBJ ccmd, SConnection * con,
Hdb * cmdNode, Hdb * par[], int nPar)
@ -382,6 +398,8 @@ int MakeSecHM(SConnection * pCon, SicsInterp * pSics, void *pData,
AddSICSHdbPar(child, "ystart", usSpy, MakeHdbInt(0));
AddSICSHdbPar(child, "yend", usSpy, MakeHdbInt(0));
child = AddSICSHdbPar(node,"total", usSpy, MakeSICSFunc(TotalCmd));
/*
* test TOF option
*/