HappenLee commented on a change in pull request #4825:
URL: https://github.com/apache/incubator-doris/pull/4825#discussion_r515754966



##########
File path: be/src/exec/scan_node.h
##########
@@ -96,49 +96,29 @@ class ScanNode : public ExecNode {
     RuntimeProfile::Counter* rows_read_counter() const {
         return _rows_read_counter;
     }
-    RuntimeProfile::Counter* read_timer() const {
-        return _read_timer;
-    }
-    RuntimeProfile::Counter* total_throughput_counter() const {
-        return _total_throughput_counter;
-    }
-    RuntimeProfile::Counter* per_read_thread_throughput_counter() const {
-        return _per_read_thread_throughput_counter;
-    }
     RuntimeProfile::Counter* materialize_tuple_timer() const {
         return _materialize_tuple_timer;
     }
-    RuntimeProfile::ThreadCounters* scanner_thread_counters() const {
-        return _scanner_thread_counters;
-    }
+    // OLAP_SCAN_NODE profile layering: OLAP_SCAN_NODE, OlapScanner, and 
SegmentIterator according to the calling relationship
+    void init_scan_profile();
 
     // names of ScanNode common counters
     static const std::string _s_bytes_read_counter;
     static const std::string _s_rows_read_counter;
-    static const std::string _s_total_read_timer;
-    static const std::string _s_total_throughput_counter;
-    static const std::string _s_per_read_thread_throughput_counter;
     static const std::string _s_num_disks_accessed_counter;
     static const std::string _s_materialize_tuple_timer;
     static const std::string _s_scanner_thread_counters_prefix;
     static const std::string _s_scanner_thread_total_wallclock_time;
-    static const std::string _s_average_io_mgr_queue_capacity;
-    static const std::string _s_num_scanner_threads_started;
 
 protected:
     RuntimeProfile::Counter* _bytes_read_counter; // # bytes read from the 
scanner
     // # rows/tuples read from the scanner (including those discarded by 
eval_conjucts())
     RuntimeProfile::Counter* _rows_read_counter;
-    RuntimeProfile::Counter* _read_timer; // total read time
-    // Wall based aggregate read throughput [bytes/sec]
-    RuntimeProfile::Counter* _total_throughput_counter;
-    // Per thread read throughput [bytes/sec]
-    RuntimeProfile::Counter* _per_read_thread_throughput_counter;
     RuntimeProfile::Counter* _num_disks_accessed_counter;
     RuntimeProfile::Counter* _materialize_tuple_timer;  // time writing tuple 
slots
-    // Aggregated scanner thread counters
-    RuntimeProfile::ThreadCounters* _scanner_thread_counters;
-    RuntimeProfile::Counter* _num_scanner_threads_started_counter;
+
+    boost::scoped_ptr<RuntimeProfile> _scanner_profile;
+    boost::scoped_ptr<RuntimeProfile> _segment_profile;

Review comment:
       use `std::unique_ptr` replace `boost::scoped_ptr`

##########
File path: be/src/exec/scan_node.cpp
##########
@@ -23,45 +23,37 @@ namespace doris {
 
 const string ScanNode::_s_bytes_read_counter = "BytesRead";
 const string ScanNode::_s_rows_read_counter = "RowsRead";
-const string ScanNode::_s_total_read_timer = "TotalRawReadTime(*)";
-const string ScanNode::_s_total_throughput_counter = "TotalReadThroughput";
 const string ScanNode::_s_materialize_tuple_timer = "MaterializeTupleTime(*)";
-const string ScanNode::_s_per_read_thread_throughput_counter =
-    "PerReadThreadRawHdfsThroughput";
 const string ScanNode::_s_num_disks_accessed_counter = "NumDiskAccess";
 const string ScanNode::_s_scanner_thread_counters_prefix = "ScannerThreads";
 const string ScanNode::_s_scanner_thread_total_wallclock_time =
     "ScannerThreadsTotalWallClockTime";
 
-const string ScanNode::_s_num_scanner_threads_started 
="NumScannerThreadsStarted";
-
 Status ScanNode::prepare(RuntimeState* state) {
+    init_scan_profile();
     RETURN_IF_ERROR(ExecNode::prepare(state));
 
-    _scanner_thread_counters =
-        ADD_THREAD_COUNTERS(runtime_profile(), 
_s_scanner_thread_counters_prefix);
     _bytes_read_counter =
-        ADD_COUNTER(runtime_profile(), _s_bytes_read_counter, TUnit::BYTES);
+        ADD_COUNTER(_segment_profile, _s_bytes_read_counter, TUnit::BYTES);
     //TODO: The _rows_read_counter == RowsReturned counter in exec node, there 
is no need to keep both of them
     _rows_read_counter =
-        ADD_COUNTER(runtime_profile(), _s_rows_read_counter, TUnit::UNIT);
-    _read_timer = ADD_TIMER(runtime_profile(), _s_total_read_timer);
+        ADD_COUNTER(_scanner_profile, _s_rows_read_counter, TUnit::UNIT);
 #ifndef BE_TEST
-    _total_throughput_counter = runtime_profile()->add_rate_counter(
-                                    _s_total_throughput_counter, 
_bytes_read_counter);
 #endif
     _materialize_tuple_timer = ADD_CHILD_TIMER(runtime_profile(), 
_s_materialize_tuple_timer,
                                _s_scanner_thread_total_wallclock_time);
-    _per_read_thread_throughput_counter = 
runtime_profile()->add_derived_counter(
-            _s_per_read_thread_throughput_counter, TUnit::BYTES_PER_SECOND,
-            boost::bind<int64_t>(&RuntimeProfile::units_per_second,
-                                 _bytes_read_counter,
-                                 _read_timer),
-            "");
     _num_disks_accessed_counter =
         ADD_COUNTER(runtime_profile(), _s_num_disks_accessed_counter, 
TUnit::UNIT);
 
     return Status::OK();
 }
 
+void ScanNode::init_scan_profile() {
+    _scanner_profile.reset(new RuntimeProfile("OlapScanner"));
+    runtime_profile()->add_child(_scanner_profile.get(), true, NULL);
+
+    _segment_profile.reset(new RuntimeProfile("SegmentIterator"));

Review comment:
       should ` _segment_profile` and `scanner_profile` be `scan_node`? 
   Like MysqlScanNode is a child of scan_node,` _segment_profile` and 
`scanner_profile`  is useless in `MysqlScanNode`




----------------------------------------------------------------
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.

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

Reply via email to