Skip to content

Commit

Permalink
FMR
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh committed Jan 26, 2025
1 parent 4374849 commit c9110ed
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 254 deletions.
88 changes: 0 additions & 88 deletions be/src/util/interval_histogram.cpp

This file was deleted.

48 changes: 0 additions & 48 deletions be/src/util/interval_histogram.h

This file was deleted.

22 changes: 6 additions & 16 deletions be/src/util/threadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_queue_size, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_max_queue_size, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_max_threads, MetricUnit::NOUNIT);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_submit_failed, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(task_execution_time_ns_avg_in_last_1000_times,
MetricUnit::NANOSECONDS);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(task_wait_worker_ns_avg_in_last_1000_times,
MetricUnit::NANOSECONDS);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(task_execution_time_ns_total, MetricUnit::NANOSECONDS);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(task_wait_worker_time_ns_total, MetricUnit::NANOSECONDS);
using namespace ErrorCode;

using std::string;
Expand Down Expand Up @@ -311,8 +309,8 @@ Status ThreadPool::init() {
INT_GAUGE_METRIC_REGISTER(_metric_entity, thread_pool_max_threads);
INT_GAUGE_METRIC_REGISTER(_metric_entity, thread_pool_queue_size);
INT_GAUGE_METRIC_REGISTER(_metric_entity, thread_pool_max_queue_size);
INT_GAUGE_METRIC_REGISTER(_metric_entity, task_execution_time_ns_avg_in_last_1000_times);
INT_GAUGE_METRIC_REGISTER(_metric_entity, task_wait_worker_ns_avg_in_last_1000_times);
INT_COUNTER_METRIC_REGISTER(_metric_entity, task_execution_time_ns_total);
INT_COUNTER_METRIC_REGISTER(_metric_entity, task_wait_worker_time_ns_total);
INT_COUNTER_METRIC_REGISTER(_metric_entity, thread_pool_submit_failed);

_metric_entity->register_hook("update", [this]() {
Expand All @@ -327,14 +325,6 @@ Status ThreadPool::init() {
thread_pool_queue_size->set_value(get_queue_size());
thread_pool_max_queue_size->set_value(get_max_queue_size());
thread_pool_max_threads->set_value(max_threads());
task_execution_time_ns_avg_in_last_1000_times->set_value(
_task_execution_time_ns_statistic.mean());
task_wait_worker_ns_avg_in_last_1000_times->set_value(
_task_wait_worker_time_ns_statistic.mean());

// Remove older data from the histogram so that we can see curve could be more smooth.
_task_execution_time_ns_statistic.reduce_size(1);
_task_wait_worker_time_ns_statistic.reduce_size(1);
});
return Status::OK();
}
Expand Down Expand Up @@ -606,7 +596,7 @@ void ThreadPool::dispatch_thread() {
DCHECK_EQ(ThreadPoolToken::State::RUNNING, token->state());
DCHECK(!token->_entries.empty());
Task task = std::move(token->_entries.front());
_task_wait_worker_time_ns_statistic.add(task.submit_time_wather.elapsed_time());
task_wait_worker_time_ns_total->increment(task.submit_time_wather.elapsed_time());
token->_entries.pop_front();
token->_active_threads++;
--_total_queued_tasks;
Expand All @@ -624,7 +614,7 @@ void ThreadPool::dispatch_thread() {
// with this threadpool, and produce a deadlock.
task.runnable.reset();
l.lock();
_task_execution_time_ns_statistic.add(task_execution_time_watch.elapsed_time());
task_execution_time_ns_total->increment(task_execution_time_watch.elapsed_time());
// Possible states:
// 1. The token was shut down while we ran its task. Transition to QUIESCED.
// 2. The token has no more queued tasks. Transition back to IDLE.
Expand Down
8 changes: 2 additions & 6 deletions be/src/util/threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

#include "agent/cgroup_cpu_ctl.h"
#include "common/status.h"
#include "util/interval_histogram.h"
#include "util/metrics.h"
#include "util/uid_util.h"
#include "util/work_thread_pool.hpp"
Expand Down Expand Up @@ -414,11 +413,8 @@ class ThreadPool {
IntGauge* thread_pool_queue_size = nullptr;
IntGauge* thread_pool_max_queue_size = nullptr;
IntGauge* thread_pool_max_threads = nullptr;
IntGauge* task_execution_time_ns_avg_in_last_1000_times = nullptr;
IntGauge* task_wait_worker_ns_avg_in_last_1000_times = nullptr;

IntervalHistogramStat<int64_t> _task_execution_time_ns_statistic {1000};
IntervalHistogramStat<int64_t> _task_wait_worker_time_ns_statistic {1000};
IntCounter* task_execution_time_ns_total = nullptr;
IntCounter* task_wait_worker_time_ns_total = nullptr;

IntCounter* thread_pool_submit_failed = nullptr;
};
Expand Down
96 changes: 0 additions & 96 deletions be/test/util/interval_histogram_test.cpp

This file was deleted.

0 comments on commit c9110ed

Please sign in to comment.