This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch resource_ctx
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/resource_ctx by this push:
new a3a0212db79 f
a3a0212db79 is described below
commit a3a0212db79fb0e0d82ff50a8c74b4b542ea7c8b
Author: yiguolei <[email protected]>
AuthorDate: Sat Dec 7 17:28:54 2024 +0800
f
---
be/src/runtime/workload_management/cpu_context.h | 6 +++++-
be/src/runtime/workload_management/io_context.h | 17 ++++++++++-------
be/src/runtime/workload_management/memory_context.h | 13 ++++++++-----
3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/be/src/runtime/workload_management/cpu_context.h
b/be/src/runtime/workload_management/cpu_context.h
index 6bf9c95bf98..ba6681074eb 100644
--- a/be/src/runtime/workload_management/cpu_context.h
+++ b/be/src/runtime/workload_management/cpu_context.h
@@ -35,10 +35,14 @@ class CPUContext : public
std::enable_shared_from_this<CPUContext> {
public:
// Used to collect cpu execution stats.
+ // The stats is not thread safe.
+ // For example, you should use a seperate object for every scanner and do
merge and reset
class CPUStats {
public:
- std::string debug_string();
// Should add some cpu stats relared method here.
+ void reset();
+ void merge(CPUStats& stats);
+ std::string debug_string();
};
public:
diff --git a/be/src/runtime/workload_management/io_context.h
b/be/src/runtime/workload_management/io_context.h
index b4dd5a0b6c1..9d34b1811db 100644
--- a/be/src/runtime/workload_management/io_context.h
+++ b/be/src/runtime/workload_management/io_context.h
@@ -39,6 +39,9 @@ public:
public:
IOStats() = default;
virtual ~IOStats() = default;
+ void merge(IOStats stats);
+ void reset();
+ std::string debug_string();
int64_t scan_rows() { return scan_rows_; }
int64_t scan_bytes() { return scan_bytes_; }
int64_t scan_bytes_from_local_storage() { return
scan_bytes_from_local_storage_; }
@@ -61,15 +64,15 @@ public:
std::string debug_string();
private:
- std::atomic<int64_t> scan_rows_ = 0;
- std::atomic<int64_t> scan_bytes_ = 0;
- std::atomic<int64_t> scan_bytes_from_local_storage_ = 0;
- std::atomic<int64_t> scan_bytes_from_remote_storage_ = 0;
+ int64_t scan_rows_ = 0;
+ int64_t scan_bytes_ = 0;
+ int64_t scan_bytes_from_local_storage_ = 0;
+ int64_t scan_bytes_from_remote_storage_ = 0;
// number rows returned by query.
// only set once by result sink when closing.
- std::atomic<int64_t> returned_rows_ = 0;
- std::atomic<int64_t> shuffle_send_bytes_ = 0;
- std::atomic<int64_t> shuffle_send_rows_ = 0;
+ int64_t returned_rows_ = 0;
+ int64_t shuffle_send_bytes_ = 0;
+ int64_t shuffle_send_rows_ = 0;
};
public:
diff --git a/be/src/runtime/workload_management/memory_context.h
b/be/src/runtime/workload_management/memory_context.h
index cf7a80010d4..3e3a067e840 100644
--- a/be/src/runtime/workload_management/memory_context.h
+++ b/be/src/runtime/workload_management/memory_context.h
@@ -35,10 +35,13 @@ class MemoryContext : public
std::enable_shared_from_this<MemoryContext> {
public:
// Used to collect memory execution stats.
+ // The stats class is not thread safe, should not do concurrent
modifications.
class MemoryStats {
public:
MemoryStats() = default;
virtual ~MemoryStats() = default;
+ void merge(MemoryStats& stats);
+ void reset();
std::string debug_string();
int64_t revoke_attempts() { return revoke_attempts_; }
int64_t revoke_wait_time_ms() { return revoke_wait_time_ms_; }
@@ -49,14 +52,14 @@ public:
private:
// Maximum memory peak for all backends.
// only set once by result sink when closing.
- std::atomic<int64_t> max_peak_memory_bytes_ = 0;
- std::atomic<int64_t> current_used_memory_bytes_ = 0;
+ int64_t max_peak_memory_bytes_ = 0;
+ int64_t current_used_memory_bytes_ = 0;
// The total number of times that the revoke method is called.
- std::atomic<int64_t> revoke_attempts_ = 0;
+ int64_t revoke_attempts_ = 0;
// The time that waiting for revoke finished.
- std::atomic<int64_t> revoke_wait_time_ms_ = 0;
+ int64_t revoke_wait_time_ms_ = 0;
// The revoked bytes
- std::atomic<int64_t> revoked_bytes_ = 0;
+ int64_t revoked_bytes_ = 0;
};
public:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]