Skip to content

Commit

Permalink
cop: add kv read wall time to print result (#1248)
Browse files Browse the repository at this point in the history
* add kv read wall time to print result

Signed-off-by: cfzjywxk <[email protected]>

* format

Signed-off-by: cfzjywxk <[email protected]>

---------

Signed-off-by: cfzjywxk <[email protected]>
  • Loading branch information
cfzjywxk authored Mar 27, 2024
1 parent 05aaba6 commit 603dc7b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions util/execdetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,13 @@ func (td *TimeDetail) String() string {
buf.WriteString("total_wait_time: ")
buf.WriteString(FormatDuration(td.WaitTime))
}
if td.KvReadWallTime > 0 {
if buf.Len() > 0 {
buf.WriteString(", ")
}
buf.WriteString("total_kv_read_wall_time: ")
buf.WriteString(FormatDuration(td.KvReadWallTime))
}
if td.TotalRPCWallTime > 0 {
if buf.Len() > 0 {
buf.WriteString(", ")
Expand All @@ -663,6 +670,17 @@ func (td *TimeDetail) String() string {
return buf.String()
}

// Merge merges the time detail into itself.
func (td *TimeDetail) Merge(detail *TimeDetail) {
if detail != nil {
td.ProcessTime += detail.ProcessTime
td.SuspendTime += detail.SuspendTime
td.WaitTime += detail.WaitTime
td.KvReadWallTime += detail.KvReadWallTime
td.TotalRPCWallTime += detail.TotalRPCWallTime
}
}

// MergeFromTimeDetail merges time detail from pb into itself.
func (td *TimeDetail) MergeFromTimeDetail(timeDetailV2 *kvrpcpb.TimeDetailV2, timeDetail *kvrpcpb.TimeDetail) {
if timeDetailV2 != nil {
Expand Down

0 comments on commit 603dc7b

Please sign in to comment.