Skip to content
Merged
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
10 changes: 10 additions & 0 deletions presto-native-execution/presto_cpp/main/PrestoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,16 @@ void PrestoServer::addServerPeriodicTasks() {
1'000'000, // 1 second
"populate_mem_cpu_info");

periodicTaskManager_->addTask(
[start = start_]() {
const auto seconds = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now() - start)
.count();
RECORD_METRIC_VALUE(kCounterWorkerRuntimeUptimeSecs, seconds);
},
2'000'000, // 2 seconds
"worker_runtime_uptime_secs");

const auto timeslice = SystemConfig::instance()->taskRunTimeSliceMicros();
if (timeslice > 0) {
periodicTaskManager_->addTask(
Expand Down
2 changes: 2 additions & 0 deletions presto-native-execution/presto_cpp/main/common/Counters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ void registerPrestoMetrics() {
DEFINE_METRIC(
kCounterPartitionedOutputBufferGetDataLatencyMs,
facebook::velox::StatType::AVG);
DEFINE_METRIC(
kCounterWorkerRuntimeUptimeSecs, facebook::velox::StatType::AVG);
DEFINE_METRIC(kCounterOsUserCpuTimeMicros, facebook::velox::StatType::AVG);
DEFINE_METRIC(kCounterOsSystemCpuTimeMicros, facebook::velox::StatType::AVG);
DEFINE_METRIC(kCounterOsNumSoftPageFaults, facebook::velox::StatType::AVG);
Expand Down
3 changes: 3 additions & 0 deletions presto-native-execution/presto_cpp/main/common/Counters.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ constexpr std::string_view kCounterTotalPartitionedOutputBuffer{
/// OutputBufferManager.
constexpr std::string_view kCounterPartitionedOutputBufferGetDataLatencyMs{
"presto_cpp.partitioned_output_buffer_get_data_latency_ms"};
/// Worker runtime uptime in seconds after the worker process started.
constexpr std::string_view kCounterWorkerRuntimeUptimeSecs{
"presto_cpp.worker_runtime_uptime_secs"};

/// ================== OS Counters =================

Expand Down
Loading