diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-08-26 14:32:32 +0200 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-08-26 14:32:32 +0200 |
commit | 13ffe71c95201cb000677bd43b44afd180c64526 (patch) | |
tree | 7909806733c75aa5605fc4532183c686d2e21d8f /stopwatch.go | |
parent | Splitter: Improve layout (diff) | |
download | wireguard-windows-13ffe71c95201cb000677bd43b44afd180c64526.tar.xz wireguard-windows-13ffe71c95201cb000677bd43b44afd180c64526.zip |
Unexport stopwatch stuff
Diffstat (limited to 'stopwatch.go')
-rw-r--r-- | stopwatch.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/stopwatch.go b/stopwatch.go index 366c2bd1..6794aa11 100644 --- a/stopwatch.go +++ b/stopwatch.go @@ -36,18 +36,18 @@ func (sws *stopwatchStats) Average() time.Duration { return time.Nanosecond * time.Duration(sws.total.Nanoseconds()/sws.count) } -type Stopwatch struct { +type stopwatch struct { mutex sync.Mutex subject2item map[string]*stopwatchItem } -func NewStopwatch() *Stopwatch { - return &Stopwatch{ +func newStopwatch() *stopwatch { + return &stopwatch{ subject2item: make(map[string]*stopwatchItem), } } -func (sw *Stopwatch) Start(subject string) time.Time { +func (sw *stopwatch) Start(subject string) time.Time { sw.mutex.Lock() defer sw.mutex.Unlock() @@ -62,7 +62,7 @@ func (sw *Stopwatch) Start(subject string) time.Time { return item.startedTime } -func (sw *Stopwatch) Stop(subject string) time.Duration { +func (sw *stopwatch) Stop(subject string) time.Duration { sw.mutex.Lock() defer sw.mutex.Unlock() @@ -86,7 +86,7 @@ func (sw *Stopwatch) Stop(subject string) time.Duration { return duration } -func (sw *Stopwatch) Cancel(subject string) { +func (sw *stopwatch) Cancel(subject string) { sw.mutex.Lock() defer sw.mutex.Unlock() @@ -98,7 +98,7 @@ func (sw *Stopwatch) Cancel(subject string) { item.startedTime = time.Time{} } -func (sw *Stopwatch) Clear() { +func (sw *stopwatch) Clear() { sw.mutex.Lock() defer sw.mutex.Unlock() @@ -107,7 +107,7 @@ func (sw *Stopwatch) Clear() { } } -func (sw *Stopwatch) Print() { +func (sw *stopwatch) Print() { sw.mutex.Lock() items := make([]*stopwatchItem, 0, len(sw.subject2item)) |