Rename newResponseTime to NewResponseTime

pull/3798/head
Michael Desa 2015-08-21 21:32:37 -07:00
parent 4413b302be
commit 1a3d6cb74a
1 changed files with 10 additions and 10 deletions

View File

@ -58,6 +58,15 @@ type ResponseTime struct {
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
// sort.Interface type
func (rs ResponseTimes) Len() int {
@ -76,15 +85,6 @@ func (rs ResponseTimes) Swap(i, j int) {
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
// a `Config`'s `Address` field. If an error is encountered
// 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())
} else {
mu.Lock()
responseTimes = append(responseTimes, newResponseTime(int(time.Since(st).Nanoseconds())))
responseTimes = append(responseTimes, NewResponseTime(int(time.Since(st).Nanoseconds())))
mu.Unlock()
}
wg.Done()