Fix priority time calculation. Track max priority busy rather than seconds squared.
This commit is contained in:
parent
952053ea9c
commit
a093021855
|
@ -167,7 +167,6 @@ public:
|
|||
|
||||
uint64_t numYields;
|
||||
|
||||
double lastPriorityTrackTime;
|
||||
TaskPriority lastMinTaskID;
|
||||
|
||||
std::priority_queue<OrderedTask, std::vector<OrderedTask>> ready;
|
||||
|
@ -730,20 +729,19 @@ void Net2::trackMinPriority( TaskPriority minTaskID, double now ) {
|
|||
for(int c=0; c<NetworkMetrics::PRIORITY_BINS; c++) {
|
||||
TaskPriority pri = networkMetrics.priorityBins[c];
|
||||
if (pri > minTaskID && pri <= lastMinTaskID) { // busy -> idle
|
||||
double busyFor = lastPriorityTrackTime - networkMetrics.priorityTimer[c];
|
||||
networkMetrics.priorityBlocked[c] = false;
|
||||
networkMetrics.priorityBlockedDuration[c] += busyFor;
|
||||
networkMetrics.secSquaredPriorityBlocked[c] += busyFor * busyFor;
|
||||
networkMetrics.priorityBlockedDuration[c] += now - networkMetrics.windowedPriorityTimer[c];
|
||||
networkMetrics.priorityMaxBlockedDuration[c] = std::max(networkMetrics.priorityMaxBlockedDuration[c], now - networkMetrics.priorityTimer[c]);
|
||||
}
|
||||
if (pri <= minTaskID && pri > lastMinTaskID) { // idle -> busy
|
||||
networkMetrics.priorityBlocked[c] = true;
|
||||
networkMetrics.priorityTimer[c] = now;
|
||||
networkMetrics.windowedPriorityTimer[c] = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastMinTaskID = minTaskID;
|
||||
lastPriorityTrackTime = now;
|
||||
}
|
||||
|
||||
void Net2::processThreadReady() {
|
||||
|
|
|
@ -149,16 +149,15 @@ SystemStatistics customSystemMonitor(std::string eventName, StatisticsState *sta
|
|||
|
||||
for (int i = 0; i < NetworkMetrics::PRIORITY_BINS && g_network->networkMetrics.priorityBins[i] != TaskPriority::Zero; i++) {
|
||||
if(g_network->networkMetrics.priorityBlocked[i]) {
|
||||
double lastSegment = std::min(currentStats.elapsed, now() - g_network->networkMetrics.priorityTimer[i]);
|
||||
g_network->networkMetrics.priorityBlockedDuration[i] += lastSegment;
|
||||
g_network->networkMetrics.secSquaredPriorityBlocked[i] += lastSegment * lastSegment;
|
||||
g_network->networkMetrics.priorityTimer[i] = now();
|
||||
g_network->networkMetrics.priorityBlockedDuration[i] += std::min(currentStats.elapsed, now() - g_network->networkMetrics.windowedPriorityTimer[i]);
|
||||
g_network->networkMetrics.priorityMaxBlockedDuration[i] = std::max(g_network->networkMetrics.priorityMaxBlockedDuration[i], now() - g_network->networkMetrics.priorityTimer[i]);
|
||||
g_network->networkMetrics.windowedPriorityTimer[i] = now();
|
||||
}
|
||||
|
||||
double blocked = g_network->networkMetrics.priorityBlockedDuration[i] - statState->networkMetricsState.priorityBlockedDuration[i];
|
||||
double s2Blocked = g_network->networkMetrics.secSquaredPriorityBlocked[i] - statState->networkMetricsState.secSquaredPriorityBlocked[i];
|
||||
n.detail(format("PriorityBusy%d", g_network->networkMetrics.priorityBins[i]).c_str(), blocked);
|
||||
n.detail(format("SumOfSquaredPriorityBusy%d", g_network->networkMetrics.priorityBins[i]).c_str(), s2Blocked);
|
||||
n.detail(format("PriorityBusy%d", g_network->networkMetrics.priorityBins[i]).c_str(), g_network->networkMetrics.priorityBlockedDuration[i] - statState->networkMetricsState.priorityBlockedDuration[i]);
|
||||
n.detail(format("PriorityMaxBusy%d", g_network->networkMetrics.priorityBins[i]).c_str(), g_network->networkMetrics.priorityMaxBlockedDuration[i]);
|
||||
|
||||
g_network->networkMetrics.priorityMaxBlockedDuration[i] = 0;
|
||||
}
|
||||
|
||||
n.trackLatest("NetworkMetrics");
|
||||
|
|
|
@ -302,8 +302,9 @@ struct NetworkMetrics {
|
|||
TaskPriority priorityBins[ PRIORITY_BINS ];
|
||||
bool priorityBlocked[PRIORITY_BINS];
|
||||
double priorityBlockedDuration[PRIORITY_BINS];
|
||||
double secSquaredPriorityBlocked[PRIORITY_BINS];
|
||||
double priorityMaxBlockedDuration[PRIORITY_BINS];
|
||||
double priorityTimer[PRIORITY_BINS];
|
||||
double windowedPriorityTimer[PRIORITY_BINS];
|
||||
|
||||
double oldestAlternativesFailure;
|
||||
double newestAlternativesFailure;
|
||||
|
|
Loading…
Reference in New Issue