Skip to content

Commit

Permalink
executor: fix error tikv_cop_wait time in metric profile (#19859) (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Sep 8, 2020
1 parent 3706da0 commit c97f601
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions executor/inspection_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,13 @@ func (pb *profileBuilder) formatValueByTp(value float64) string {
if math.IsNaN(value) {
return ""
}
if value > 1 {
if math.Abs(value) > 1 {
// second unit
return fmt.Sprintf("%.2fs", value)
} else if value*1000 > 1 {
} else if math.Abs(value*1000) > 1 {
// millisecond unit
return fmt.Sprintf("%.2f ms", value*1000)
} else if value*1000*1000 > 1 {
} else if math.Abs(value*1000*1000) > 1 {
// microsecond unit
return fmt.Sprintf("%.2f ms", value*1000*1000)
}
Expand Down Expand Up @@ -635,8 +635,9 @@ func (pb *profileBuilder) genTiDBQueryTree() *metricNode {
table: "tikv_cop_request",
children: []*metricNode{
{
table: "tikv_cop_wait",
label: []string{"type"},
table: "tikv_cop_wait",
label: []string{"type"},
condition: "type != 'all'",
},
{table: "tikv_cop_handle"},
},
Expand Down

0 comments on commit c97f601

Please sign in to comment.