Standardize the statistical granularity of block_time in the SQL plan monitor.

This commit is contained in:
qingsuijiu
2024-03-07 03:50:17 +00:00
committed by ob-robot
parent 40dcf13bec
commit 5279be2c40
2 changed files with 7 additions and 5 deletions

View File

@ -694,6 +694,7 @@ int ObVirtualSqlPlanMonitor::convert_node_to_row(ObMonitorNode &node, ObNewRow *
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "cur row cell is NULL", K(ret));
}
uint64_t cpu_khz = OBSERVER.get_cpu_frequency_khz();
for (int64_t cell_idx = 0;
OB_SUCC(ret) && cell_idx < output_column_ids_.count();
++cell_idx) {
@ -732,11 +733,11 @@ int ObVirtualSqlPlanMonitor::convert_node_to_row(ObMonitorNode &node, ObNewRow *
}
case DB_TIME: {
// concept:
cells[cell_idx].set_int(node.db_time_);
cells[cell_idx].set_int(node.db_time_ / cpu_khz);
break;
}
case USER_IO_WAIT_TIME: {
cells[cell_idx].set_int(node.block_time_);
cells[cell_idx].set_int(node.block_time_ / cpu_khz);
break;
}
case FIRST_REFRESH_TIME: {

View File

@ -1106,9 +1106,10 @@ int ObOperator::submit_op_monitor_node()
}
}
// exclude io time cost
uint64_t cpu_khz = OBSERVER.get_cpu_frequency_khz();
op_monitor_info_.db_time_ = 1000 * db_time / cpu_khz;
op_monitor_info_.block_time_ = 1000 * op_monitor_info_.block_time_ / cpu_khz;
// Change to divide by cpu_khz when generating the virtual table.
// Otherwise, the unit of this field is inconsistent during SQL execution and after SQL execution is completed.
op_monitor_info_.db_time_ = 1000 * db_time;
op_monitor_info_.block_time_ = 1000 * op_monitor_info_.block_time_;
IGNORE_RETURN list->submit_node(op_monitor_info_);
LOG_DEBUG("debug monitor", K(spec_.id_));