From 71b7e768e76b8f5ccce761f8dc1da38ccbb48e2f Mon Sep 17 00:00:00 2001 From: Xiangyu Wang Date: Sun, 3 Oct 2021 00:53:55 +0800 Subject: [PATCH] [skip ci]Fix golint warnings in timerecord (#9104) Signed-off-by: Xiangyu Wang --- internal/util/timerecord/time_recorder.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/util/timerecord/time_recorder.go b/internal/util/timerecord/time_recorder.go index 69253b322c..68a81fa411 100644 --- a/internal/util/timerecord/time_recorder.go +++ b/internal/util/timerecord/time_recorder.go @@ -18,6 +18,7 @@ import ( "github.com/milvus-io/milvus/internal/log" ) +// TimeRecorder provides methods to record time duration type TimeRecorder struct { header string start time.Time @@ -33,6 +34,7 @@ func NewTimeRecorder(header string) *TimeRecorder { } } +// RecordSpan return the duration from last record func (tr *TimeRecorder) RecordSpan() time.Duration { curr := time.Now() span := curr.Sub(tr.last) @@ -40,6 +42,7 @@ func (tr *TimeRecorder) RecordSpan() time.Duration { return span } +// ElapseSpan return the duration from the beginning func (tr *TimeRecorder) ElapseSpan() time.Duration { curr := time.Now() span := curr.Sub(tr.start)