Rename newResponseTime to NewResponseTime
parent
4413b302be
commit
1a3d6cb74a
|
@ -58,6 +58,15 @@ type ResponseTime struct {
|
||||||
Time time.Time
|
Time time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newResponseTime returns a new response time
|
||||||
|
// with value `v` and time `time.Now()`.
|
||||||
|
func NewResponseTime(v int) ResponseTime {
|
||||||
|
r := ResponseTime{Value: v, Time: time.Now()}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResponseTimes []ResponseTime
|
||||||
|
|
||||||
// Implements the `Len` method for the
|
// Implements the `Len` method for the
|
||||||
// sort.Interface type
|
// sort.Interface type
|
||||||
func (rs ResponseTimes) Len() int {
|
func (rs ResponseTimes) Len() int {
|
||||||
|
@ -76,15 +85,6 @@ func (rs ResponseTimes) Swap(i, j int) {
|
||||||
rs[i], rs[j] = rs[j], rs[i]
|
rs[i], rs[j] = rs[j], rs[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
// newResponseTime returns a new response time
|
|
||||||
// with value `v` and time `time.Now()`.
|
|
||||||
func newResponseTime(v int) ResponseTime {
|
|
||||||
r := ResponseTime{Value: v, Time: time.Now()}
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResponseTimes []ResponseTime
|
|
||||||
|
|
||||||
// newClient returns a pointer to an InfluxDB client for
|
// newClient returns a pointer to an InfluxDB client for
|
||||||
// a `Config`'s `Address` field. If an error is encountered
|
// a `Config`'s `Address` field. If an error is encountered
|
||||||
// when creating a new client, the function panics.
|
// when creating a new client, the function panics.
|
||||||
|
@ -139,7 +139,7 @@ func Run(cfg *Config) (totalPoints int, responseTimes ResponseTimes, timer *Time
|
||||||
fmt.Println("ERROR: ", err.Error())
|
fmt.Println("ERROR: ", err.Error())
|
||||||
} else {
|
} else {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
responseTimes = append(responseTimes, newResponseTime(int(time.Since(st).Nanoseconds())))
|
responseTimes = append(responseTimes, NewResponseTime(int(time.Since(st).Nanoseconds())))
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
|
|
Loading…
Reference in New Issue