Tweaks PAPB polling #533

Merged
muellerr merged 32 commits from tweaks_papb_polling into develop 2023-03-28 22:18:27 +02:00
2 changed files with 25 additions and 12 deletions
Showing only changes of commit 9613d4aa51 - Show all commits

View File

@ -14,13 +14,22 @@ PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, Storage
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
bool someonesBusy = false;
auto stateHandlingForStore = [&](bool storeIsBusy) {
bool vcBusyDuringDump = false;
bool byteFlowControl = false;
auto stateHandlingForStore = [&](bool storeIsBusy, DumpContext& ctx) {
if (storeIsBusy) {
someonesBusy = true;
}
if (fileHasSwapped) {
someFileWasSwapped = fileHasSwapped;
}
if(ctx.vcBusyDuringDump) {
vcBusyDuringDump = true;
}
if(ctx.dumpedBytes - ctx.bytesDumpedAtLastDelay >= 2048) {
byteFlowControl = true;
ctx.bytesDumpedAtLastDelay = ctx.dumpedBytes;
}
};
while (true) {
if (not cyclicStoreCheck()) {
@ -28,13 +37,21 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
}
someonesBusy = false;
someFileWasSwapped = false;
stateHandlingForStore(handleOneStore(stores.okStore, okStoreContext));
stateHandlingForStore(handleOneStore(stores.notOkStore, notOkStoreContext));
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext));
vcBusyDuringDump = false;
stateHandlingForStore(handleOneStore(stores.okStore, okStoreContext), okStoreContext);
stateHandlingForStore(handleOneStore(stores.notOkStore, notOkStoreContext), notOkStoreContext);
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext), miscStoreContext);
if (not someonesBusy) {
TaskFactory::delayTask(100);
} else if (someFileWasSwapped) {
TaskFactory::delayTask(2);
TaskFactory::delayTask(20);
} else if(vcBusyDuringDump) {
TaskFactory::delayTask(20);
} else if(byteFlowControl) {
TaskFactory::delayTask(10);
} else {
// TODO: Lower this as much as possible...
TaskFactory::delayTask(10);
}
}
}

View File

@ -24,17 +24,13 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
} else if (fileHasSwapped) {
TaskFactory::delayTask(20);
} else if (dumpContext.packetWasDumped and
dumpContext.numberOfDumpedPackets - dumpContext.bytesDumpedAtLastDelay >= 2048) {
dumpContext.dumpedBytes - dumpContext.bytesDumpedAtLastDelay >= 2048) {
dumpContext.bytesDumpedAtLastDelay = dumpContext.dumpedBytes;
TaskFactory::delayTask(20);
} else {
TaskFactory::delayTask(10);
// TODO: Lower this as much as possible...
TaskFactory::delayTask(5);
}
// else if(dumpContext.numberOfDumpedPackets % 20 == 0) {
// Manual load management because I don't know what the scheduler is doing..
// Removing this delay can lead to evil side effects.
// TaskFactory::delayTask(5);
//}
}
}