16 this->master = master;
25 mutex->enter(5000, __FUNCTION__);
36 if (!mutex || !mutex->enter(5000, __FUNCTION__))
41 usage = header->usage;
48 if (!mutex || !mutex->enter(5000, __FUNCTION__))
54 for (uint32 n=0; n<=header->maxID; n++) {
58 stats.spaceID = info->
procID;
59 stats.nodeID = info->
nodeID;
60 stats.type = info->
type;
61 stats.status = info->
status;
63 stats.currentMemoryBytes = info->
size;
76 perfStats.push_back(stats);
86 return "No components registered";
87 else if (!list->size()) {
89 return "No components registered";
92 std::string str =
utils::StringFormat(
"Components count %u intcount %u indexSize %u maxID %u memsize %u memuse %u\n",
93 list->size(), header->count, header->indexSize, header->maxID, header->size, header->usage);
94 std::vector<ComponentInfoStruct>::iterator i = list->begin(), e = list->end();
96 str +=
utils::StringFormat(
"Comp %u: '%s' node %u proc %u type %u, %u params %u data %u runs %u msgIn %u msgOut\n",
97 (*i).id, (*i).name, (*i).nodeID, (*i).procID, (*i).type, (*i).paramCount, (*i).dataCount,
98 (*i).stats.runCount, (*i).stats.msgInCount, (*i).stats.msgOutCount);
110 return "<components count=\"0\" />\n";
111 else if (!list->size()) {
113 return "<components count=\"0\" />\n";
116 std::string str =
utils::StringFormat(
"<components count=\"%u\" indexsize=\"%u\" maxid=\"%u\" memsize=\"%u\" memuse=\"%u\">\n",
117 header->count, header->indexSize, header->maxID, header->size, header->usage);
118 std::vector<ComponentInfoStruct>::iterator i = list->begin(), e = list->end();
120 str += (*i).toXML(stats);
124 str +=
"</components>\n";
130 std::vector<ComponentInfoStruct>* list =
new std::vector<ComponentInfoStruct>;
131 if (!mutex || !mutex->enter(5000, __FUNCTION__))
136 for (uint32 n=0; n<=header->maxID; n++) {
138 list->push_back(*info);
145 std::vector<ComponentInfoStruct>* list =
new std::vector<ComponentInfoStruct>;
146 if (!mutex || !mutex->enter(5000, __FUNCTION__))
151 for (uint32 n=0; n<=header->maxID; n++) {
152 if ((info =
GETCOMPDATA(header, n)) && (info->nodeID == master->getNodeID()))
153 list->push_back(*info);
160 std::vector<ComponentInfoStruct>* list =
new std::vector<ComponentInfoStruct>;
161 if (!mutex || !mutex->enter(5000, __FUNCTION__))
166 for (uint32 n=0; n<=header->maxID; n++) {
167 if ((info =
GETCOMPDATA(header, n)) && (info->nodeID == master->getNodeID()) && (info->type == type))
168 list->push_back(*info);
175 std::vector<ComponentInfoStruct>* list =
new std::vector<ComponentInfoStruct>;
176 if (!mutex || !mutex->enter(5000, __FUNCTION__))
181 for (uint32 n=0; n<=header->maxID; n++) {
182 if ((info =
GETCOMPDATA(header, n)) && (info->nodeID == master->getNodeID())
184 list->push_back(*info);
191 std::vector<ComponentInfoStruct>* list =
new std::vector<ComponentInfoStruct>;
192 if (!mutex || !mutex->enter(5000, __FUNCTION__))
197 for (uint32 n=0; n<=header->maxID; n++) {
198 if ((info =
GETCOMPDATA(header, n)) && (info->nodeID == master->getNodeID())
200 list->push_back(*info);
207 serial = master->incrementComponentShmemSerial();
211 if (!mutex->enter(5000, __FUNCTION__))
228 memset(header, 0, (
size_t)memorySize);
229 header->size = memorySize;
232 header->indexSize = indexSize;
235 master->setComponentShmemSize(memorySize);
241 serial = master->getComponentShmemSerial();
242 uint64 size = master->getComponentShmemSize();
243 this->port = master->port;
245 bool createdMutex =
false;
249 if (!mutex->enter(5000, __FUNCTION__))
279bool ComponentMemory::resize(uint64 newMemorySize) {
281 if (newMemorySize > 100000000) {
285 else if (newMemorySize > 50000000) {
289 serial = master->incrementComponentShmemSerial();
291 if (!mutex || !mutex->enter(5000, __FUNCTION__))
305 memcpy(newHeader, header, (
size_t)header->usage);
306 newHeader->size = newMemorySize;
310 memorySize = newMemorySize;
311 master->setComponentShmemSize(memorySize);
317bool ComponentMemory::resizeIndex(uint32 newIndexSize) {
319 int32 difSize = (newIndexSize - header->indexSize) *
sizeof(uint64);
322 if ((uint32)difSize > header->size - header->usage)
323 if (!resize(memorySize * 2))
328 uint32 oldDataOffset =
sizeof(ComponentMemoryStruct) + (header->indexSize*
sizeof(uint64));
329 uint32 newDataOffset =
sizeof(ComponentMemoryStruct) + (newIndexSize*
sizeof(uint64));
330 memmove(((
char*)header) + newDataOffset, ((
char*)header) + oldDataOffset, (
size_t)(header->usage - oldDataOffset));
331 memset(((
char*)header) + oldDataOffset, 0, newDataOffset - oldDataOffset);
333 header->indexSize = newIndexSize;
334 header->usage += newDataOffset - oldDataOffset;
340bool ComponentMemory::growComponent(uint32
id, uint64 addSize) {
341 ComponentInfoStruct* info =
GETCOMPDATA(header,
id);
344 return resizeComponent(
id, info->size + addSize);
347bool ComponentMemory::resizeComponent(uint32
id, uint64 newSize) {
348 ComponentInfoStruct* info = NULL;
360 if (info->size > newSize)
362 difSize = newSize - info->size;
364 if (header->size - header->usage < difSize) {
365 if (!resize(memorySize * 2))
367 return resizeComponent(
id, newSize);
372 uint64* i = index + 1;
373 for (n=
id+1; n<=header->maxID; n++, i++) {
383 uint64 oldOffset = *i;
386 LogPrint(0,
LOG_MEMORY, 0,
"Couldn't shift component %u memory when inserting component %u...", nextID,
id);
393 uint64 nextStart = (header->indexSize *
sizeof(uint64)) + oldOffset;
394 uint64 sizeMove = header->usage - nextStart;
395 memmove(data+difSize, data, (
size_t)sizeMove);
397 for (n=nextID; n<=header->maxID; n++, i++) {
406 info = (ComponentInfoStruct*) data;
407 memset(info, 0,
sizeof(ComponentInfoStruct));
409 info->createdTime = info->lastUpdateTime =
GetTimeNow();
414 GETCOMPOFFSET(header,
id) = header->usage - (header->indexSize *
sizeof(uint64));
416 memset(info, 0,
sizeof(ComponentInfoStruct));
418 info->createdTime = info->lastUpdateTime =
GetTimeNow();
421 info->size = newSize;
422 header->usage += difSize;
437 if (!mutex || !mutex->enter(5000, __FUNCTION__))
440 if (
id >= header->indexSize) {
458 if (!mutex || !mutex->enter(5000, __FUNCTION__))
461 if (
id >= header->indexSize) {
483 else if (!list->size()) {
488 std::vector<ComponentInfoStruct>::iterator i = list->begin(), e = list->end();
490 msg->
setString((*i).id,
"component", (*i).name);
501 else if (!list->size()) {
507 std::vector<ComponentInfoStruct>::iterator i = list->begin(), e = list->end();
509 if (!(*i).writeToMsg(n, msg)) {
522 uint16 id, nodeID, procID;
523 uint8 type, policy, selfTrigger;
528 (
id = (uint16)msg->
getInt(n,
"ID")) &&
529 (type = (uint8)msg->
getInt(n,
"Type")) &&
530 (size = (uint64)msg->
getInt(n,
"Size")) &&
531 (nodeID = (uint16)msg->
getInt(n,
"NodeID")) &&
532 (procID = (uint16)msg->
getInt(n,
"ProcID")) &&
534 (time = msg->
getTime(n,
"CreatedTime"))) {
535 policy = (uint8)msg->
getInt(n,
"Policy");
536 selfTrigger = (uint8)msg->
getInt(n,
"SelfTrigger");
537 if (!
createComponent(
id, type, policy, selfTrigger, name, size, nodeID, procID, time, exID))
546bool ComponentMemory::createComponent(uint32
id, uint8 type, uint8 policy, uint8 selfTrigger,
const char* name, uint64 size, uint16 nodeID, uint16 procID, uint64 time, uint32& existingID) {
549 if (!mutex || !mutex->enter(5000, __FUNCTION__))
558 if (
id >= header->indexSize)
559 resizeIndex(header->indexSize +
id + 1024);
564 if (master->getNodeID() == nodeID)
567 LogPrint(0,
LOG_MEMORY, 1,
"Updating remote component %u (node %u proc %u)...",
id, nodeID, procID);
579 if (size > info->
size)
586 if (master->getNodeID() == nodeID)
587 LogPrint(0,
LOG_MEMORY, 2,
"Creating new local component %u (proc %u)...",
id, procID);
589 LogPrint(0,
LOG_MEMORY, 2,
"Registering remote component %u (node %u proc %u)...",
id, nodeID, procID);
608 if (
id > header->maxID)
623 DataMessage* outputMsg, uint32 runCount, uint32 cycleCount) {
624 if (!mutex || !mutex->enter(5000, __FUNCTION__))
628 if (cid >= header->indexSize) {
673 memcpy(outSlot, outputMsg->
data, outputMsg->
data->
size);
689 if (!mutex || !mutex->enter(5000, __FUNCTION__))
693 if (cid >= header->indexSize) {
704 uint64 size = info->
size;
708 if (cid < header->maxID) {
712 for (uint32 n=cid+1; n<=header->maxID; n++, i++) {
719 uint64 nextStart = (header->indexSize *
sizeof(uint64)) + *i;
720 memmove(info, ((
char*)info)+size, (
size_t)(header->usage - nextStart));
729 header->usage -= size;
737 if (!mutex || !mutex->enter(5000, __FUNCTION__))
741 if (cid >= header->indexSize) {
759 if (!mutex || !mutex->enter(5000, __FUNCTION__))
763 if (cid >= header->indexSize) {
775 char* data =
new char[(size_t)size];
776 memcpy(data, info, (
size_t)size);
783 if (!mutex || !mutex->enter(5000, __FUNCTION__))
787 if (cid >= header->indexSize)
788 resizeIndex(header->indexSize + 256);
790 if (!resizeComponent(cid, size)) {
801 uint64 oldsize = info->
size;
803 memcpy(info, data, (
size_t)size);
804 info->
size = oldsize;
806 if (cid > header->maxID)
819 if (!mutex || !mutex->enter(5000, __FUNCTION__))
824 uint16 localNodeID = master->getNodeID();
825 std::list<uint16>* comps =
new std::list<uint16>;
826 for (uint32 n=0; n<=header->maxID; n++) {
828 if ((info->nodeID == localNodeID) && (info->procID == procID))
829 comps->push_back(info->id);
841 if (!mutex || !mutex->enter(5000, __FUNCTION__))
845 if (cid >= header->indexSize) {
856 uint8 policy = info->
policy;
862 if (!mutex || !mutex->enter(5000, __FUNCTION__))
866 if (cid >= header->indexSize) {
889 if (!mutex || !mutex->enter(5000, __FUNCTION__))
893 if (cid >= header->indexSize) {
910 if (!mutex || !mutex->enter(5000, __FUNCTION__))
914 if (cid >= header->indexSize) {
931 if (!mutex || !mutex->enter(5000, __FUNCTION__))
935 if (cid >= header->indexSize) {
955 if (!mutex || !mutex->enter(5000, __FUNCTION__))
959 if (cid >= header->indexSize) {
978 if (!mutex || !mutex->enter(5000, __FUNCTION__))
982 if (cid >= header->indexSize) {
993 uint16 nodeID = info->
nodeID;
1000 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1004 if (cid >= header->indexSize) {
1015 uint16 procID = info->
procID;
1023 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1027 if (cid >= header->indexSize) {
1038 if (master->getNodeID() == info->
nodeID) {
1058 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1062 if (cid >= header->indexSize) {
1073 std::string str = info->
name;
1080 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1084 if (cid >= header->indexSize) {
1101 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1105 if (cid >= header->indexSize) {
1116 uint8 type = info->
type;
1126 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1128 if (serial != master->getComponentShmemSerial()) {
if (!
open()) {mutex->leave();
return stats;}}
1130 if (cid >= header->indexSize) {
1150 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1152 if (serial != master->getComponentShmemSerial()) {
if (!
open()) {mutex->leave();
return perfStats;}}
1154 if (cid >= header->indexSize) {
1171 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1175 if (cid >= header->indexSize) {
1193 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1197 if (cid >= header->indexSize) {
1215 if (!mutex || !mutex->enter(5000, __FUNCTION__) || !name || !strlen(name))
1220 for (uint32 n=0; n<=header->maxID; n++) {
1221 if ((info =
GETCOMPDATA(header, n)) && (info->syncStatus > 1)) {
1222 if (
stricmp(info->name, name) == 0) {
1235 if (!mutex || !mutex->enter(5000, __FUNCTION__) || !name || !strlen(name))
1241 for (uint32 n=0; n<=header->maxID; n++) {
1257char* ComponentMemory::makeRoomForPrivateData(uint32 cid, uint64 newSize) {
1262 if (!growComponent(cid, newSize))
1267 return ((
char*)info) +
sizeof(ComponentInfoStruct) + info->paramSize + info->dataSize;
1270char* ComponentMemory::makeRoomForParameter(uint32 cid, uint64 newSize) {
1271 ComponentInfoStruct* info =
GETCOMPDATA(header, cid);
1275 if (!growComponent(cid, newSize))
1282 char* paramSrc = (
char*)info +
sizeof(ComponentInfoStruct);
1283 char* dataSrc = paramSrc + info->paramSize;
1286 memcpy(dataSrc+newSize, dataSrc, (
size_t)info->dataSize);
1288 memset(dataSrc, 0, (
size_t)newSize);
1294 ComponentInfoStruct* info =
GETCOMPDATA(header, cid);
1298 char* src = (
char*)info +
sizeof(ComponentInfoStruct);
1299 char* srcEnd = src + info->paramSize;
1302 while ( src < srcEnd ) {
1303 if (
stricmp(name, src +
sizeof(ParamHeader)) == 0)
1304 return (ParamHeader*)src;
1305 offset += *(uint32*)src;
1306 src += *(uint32*)src;
1312 ComponentInfoStruct* info =
GETCOMPDATA(header, cid);
1316 char* src = (
char*)info +
sizeof(ComponentInfoStruct) + info->paramSize;
1317 char* srcEnd = src + info->dataSize;
1319 while ( src < srcEnd ) {
1320 if (
stricmp(name, src +
sizeof(PrivateHeader)) == 0)
1321 return (PrivateHeader*)src;
1322 src += *(uint32*)src;
1330 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1334 if (cid >= header->indexSize) {
1339 std::string actualMimetype;
1341 uint32 nameLen = (uint32)strlen(name);
1344 if (
stricmp(mimetype,
"xml") == 0)
1345 actualMimetype =
"text/xml";
1346 else if (
stricmp(mimetype,
"json") == 0)
1347 actualMimetype =
"application/json";
1348 else if (
stricmp(mimetype,
"binary") == 0)
1349 actualMimetype =
"application/octet-stream";
1350 else if (
stricmp(mimetype,
"html") == 0)
1351 actualMimetype =
"text/html";
1352 else if (
stricmp(mimetype,
"bitmap") == 0)
1353 actualMimetype =
"image/bmp";
1354 else if (
stricmp(mimetype,
"text") == 0)
1355 actualMimetype =
"text/plain";
1357 actualMimetype = mimetype;
1358 mimeLen = (uint32)actualMimetype.length();
1360 uint64 totalSize =
sizeof(
PrivateHeader) + nameLen + 1 + mimeLen + 1 + size;
1365 if (priv->
size == totalSize) {
1367 memcpy(((
char*)priv) +
sizeof(
PrivateHeader) + nameLen + 1, actualMimetype.c_str(), (
size_t)mimeLen + 1);
1369 memset(((
char*)priv) +
sizeof(
PrivateHeader) + nameLen + 1, 0, 1);
1370 memcpy(((
char*)priv) +
sizeof(
PrivateHeader) + nameLen + 1 + mimeLen + 1, data, (
size_t)size);
1385 char* newData = makeRoomForPrivateData(cid, totalSize);
1386 if (newData == NULL) {
1392 *(uint64*) newData = totalSize;
1395 memcpy(newData +
sizeof(
PrivateHeader) + nameLen + 1, actualMimetype.c_str(), mimeLen + 1);
1397 memset(newData +
sizeof(
PrivateHeader) + nameLen + 1, 0, 1);
1398 memcpy(newData +
sizeof(
PrivateHeader) + nameLen+1 + mimeLen + 1, data, (
size_t)size);
1413 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1417 if (cid >= header->indexSize) {
1428 uint32 nameLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader)));
1429 uint32 mimeLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader) + nameLen+1));
1437 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1441 if (cid >= header->indexSize) {
1452 uint32 nameLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader)));
1453 uint32 mimeLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader) + nameLen + 1));
1455 uint64 offset =
sizeof(
PrivateHeader) + nameLen + mimeLen + 2;
1456 size = priv->
size - offset;
1461 char* data =
new char[(size_t)size];
1462 memcpy((
void*)data, ((
char*)priv) + offset, (
size_t)size);
1468 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1472 if (cid >= header->indexSize) {
1483 uint32 nameLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader)));
1484 uint32 mimeLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader) + nameLen + 1));
1486 uint64 offset =
sizeof(
PrivateHeader) + nameLen + mimeLen + 2;
1487 uint64 size = priv->
size - offset;
1488 if (size > maxSize) {
1492 memcpy((
void*)data, ((
char*)priv) + offset, (
size_t)size);
1498 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1502 if (cid >= header->indexSize) {
1513 uint32 nameLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader)));
1514 std::string type = ((
char*)priv +
sizeof(
PrivateHeader) + nameLen + 1);
1521 std::map<std::string, std::string> map;
1523 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1534 char* srcEnd = src + info->
dataSize;
1540 while (src < srcEnd) {
1542 nameLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader)));
1543 mimeLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader) + nameLen + 1));
1552 src += *(uint32*)src;
1560 std::list<std::string> list;
1562 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1573 char* srcEnd = src + info->
dataSize;
1578 while (src < srcEnd) {
1580 nameLen = (uint32)strlen(((
char*)priv +
sizeof(
PrivateHeader)));
1585 src += *(uint32*)src;
1597 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1601 if (cid >= header->indexSize) {
1613 uint64 delSize = priv->
size;
1614 uint64 moveSize = (uint32)(((
char*)info)+
COMPINFOUSAGE(info)-((
char*)priv)-priv->
size);
1615 memmove(((
char*)priv), ((
char*)priv)+priv->
size, (
size_t)moveSize);
1633 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1637 if (cid >= header->indexSize) {
1649 uint32 nameLen = (uint32)strlen(name);
1650 uint32 newSize = nameLen + 1 +
sizeof(
ParamHeader) + (uint32)strlen(val) + 1;
1651 if (defaultValue != NULL)
1652 newSize += (uint32)strlen(defaultValue) + 1;
1654 newSize += (uint32)strlen(val) + 1;
1656 char* newData = makeRoomForParameter(cid, newSize);
1657 if (newData == NULL) {
1664 param->
size = newSize;
1666 memcpy(newData +
sizeof(
ParamHeader), name, nameLen+1);
1670 newData += strlen(val) + 1;
1672 if (defaultValue != NULL)
1685 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1689 if (cid >= header->indexSize) {
1702 uint32 nameLen = (uint32)strlen(name);
1704 uint32 dataSize = 0;
1705 const char* pVal = val;
1706 for (n=0; n<count; n++) {
1707 len = (uint32)strlen(pVal) + 1;
1711 newSize += dataSize;
1713 char* newData = makeRoomForParameter(cid, newSize);
1714 if (newData == NULL) {
1721 param->
size = newSize;
1723 memcpy(newData +
sizeof(
ParamHeader), name, nameLen+1);
1726 dHeader->
index = defaultIndex;
1728 dHeader->
count = count;
1741 uint32 n, dlen, len = 0, dataSize = 0, defaultIndex = 0;
1742 uint32 count = (uint32)values.size();
1743 for (n=0; n<count; n++)
1744 dataSize += (uint32)values[n].size() + 1;
1745 char* val =
new char[dataSize];
1746 for (n=0; n<count; n++) {
1747 dlen = (uint32)values[n].size()+1;
1748 memcpy(val+len, values[n].c_str(), dlen);
1750 if (values[n] == defaultValue)
1759 uint32 n, defaultIndex = 0;
1760 uint32 count = (uint32)values.size();
1761 int64* val =
new int64[count];
1762 for (n=0; n<count; n++) {
1764 if (val[n] == defaultValue)
1773 uint32 n, defaultIndex = 0;
1774 uint32 count = (uint32)values.size();
1775 int64* val =
new int64[count];
1776 for (n = 0; n<count; n++) {
1778 if (val[n] == defaultValue)
1787 uint32 n, defaultIndex = 0;
1788 uint32 count = (uint32)values.size();
1789 float64* val =
new float64[count];
1790 for (n=0; n<count; n++) {
1792 if (val[n] == defaultValue)
1801 uint32 n, defaultIndex = 0;
1802 uint32 count = (uint32)values.size();
1803 float64* val =
new float64[count];
1804 for (n = 0; n<count; n++) {
1806 if (val[n] == defaultValue)
1815 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1819 if (cid >= header->indexSize) {
1831 uint32 nameLen = (uint32)strlen(name);
1834 char* newData = makeRoomForParameter(cid, newSize);
1835 if (newData == NULL) {
1842 pHeader->
size = newSize;
1844 memcpy(newData +
sizeof(
ParamHeader), name, nameLen+1);
1847 dHeader->
index = defaultIndex;
1849 dHeader->
count = count;
1862 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1866 if (cid >= header->indexSize) {
1878 uint32 nameLen = (uint32)strlen(name);
1881 char* newData = makeRoomForParameter(cid, newSize);
1882 if (newData == NULL) {
1889 pHeader->
size = newSize;
1891 memcpy(newData +
sizeof(
ParamHeader), name, nameLen+1);
1894 dHeader->
index = defaultIndex;
1896 dHeader->
count = count;
1909 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1913 if (cid >= header->indexSize) {
1925 uint32 nameLen = (uint32)strlen(name);
1928 char* newData = makeRoomForParameter(cid, newSize);
1929 if (newData == NULL) {
1936 pHeader->
size = newSize;
1938 memcpy(newData +
sizeof(
ParamHeader), name, nameLen+1);
1957 if (!mutex || !mutex->enter(5000, __FUNCTION__))
1961 if (cid >= header->indexSize) {
1973 uint32 nameLen = (uint32)strlen(name);
1976 char* newData = makeRoomForParameter(cid, newSize);
1977 if (newData == NULL) {
1984 pHeader->
size = newSize;
1986 memcpy(newData +
sizeof(
ParamHeader), name, nameLen+1);
2005 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2009 if (cid >= header->indexSize) {
2026 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2030 if (cid >= header->indexSize) {
2042 uint32 delSize = param->
size;
2044 memmove(((
char*)param), ((
char*)param)+param->
size, moveSize);
2052 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2056 if (cid >= header->indexSize) {
2067 uint8 type = param->
type;
2073 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2077 if (cid >= header->indexSize) {
2091 size =
sizeof(int64);
2093 size =
sizeof(float64);
2095 size = ((uint32)strlen(pSrc) + 1);
2099 for (uint32 n=0; n<cHeader->
index; n++)
2100 pSrc += strlen(pSrc) + 1;
2101 size = (uint32)strlen(pSrc) + 1;
2109 char* val =
new char[maxSize];
2112 std::string valString = val;
2119 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2123 if (cid >= header->indexSize) {
2134 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2144 for (uint32 n = 0; n<cHeader->
index; n++)
2145 pSrc += strlen(pSrc) + 1;
2171 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2175 if (cid >= header->indexSize) {
2189 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2192 if (
stricmp(pSrc,
"Yes") == 0) {
2204 for (uint32 n = 0; n<cHeader->
index; n++)
2205 pSrc += strlen(pSrc) + 1;
2206 if (
stricmp(pSrc,
"yes") == 0) {
2216 ival = *(int64*)(pSrc);
2223 ival = *(int64*)pSrc;
2228 fval = *(float64*)(pSrc);
2235 fval = *(float64*)pSrc;
2247 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2251 if (cid >= header->indexSize) {
2262 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2265 if (maxSize < strlen(pSrc) + 1) {
2276 for (uint32 n=0; n<cHeader->
index; n++)
2277 pSrc += strlen(pSrc) + 1;
2278 if (maxSize < strlen(pSrc) + 1) {
2293 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2297 if (cid >= header->indexSize) {
2308 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2311 val = *(int64*)(pSrc);
2318 val = *(int64*) pSrc;
2329 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2333 if (cid >= header->indexSize) {
2344 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2347 val = *(float64*)(pSrc);
2354 val = *(float64*) pSrc;
2366 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2370 if (cid >= header->indexSize) {
2382 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2384 oldSize = (uint32)strlen(pSrc);
2385 if (strlen(val) == oldSize) {
2391 uint32 defaultSize = (uint32)strlen(pSrc + oldSize + 1) + 1;
2392 char* defaultValue =
new char[defaultSize];
2396 delete [] defaultValue;
2402 delete [] defaultValue;
2407 delete [] defaultValue;
2416 while (index < cHeader->count) {
2417 if (
stricmp(val, pSrc) == 0) {
2419 cHeader->
index = index;
2424 pSrc += strlen(pSrc) + 1;
2436 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2440 if (cid >= header->indexSize) {
2451 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2463 while (index < cHeader->count) {
2464 if (*(int64*)pSrc == val) {
2466 cHeader->
index = index;
2471 pSrc +=
sizeof(int64);
2483 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2487 if (cid >= header->indexSize) {
2498 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2510 while (index < cHeader->count) {
2511 if (*(float64*)pSrc == val) {
2513 cHeader->
index = index;
2518 pSrc +=
sizeof(float64);
2531 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2535 if (cid >= header->indexSize) {
2546 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2571 if (
setParameter(cid, name, pSrc + strlen(pSrc) + 1)) {
2593 if (!mutex || !mutex->enter(5000, __FUNCTION__))
2597 if (cid >= header->indexSize) {
2608 char* pSrc = ((
char*)pHeader) +
sizeof(
ParamHeader) + strlen(((
char*)pHeader) +
sizeof(
ParamHeader)) + 1;
2612 if ( (cHeader->
index + tweak >= 0) && (cHeader->
index + tweak < cHeader->count) ) {
2613 cHeader->
index += tweak;
2628 int64 testInt = iHeader->
val + (tweak * iHeader->
interval);
2629 if ( (iHeader->
minVal == iHeader->
maxVal) || ((testInt >= iHeader->
minVal) && (testInt <= iHeader->maxVal)) ) {
2630 iHeader->
val = testInt;
2641 float64 testFloat = fHeader->
val + (tweak * fHeader->
interval);
2642 if ( (fHeader->
minVal == fHeader->
maxVal) || ( (testFloat >= fHeader->
minVal) && (testFloat <= fHeader->maxVal)) ) {
2643 fHeader->
val = testFloat;
2676 if (!manager->
create(0)) {
2684 uint32 cid = 1, existingID;
2685 char* name =
new char[1024];
2694 char* str =
new char[1024];
2700 if (strcmp(name, str) != 0) {
2701 unittest::fail(
"Component name mismatch ('%s' != '%s')", name, str);
2714 unittest::fail(
"Component id mismatch ('%u' != '%u')", cid, cid2);
2739 char* test =
new char[1024];
2746 if (strcmp(
"Test", test) != 0) {
2770 if (strcmp(
"Test2", test) != 0) {
2771 unittest::fail(
"Component get private data comparison 2 failed");
2792 unittest::fail(
"Component create duplicate name failed to fail");
2822 if (strcmp(
"Test", test) != 0) {
2823 unittest::fail(
"Component get string parameter comparison 2 failed");
2867 unittest::fail(
"Component get non-existing param failed to fail");
2917 unittest::fail(
"Component tweak integer param 2 failed to fail");
2923 int64 i64[] = {1,2,3,4,5};
2937 unittest::fail(
"Component tweak integer coll param result failed");
2955 unittest::fail(
"Component tweak integer coll param result 2 failed");
2961 unittest::fail(
"Component tweak integer coll param failed to fail");
2985 if (strcmp(test,
"Test3") != 0) {
2986 unittest::fail(
"Component tweak string coll param result failed");
3003 if (strcmp(test,
"Test5") != 0) {
3004 unittest::fail(
"Component tweak string coll param result 2 failed");
3010 unittest::fail(
"Component tweak string coll param failed to fail");
3035 unittest::fail(
"Loc: create failed");
delete(manager);
return false;
3038 uint16 nID = 99, pID = 99;
3040 unittest::fail(
"Loc: getComponentLocation got node=%u proc=%u (want 3/4)", nID, pID);
delete(manager);
return false;
3043 unittest::fail(
"Loc: node/proc id accessors mismatch");
delete(manager);
return false;
3046 unittest::fail(
"Loc: selfTrigger mismatch");
delete(manager);
return false;
3049 unittest::fail(
"Loc: type mismatch");
delete(manager);
return false;
3052 unittest::fail(
"Loc: updateComponentLocation failed");
delete(manager);
return false;
3055 unittest::fail(
"Loc: location not updated");
delete(manager);
return false;
3060 unittest::fail(
"Loc: out-of-range id returned success");
delete(manager);
return false;
3063 unittest::fail(
"Loc: id 0 returned a self-trigger");
delete(manager);
return false;
3066 unittest::fail(
"Loc: out-of-range getComponentName returned success");
delete(manager);
return false;
3075 const int NCOMP = 6;
3076 const uint32 baseID = 10;
3077 char cname[64], buf[4096], expect[64];
3080 for (
int k = 0; k < NCOMP; k++) {
3081 snprintf(cname,
sizeof(cname),
"Comp%d", k);
3083 unittest::fail(
"Multi: create %s failed", cname);
delete(manager);
return false;
3086 snprintf(buf,
sizeof(buf),
"DATA-%d", k);
3088 unittest::fail(
"Multi: setPrivateData %s failed", cname);
delete(manager);
return false;
3092 for (
int k = 0; k < NCOMP; k++) {
3093 snprintf(cname,
sizeof(cname),
"Comp%d", k);
3094 snprintf(expect,
sizeof(expect),
"DATA-%d", k);
3096 unittest::fail(
"Multi: name check Comp%d got '%s'", k, str);
delete(manager);
return false;
3099 unittest::fail(
"Multi: data check Comp%d got '%s' want '%s'", k, buf, expect);
delete(manager);
return false;
3104 memset(buf,
'Z',
sizeof(buf));
3105 snprintf(buf,
sizeof(buf),
"BIGDATA-1");
3107 unittest::fail(
"Multi: grow Comp1 private data failed");
delete(manager);
return false;
3110 for (
int k = 0; k < NCOMP; k++) {
3111 snprintf(cname,
sizeof(cname),
"Comp%d", k);
3113 unittest::fail(
"Multi: post-grow name check Comp%d got '%s'", k, str);
delete(manager);
return false;
3115 if (k == 1) snprintf(expect,
sizeof(expect),
"BIGDATA-1");
3116 else snprintf(expect,
sizeof(expect),
"DATA-%d", k);
3118 unittest::fail(
"Multi: post-grow data check Comp%d got '%s' want '%s'", k, buf, expect);
delete(manager);
return false;
3124 unittest::fail(
"Multi: destroy middle component failed");
delete(manager);
return false;
3127 unittest::fail(
"Multi: destroyed Comp2 still present");
delete(manager);
return false;
3130 for (
int k = 0; k < NCOMP; k++) {
3131 if (k == 2)
continue;
3132 snprintf(cname,
sizeof(cname),
"Comp%d", k);
3134 unittest::fail(
"Multi: post-destroy name check Comp%d got '%s'", k, str);
delete(manager);
return false;
3136 if (k == 1) snprintf(expect,
sizeof(expect),
"BIGDATA-1");
3137 else snprintf(expect,
sizeof(expect),
"DATA-%d", k);
3139 unittest::fail(
"Multi: post-destroy data check Comp%d got '%s' want '%s'", k, buf, expect);
delete(manager);
return false;
3143 for (
int k = 0; k < NCOMP; k++)
3153 unittest::fail(
"Stats: create failed");
delete(manager);
return false;
3166 unittest::fail(
"Stats: counters wrong (in=%llu out=%llu run=%llu cyc=%llu cpu=%llu)",
3168 delete(manager);
return false;
3172 for (
int k = 1; k <= 12; k++) {
3174 m.
setInt(
"Seq", (int64)k);
3182 bool seen[13];
for (
int k = 0; k < 13; k++) seen[k] =
false;
3184 for (
int n = 0; n < 10; n++) {
3191 int64 seq = m.
getInt(
"Seq", ok);
3192 if (ok && seq >= 1 && seq <= 12)
3195 if (present != 10) {
3196 unittest::fail(
"Stats: ring holds %d messages (want 10)", present);
delete(manager);
return false;
3198 if (seen[1] || seen[2]) {
3199 unittest::fail(
"Stats: ring did not evict oldest (Seq 1/2 still present)");
delete(manager);
return false;
3201 for (
int k = 3; k <= 12; k++) {
3203 unittest::fail(
"Stats: ring missing recent message Seq %d", k);
delete(manager);
return false;
3213 uint32 nexisting, gotID;
3219 unittest::fail(
"Name: lookup 'Beta' got %u (want 31)", gotID);
delete(manager);
return false;
3222 unittest::fail(
"Name: lookup 'Alpha' got %u (want 30)", gotID);
delete(manager);
return false;
3225 unittest::fail(
"Name: lookup of missing name returned success");
delete(manager);
return false;
3234 uint16 tidt, existingID16;
3267 if (strcmp(test,
"Type2")) {
3310 if (strcmp(test,
"Tag2")) {
3326 "Component memory: components, private data, parameters, type levels, tags",
"memory");
#define PARAM_STRING_COLL
#define PARAM_INTEGER_COLL
Shared-memory component registry: identity, location, parameters, private data and statistics for eve...
#define COMPSTATUS_STARTING
Component is starting up.
#define CHECKCOMPONENTMEMORYSERIALRETURN(a)
#define SELFTRIGGER_ALLOW
Explicitly allowed.
#define COMPONENT_CAN_MIGRATE
Migration-policy flag: component may be moved to another process/node.
#define GETCOMPOFFSET(header, id)
Offset value for component id (0 = not present).
#define SELFTRIGGER_WARN
Allowed but logged as a warning.
#define GETCOMPDATA(header, id)
Record pointer for component id, or NULL.
#define COMPINFOUSAGE(info)
Total bytes used by a component record including its parameter and private-data areas.
#define COMPSTATUS_RUNNING
Component is executing a run.
#define GETCOMPOFFSETP(header, id)
Pointer to the offset slot for component id.
#define CHECKCOMPONENTMEMORYSERIAL
Re-open the component segment if the master's resize serial no longer matches ours; bails out of the ...
#define DRAFTMSGSIZE
Fixed byte size of the per-message draft slots used in the recent-message rings of ComponentStats / P...
#define COMPONENTMEMORYID
#define COMP_WHITEBOARD
Whiteboard: publish/subscribe message store with retention.
#define COMP_EXTERNAL
External module running outside the node process.
#define COMP_INTERNAL
Internal module (same id as COMP_MODULE).
#define COMP_CATALOG
Catalog: keyed/queryable data store.
Small, dependency-free unit test harness used by all CMSDK object tests.
bool setParameter(uint32 cid, const char *name, const char *val)
bool writeComponentsToMsg(DataMessage *msg)
Serialize all component records into msg.
bool create(uint32 indexSize)
Create the component segment (master only).
uint16 getComponentNodeID(uint32 cid)
bool getComponentName(uint32 cid, char *name, uint32 maxNameLen)
Copy the component name into name.
bool open()
Attach to the existing component segment.
bool getParameterAsBool(uint32 cid, const char *name)
bool syncComponents(DataMessage *msg)
Merge component records received from a remote node.
std::string getComponentNameString(uint32 cid)
bool updateComponentInformation(uint32 cid, uint8 type, uint8 policy, uint8 selfTrigger, uint16 nodeID, uint16 procID)
Update type/policy/self-trigger/location in one call.
std::string printFriendly()
bool deletePrivateData(uint32 cid, const char *name)
Delete blob name.
bool updateComponentLocation(uint32 cid, uint16 nodeID, uint16 procID)
Record a new location (after migration).
std::vector< ComponentInfoStruct > * getAllModules()
Snapshot all module components.
uint8 getParameterDataType(uint32 cid, const char *name)
bool deleteParameter(uint32 cid, const char *name)
Remove the parameter.
bool setComponentStats(uint32 cid, ComponentStats &stats)
Overwrite the component's stats.
bool cancelComponentID(uint32 id)
Release a provisionally reserved component id.
bool getComponentID(const char *name, uint32 &cid)
Look up a component id by name.
AveragePerfStats getComponentPerfStats(uint32 cid)
uint16 getComponentProcessID(uint32 cid)
bool setComponentData(uint32 cid, const char *data, uint64 size, bool wasMigrated)
Replace a component's data area (after migration).
bool addLocalPerformanceStats(std::list< PerfStats > &perfStats)
Append PerfStats for all local components.
bool tweakParameter(uint32 cid, const char *name, int32 tweak)
Step the value by tweak * interval (or collection index).
char * getPrivateDataCopy(uint32 cid, const char *name, uint64 &size)
ComponentMemory(MasterMemory *master)
std::list< std::string > getPrivateDataKeys(uint32 cid)
uint8 lookupComponentID(const char *name, uint32 &id)
Look up a component by name without filtering on readiness.
bool destroyComponent(uint32 cid)
Remove a component record and free its space.
float64 getParameterFloat(uint32 cid, const char *name)
uint32 getParameterValueSize(uint32 cid, const char *name)
uint8 getComponentPolicy(uint32 cid)
bool confirmComponentID(uint32 id)
Mark a provisionally reserved component id as ready (syncStatus 2).
bool getPrivateData(uint32 cid, const char *name, char *data, uint64 maxSize)
Copy blob into caller buffer data (max maxSize).
bool canComponentMigrate(uint32 cid)
std::string getPrivateDataMimetype(uint32 cid, const char *name)
bool getComponentLocation(uint32 cid, uint16 &nodeID, uint16 &procID)
Get the node/process the component runs in.
std::list< uint16 > * findProcessComponents(uint16 procID)
List ids of components in process procID.
std::vector< ComponentInfoStruct > * getAllComponents()
Snapshot all components.
uint64 getPrivateDataSize(uint32 cid, const char *name)
std::vector< ComponentInfoStruct > * getAllCatalogs()
Snapshot all catalog components.
bool setComponentPerfStats(uint32 cid, AveragePerfStats &perfStruct)
Store new performance averages.
char * getComponentData(uint32 cid, uint64 &size)
Copy a component's whole data area (for migration).
static bool UnitTest()
Self-test.
bool hasParameter(uint32 cid, const char *name)
std::map< std::string, std::string > getPrivateDataKeysAndTypes(uint32 cid)
uint8 getComponentSelfTrigger(uint32 cid)
bool createComponent(uint32 id, uint8 type, uint8 policy, uint8 selfTrigger, const char *name, uint64 size, uint16 nodeID, uint16 procID, uint64 time, uint32 &existingID)
Register a component record.
bool isComponentLocal(uint32 cid)
bool addComponentStats(uint32 cid, uint8 status, uint64 usageCPUTicks, DataMessage *inputMsg, DataMessage *outputMsg, uint32 runCount, uint32 cycleCount)
Fold a run's activity into the component's stats (counters, rings, CPU ticks).
bool setComponentPolicy(uint32 cid, uint8 policy)
Set the migration policy.
bool getParameter(uint32 cid, const char *name, char *val, uint32 maxSize)
bool resetParameter(uint32 cid, const char *name)
Restore the parameter's default value/index.
std::vector< ComponentInfoStruct > * getAllLocalComponents()
Snapshot components on this node.
uint8 getComponentType(uint32 cid)
ComponentStats getComponentStats(uint32 cid)
bool setPrivateData(uint32 cid, const char *name, const char *data, uint64 size, const char *mimetype=NULL)
Create/replace blob name.
std::string toXML(bool stats=true)
int64 getParameterInt(uint32 cid, const char *name)
std::string getParameterString(uint32 cid, const char *name, uint32 maxSize)
bool createParameter(uint32 cid, const char *name, const char *val, const char *defaultValue=NULL)
bool writeComponentNamesToMsg(DataMessage *msg)
Write just the component names into msg.
bool setComponentSelfTrigger(uint32 cid, uint8 selfTrigger)
Set the self-trigger policy.
bool getMemoryUsage(uint64 &alloc, uint64 &usage)
Report allocation/usage of the component segment.
bool getTypeLevelID(const char *name, uint16 &id)
bool createNewTag(uint32 id, const char *name, uint64 time, uint32 &existingID)
bool getTagName(uint32 id, char *name, uint32 maxSize)
bool getTagID(const char *name, uint32 &id)
bool confirmTypeLevelID(uint16 id)
bool createNewTypeLevel(uint16 id, const char *name, uint64 time, uint16 &existingID)
bool confirmTagID(uint32 id)
bool getTypeLevelName(uint16 id, char *name, uint32 maxSize)
The central Psyclone data container: a self-contained binary message with typed, named user entries.
bool setString(const char *key, const char *value)
setString(const char* key, const char* value)
bool getInt(const char *key, int64 &value)
getInt(const char* key, int64& value)
bool setInt(const char *key, int64 value)
setInt(const char* key, int64 value)
DataMessageHeader * data
Pointer to the message's flat memory block (header + user entries).
uint32 getSize()
getSize() Get message size Many types of data of any size can be put into a message as user entries; ...
uint64 getTime(const char *key)
getTime(const char* key)
const char * getString(const char *key)
getString(const char* key)
Handle to the node's master shared-memory segment (MemoryMasterStruct).
Top-level facade of the shared-memory subsystem for one process.
ComponentMemory * componentMemory
Accessor for the component registry.
bool create(uint16 sysID, uint32 slotCount=100000, uint16 binCount=2, uint32 minBlockSize=1024, uint32 maxBlockSize=64 *1024, uint64 initSize=50000000L, uint64 maxSize=1000000000L, bool force=false)
Create all shared segments for a new node instance (master process only).
DataMapsMemory * dataMapsMemory
Accessor for the type/context/tag/crank/request maps.
static UnitTestRunner & instance()
Access the singleton (created on first use).
void registerTest(const char *name, UnitTestFunc func, const char *description="", const char *category="", bool inDefaultRun=true)
Register a test with the runner.
Recursive mutual-exclusion lock, optionally named for cross-process use.
uint64 GetTimeNow()
Return the current absolute time (µs since year 0) according to the TMC.
char * OpenSharedMemorySegment(const char *name, uint64 size)
Open and map an existing named shared memory segment.
char * CreateSharedMemorySegment(const char *name, uint64 size, bool force=false)
Create a named shared memory segment and map it into this process.
bool CloseSharedMemorySegment(char *data, uint64 size)
Unmap a segment previously created/opened here.
std::string BytifySize(double val)
Format a byte count with binary units, e.g.
std::string StringFormat(const char *format,...)
printf into a std::string.
int64 Ascii2Int64(const char *ascii, uint32 start=0, uint32 end=0)
Parse a signed 64-bit decimal integer from a substring.
uint32 strcpyavail(char *dst, const char *src, uint32 maxlen, bool copyAvailable)
Bounded strcpy that always NUL-terminates.
float64 Ascii2Float64(const char *ascii, uint32 start=0, uint32 end=0)
Parse a 64-bit float from a substring (decimal point, not locale dependent).
void fail(const char *fmt,...)
Set an explanatory reason shown on the FAIL line.
void detail(const char *fmt,...)
Verbose-only indented diagnostic line (shown only when verbose=1).
void progress(int percent, const char *action)
Report progress with a short description of the current action.
void Register_ComponentMemory_Tests()
Sliding-window averages derived from successive PerfStats snapshots.
One component's registry record in shared memory.
uint16 nodeID
Node the component currently runs on.
uint8 policy
Migration policy (COMPONENT_CAN_MIGRATE flag).
uint64 size
Total record size in bytes including parameter and data areas.
uint8 type
Component type (Whiteboard, Catalog, Module, ...).
uint8 selfTrigger
SELFTRIGGER_* policy.
char name[MAXKEYNAMELEN]
Component name (unique per system).
uint64 createdTime
Creation timestamp (µs).
uint16 procID
Process (space) the component currently runs in.
AveragePerfStats perfStats
uint8 status
COMPSTATUS_* run status.
uint8 syncStatus
Cluster sync status (0: not there, 1: in-sync, 2: ready).
Root header of the component-memory segment.
uint32 cid
Check/magic id validated on attach.
Legacy per-component throughput counters (DataMessageHeader-based rings).
uint64 usageCPUTicks
Cumulative CPU ticks consumed.
uint32 migrationCount
Times this component has migrated.
uint64 msgInBytes
Total bytes received.
uint64 msgInCount
Total messages received.
uint64 cycleCount
Total processing cycles.
uint64 time
Timestamp of the last update (µs).
uint64 currentRunStartTime
Timestamp the current/last run started (µs).
uint64 runCount
Total runs.
uint64 msgOutBytes
Total bytes posted.
DataMessageHeader recentInMsg[10]
uint64 firstRunStartTime
Timestamp of the first run (µs).
DataMessageHeader recentOutMsg[10]
uint64 msgOutCount
Total messages posted.
Raw per-component performance counters sampled inside shared memory.