diff --git a/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp b/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp index f1a18146c327d..518878099e78d 100644 --- a/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp +++ b/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp @@ -441,38 +441,26 @@ void PeriodicTaskManager::updateOperatingSystemStats() { const int64_t userCpuTimeUs{ static_cast(usage.ru_utime.tv_sec) * 1'000'000 + static_cast(usage.ru_utime.tv_usec)}; - RECORD_METRIC_VALUE( - kCounterOsUserCpuTimeMicros, userCpuTimeUs - lastUserCpuTimeUs_); - lastUserCpuTimeUs_ = userCpuTimeUs; + RECORD_METRIC_VALUE(kCounterOsUserCpuTimeMicros, userCpuTimeUs); const int64_t systemCpuTimeUs{ static_cast(usage.ru_stime.tv_sec) * 1'000'000 + static_cast(usage.ru_stime.tv_usec)}; - RECORD_METRIC_VALUE( - kCounterOsSystemCpuTimeMicros, systemCpuTimeUs - lastSystemCpuTimeUs_); - lastSystemCpuTimeUs_ = systemCpuTimeUs; + RECORD_METRIC_VALUE(kCounterOsSystemCpuTimeMicros, systemCpuTimeUs); const int64_t softPageFaults{usage.ru_minflt}; - RECORD_METRIC_VALUE( - kCounterOsNumSoftPageFaults, softPageFaults - lastSoftPageFaults_); - lastSoftPageFaults_ = softPageFaults; + RECORD_METRIC_VALUE(kCounterOsNumSoftPageFaults, softPageFaults); const int64_t hardPageFaults{usage.ru_majflt}; - RECORD_METRIC_VALUE( - kCounterOsNumHardPageFaults, hardPageFaults - lastHardPageFaults_); - lastHardPageFaults_ = hardPageFaults; + RECORD_METRIC_VALUE(kCounterOsNumHardPageFaults, hardPageFaults); const int64_t voluntaryContextSwitches{usage.ru_nvcsw}; RECORD_METRIC_VALUE( - kCounterOsNumVoluntaryContextSwitches, - voluntaryContextSwitches - lastVoluntaryContextSwitches_); - lastVoluntaryContextSwitches_ = voluntaryContextSwitches; + kCounterOsNumVoluntaryContextSwitches, voluntaryContextSwitches); const int64_t forcedContextSwitches{usage.ru_nivcsw}; RECORD_METRIC_VALUE( - kCounterOsNumForcedContextSwitches, - forcedContextSwitches - lastForcedContextSwitches_); - lastForcedContextSwitches_ = forcedContextSwitches; + kCounterOsNumForcedContextSwitches, forcedContextSwitches); } void PeriodicTaskManager::addOperatingSystemStatsUpdateTask() { diff --git a/presto-native-execution/presto_cpp/main/PeriodicTaskManager.h b/presto-native-execution/presto_cpp/main/PeriodicTaskManager.h index 0f1874504021a..35c555e68e0d2 100644 --- a/presto-native-execution/presto_cpp/main/PeriodicTaskManager.h +++ b/presto-native-execution/presto_cpp/main/PeriodicTaskManager.h @@ -142,14 +142,6 @@ class PeriodicTaskManager { std::shared_ptr>& connectors_; PrestoServer* server_; - // Operating system related stats. - int64_t lastUserCpuTimeUs_{0}; - int64_t lastSystemCpuTimeUs_{0}; - int64_t lastSoftPageFaults_{0}; - int64_t lastHardPageFaults_{0}; - int64_t lastVoluntaryContextSwitches_{0}; - int64_t lastForcedContextSwitches_{0}; - int64_t lastHttpClientNumConnectionsCreated_{0}; // NOTE: declare last since the threads access other members of `this`.