From 3bec41f5a55e8b485577c470a91965cc48cb5d77 Mon Sep 17 00:00:00 2001 From: Kaijie Chen Date: Fri, 14 Jul 2023 18:08:40 +0800 Subject: [PATCH] [improve](load) add more profiles in tablets channel --- be/src/runtime/tablets_channel.cpp | 5 +++++ be/src/runtime/tablets_channel.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/be/src/runtime/tablets_channel.cpp b/be/src/runtime/tablets_channel.cpp index 3844ee2d0b34c2..18aa9e75ee28c1 100644 --- a/be/src/runtime/tablets_channel.cpp +++ b/be/src/runtime/tablets_channel.cpp @@ -77,6 +77,8 @@ void TabletsChannel::_init_profile(RuntimeProfile* profile) { auto* memory_usage = _profile->create_child("PeakMemoryUsage", true, true); _slave_replica_timer = ADD_TIMER(_profile, "SlaveReplicaTime"); + _add_batch_timer = ADD_TIMER(_profile, "AddBatchTime"); + _write_block_timer = ADD_TIMER(_profile, "WriteBlockTime"); _memory_usage_counter = memory_usage->AddHighWaterMarkCounter("Total", TUnit::BYTES); _write_memory_usage_counter = memory_usage->AddHighWaterMarkCounter("Write", TUnit::BYTES); _flush_memory_usage_counter = memory_usage->AddHighWaterMarkCounter("Flush", TUnit::BYTES); @@ -484,6 +486,7 @@ std::ostream& operator<<(std::ostream& os, const TabletsChannelKey& key) { Status TabletsChannel::add_batch(const PTabletWriterAddBlockRequest& request, PTabletWriterAddBlockResult* response) { + SCOPED_TIMER(_add_batch_timer); int64_t cur_seq = 0; _add_batch_number_counter->update(1); @@ -563,10 +566,12 @@ Status TabletsChannel::add_batch(const PTabletWriterAddBlockRequest& request, }; if (request.is_single_tablet_block()) { + SCOPED_TIMER(_write_block_timer); RETURN_IF_ERROR(write_tablet_data(request.tablet_ids(0), [&](DeltaWriter* writer) { return writer->append(&send_data); })); } else { + SCOPED_TIMER(_write_block_timer); for (const auto& tablet_to_rowidxs_it : tablet_to_rowidxs) { RETURN_IF_ERROR(write_tablet_data(tablet_to_rowidxs_it.first, [&](DeltaWriter* writer) { return writer->write(&send_data, tablet_to_rowidxs_it.second); diff --git a/be/src/runtime/tablets_channel.h b/be/src/runtime/tablets_channel.h index 4e523a1acf03db..601d575cdb5ed3 100644 --- a/be/src/runtime/tablets_channel.h +++ b/be/src/runtime/tablets_channel.h @@ -206,6 +206,8 @@ class TabletsChannel { RuntimeProfile::HighWaterMarkCounter* _max_tablet_write_memory_usage_counter = nullptr; RuntimeProfile::HighWaterMarkCounter* _max_tablet_flush_memory_usage_counter = nullptr; RuntimeProfile::Counter* _slave_replica_timer = nullptr; + RuntimeProfile::Counter* _add_batch_timer = nullptr; + RuntimeProfile::Counter* _write_block_timer = nullptr; }; template