MCPcopy Create free account
hub / github.com/bytedance/bolt / taskStats

Method taskStats

bolt/exec/Task.cpp:2319–2374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2317}
2318
2319TaskStats Task::taskStats() const {
2320 std::lock_guard<std::timed_mutex> l(mutex_);
2321
2322 // 'taskStats_' contains task stats plus stats for the completed drivers
2323 // (their operators).
2324 TaskStats taskStats = taskStats_;
2325
2326 taskStats.numTotalDrivers = drivers_.size();
2327
2328 // Add stats of the drivers (their operators) that are still running.
2329 for (const auto& driver : drivers_) {
2330 // Driver can be null.
2331 if (driver == nullptr) {
2332 ++taskStats.numCompletedDrivers;
2333 continue;
2334 }
2335
2336 for (auto& op : driver->operators()) {
2337 auto statsCopy = op->stats(false);
2338 aggregateOperatorRuntimeStats(statsCopy.runtimeStats);
2339 addRunningTimeOperatorMetrics(statsCopy);
2340 taskStats.pipelineStats[statsCopy.pipelineId]
2341 .operatorStats[statsCopy.operatorId]
2342 .add(statsCopy);
2343 }
2344 if (driver->isOnThread()) {
2345 ++taskStats.numRunningDrivers;
2346 } else if (driver->isTerminated()) {
2347 ++taskStats.numTerminatedDrivers;
2348 } else {
2349 ++taskStats.numBlockedDrivers[driver->blockingReason()];
2350 }
2351 // Find the longest running operator.
2352 auto ocs = driver->opCallStatus();
2353 if (!ocs.empty()) {
2354 const auto callDuration = ocs.callDuration();
2355 if (callDuration > taskStats.longestRunningOpCallMs) {
2356 taskStats.longestRunningOpCall =
2357 ocs.formatCall(driver->findOperatorNoThrow(ocs.opId), ocs.method);
2358 taskStats.longestRunningOpCallMs = callDuration;
2359 }
2360 }
2361 }
2362
2363 // Don't bother with operator calls running under 30 seconds.
2364 if (taskStats.longestRunningOpCallMs < 30000) {
2365 taskStats.longestRunningOpCall.clear();
2366 taskStats.longestRunningOpCallMs = 0;
2367 }
2368
2369 auto bufferManager = bufferManager_.lock();
2370 taskStats.outputBufferUtilization = bufferManager->getUtilization(taskId_);
2371 taskStats.outputBufferOverutilized = bufferManager->isOverutilized(taskId_);
2372 taskStats.outputBufferStats = bufferManager->stats(taskId_);
2373 return taskStats;
2374}
2375
2376bool Task::getLongRunningOpCalls(

Callers 15

getTableScanRuntimeStatsFunction · 0.80
getTableScanRuntimeStatsFunction · 0.80
getTableScanRuntimeStatsFunction · 0.80
executeSerialMethod · 0.80
DEBUG_ONLY_TEST_FFunction · 0.80
TEST_FFunction · 0.80
getTableScanStatsMethod · 0.80
TEST_FFunction · 0.80
runSortWindowTestMethod · 0.80
TEST_FFunction · 0.80

Calls 15

operatorsMethod · 0.80
isTerminatedMethod · 0.80
blockingReasonMethod · 0.80
opCallStatusMethod · 0.80
callDurationMethod · 0.80
formatCallMethod · 0.80
findOperatorNoThrowMethod · 0.80
lockMethod · 0.80
sizeMethod · 0.45
statsMethod · 0.45

Tested by 15

getTableScanRuntimeStatsFunction · 0.64
getTableScanRuntimeStatsFunction · 0.64
getTableScanRuntimeStatsFunction · 0.64
executeSerialMethod · 0.64
DEBUG_ONLY_TEST_FFunction · 0.64
TEST_FFunction · 0.64
getTableScanStatsMethod · 0.64
TEST_FFunction · 0.64
runSortWindowTestMethod · 0.64
TEST_FFunction · 0.64