Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,38 +441,26 @@ void PeriodicTaskManager::updateOperatingSystemStats() {
const int64_t userCpuTimeUs{
static_cast<int64_t>(usage.ru_utime.tv_sec) * 1'000'000 +
static_cast<int64_t>(usage.ru_utime.tv_usec)};
RECORD_METRIC_VALUE(
kCounterOsUserCpuTimeMicros, userCpuTimeUs - lastUserCpuTimeUs_);
lastUserCpuTimeUs_ = userCpuTimeUs;
RECORD_METRIC_VALUE(kCounterOsUserCpuTimeMicros, userCpuTimeUs);

const int64_t systemCpuTimeUs{
static_cast<int64_t>(usage.ru_stime.tv_sec) * 1'000'000 +
static_cast<int64_t>(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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ class PeriodicTaskManager {
std::shared_ptr<velox::connector::Connector>>& 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`.
Expand Down
Loading