zhiqiang-hhhh commented on code in PR #49688: URL: https://github.com/apache/doris/pull/49688#discussion_r2030400052
########## be/src/util/runtime_profile.h: ########## @@ -278,6 +278,39 @@ class RuntimeProfile { DerivedCounterFunction _counter_fn; }; + using ConditionCounterFunction = std::function<bool(int64_t, int64_t)>; + + class ConditionCounter : public Counter { + public: + ConditionCounter(TUnit::type type, + const ConditionCounterFunction& condition_func, + int64_t condition = 0, + int64_t value = 0, + int64_t level = 2) + : Counter(type, value, level), + _condition(condition), + _value(value), + _condition_func(condition_func) {} + + virtual Counter* clone() const override { + return new ConditionCounter(type(), _condition_func, _condition, value(), level()); + } + + virtual int64_t value() const override { return _value; } Review Comment: std::lock_guard<std::mutex> l(_mutex); -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org