[profile](scan) add projection time in scaner #34120

This commit is contained in:
Mryange
2024-04-26 01:10:07 +08:00
committed by yiguolei
parent 52031c86b7
commit 9f0a5690a6
3 changed files with 10 additions and 0 deletions

View File

@ -405,9 +405,11 @@ void ScannerContext::stop_scanners(RuntimeState* state) {
std::stringstream scanner_statistics;
std::stringstream scanner_rows_read;
std::stringstream scanner_wait_worker_time;
std::stringstream scanner_projection;
scanner_statistics << "[";
scanner_rows_read << "[";
scanner_wait_worker_time << "[";
scanner_projection << "[";
// Scanners can in 3 state
// state 1: in scanner context, not scheduled
// state 2: in scanner worker pool's queue, scheduled but not running
@ -421,6 +423,9 @@ void ScannerContext::stop_scanners(RuntimeState* state) {
scanner_statistics << PrettyPrinter::print(scanner->_scanner->get_time_cost_ns(),
TUnit::TIME_NS)
<< ", ";
scanner_projection << PrettyPrinter::print(scanner->_scanner->projection_time(),
TUnit::TIME_NS)
<< ", ";
scanner_rows_read << PrettyPrinter::print(scanner->_scanner->get_rows_read(),
TUnit::UNIT)
<< ", ";
@ -434,9 +439,11 @@ void ScannerContext::stop_scanners(RuntimeState* state) {
scanner_statistics << "]";
scanner_rows_read << "]";
scanner_wait_worker_time << "]";
scanner_projection << "]";
_scanner_profile->add_info_string("PerScannerRunningTime", scanner_statistics.str());
_scanner_profile->add_info_string("PerScannerRowsRead", scanner_rows_read.str());
_scanner_profile->add_info_string("PerScannerWaitTime", scanner_wait_worker_time.str());
_scanner_profile->add_info_string("PerScannerProjectionTime", scanner_projection.str());
}
_blocks_queue_added_cv.notify_one();

View File

@ -187,6 +187,7 @@ Status VScanner::_filter_output_block(Block* block) {
Status VScanner::_do_projections(vectorized::Block* origin_block, vectorized::Block* output_block) {
SCOPED_RAW_TIMER(&_per_scanner_timer);
SCOPED_RAW_TIMER(&_projection_timer);
const size_t rows = origin_block->rows();
if (rows == 0) {

View File

@ -109,6 +109,7 @@ public:
int64_t get_time_cost_ns() const { return _per_scanner_timer; }
int64_t projection_time() const { return _projection_timer; }
int64_t get_rows_read() const { return _num_rows_read; }
bool is_init() const { return _is_init; }
@ -237,6 +238,7 @@ protected:
ScannerCounter _counter;
int64_t _per_scanner_timer = 0;
int64_t _projection_timer = 0;
bool _should_stop = false;
};