This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 1f6898a091 [refactor](remove unused file) remove progresss updater (#19332) 1f6898a091 is described below commit 1f6898a0919142044306f378e861593076d9a47a Author: yiguolei <676222...@qq.com> AuthorDate: Mon May 8 09:27:52 2023 +0800 [refactor](remove unused file) remove progresss updater (#19332) Co-authored-by: yiguolei <yiguo...@gmail.com> --- be/src/util/CMakeLists.txt | 1 - be/src/util/progress_updater.cpp | 69 ---------------------------------------- be/src/util/progress_updater.h | 64 ------------------------------------- 3 files changed, 134 deletions(-) diff --git a/be/src/util/CMakeLists.txt b/be/src/util/CMakeLists.txt index 251cf325e2..8c217f0acd 100644 --- a/be/src/util/CMakeLists.txt +++ b/be/src/util/CMakeLists.txt @@ -47,7 +47,6 @@ set(UTIL_FILES path_builder.cpp # TODO: not supported on RHEL 5 perf_counters.cpp - progress_updater.cpp runtime_profile.cpp static_asserts.cpp string_parser.cpp diff --git a/be/src/util/progress_updater.cpp b/be/src/util/progress_updater.cpp deleted file mode 100644 index 320b37ed31..0000000000 --- a/be/src/util/progress_updater.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// This file is copied from -// https://github.com/apache/impala/blob/branch-2.9.0/be/src/util/progress-updater.cpp -// and modified by Doris - -#include "util/progress_updater.h" - -#include <ostream> - -#include "common/logging.h" - -namespace doris { - -ProgressUpdater::ProgressUpdater(const std::string& label, int64_t total, int period) - : _label(label), - _total(total), - _update_period(period), - _num_complete(0), - _last_output_percentage(0) {} - -ProgressUpdater::ProgressUpdater() - : _total(0), _update_period(0), _num_complete(0), _last_output_percentage(0) {} - -void ProgressUpdater::update(int64_t delta) { - DCHECK_GE(delta, 0); - - if (delta == 0) { - return; - } - - __sync_fetch_and_add(&_num_complete, delta); - - // Cache some shared variables to avoid locking. It's possible the progress - // update is out of order (e.g. prints 1 out of 10 after 2 out of 10) - double old_percentage = _last_output_percentage; - int64_t num_complete = _num_complete; - - if (num_complete >= _total) { - // Always print the final 100% complete - VLOG_DEBUG << _label << " 100%% Complete (" << num_complete << " out of " << _total << ")"; - return; - } - - // Convert to percentage as int - int new_percentage = (static_cast<double>(num_complete) / _total) * 100; - - if (new_percentage - old_percentage > _update_period) { - // Only update shared variable if this guy was the latest. - __sync_val_compare_and_swap(&_last_output_percentage, old_percentage, new_percentage); - VLOG_DEBUG << _label << ": " << new_percentage << "%% Complete (" << num_complete - << " out of " << _total << ")"; - } -} -} // namespace doris diff --git a/be/src/util/progress_updater.h b/be/src/util/progress_updater.h deleted file mode 100644 index f37de88335..0000000000 --- a/be/src/util/progress_updater.h +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// This file is copied from -// https://github.com/apache/impala/blob/branch-2.9.0/be/src/util/progress-updater.h -// and modified by Doris - -#pragma once - -#include <stdint.h> - -#include <string> - -namespace doris { - -// Utility class to update progress. This is split out so a different -// logging level can be set for these updates (GLOG_module) -// This class is thread safe. -// Example usage: -// ProgressUpdater updater("Task", 100, 10); // 100 items, print every 10% -// updater.Update(15); // 15 done, prints 15% -// updater.Update(3); // 18 done, doesn't print -// update.Update(5); // 23 done, prints 23% -class ProgressUpdater { -public: - // label - label that is printed with each update. - // max - maximum number of work items - // update_period - how often the progress is spewed expressed as a percentage - ProgressUpdater(const std::string& label, int64_t max, int update_period); - - ProgressUpdater(); - - // 'delta' more of the work has been complete. Will potentially output to - // VLOG_PROGRESS - void update(int64_t delta); - - // Returns if all tasks are done. - bool done() const { return _num_complete >= _total; } - - int64_t total() const { return _total; } - int64_t num_complete() const { return _num_complete; } - -private: - std::string _label; - int64_t _total; - int _update_period; - int64_t _num_complete; - int _last_output_percentage; -}; - -} // namespace doris --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org