diff --git a/bench/bench.go b/bench/bench.go index e75f30f80..28a85c111 100644 --- a/bench/bench.go +++ b/bench/bench.go @@ -139,25 +139,3 @@ func Serial(bs ...Benchmark) Benchmark { benchmarkers: bs, } } - -// wrapper type to force human-readable JSON output -type PrettyDuration time.Duration - -func (d PrettyDuration) MarshalJSON() ([]byte, error) { - s := time.Duration(d).String() - return []byte("\"" + s + "\""), nil -} - -// Recursively replaces elements of ugly types with their pretty wrappers -func Prettify(m map[string]interface{}) map[string]interface{} { - newmap := make(map[string]interface{}) - for k, v := range m { - switch v.(type) { - case time.Duration: - newmap[k] = PrettyDuration(v.(time.Duration)) - default: - newmap[k] = Prettify(v.(map[string]interface{})) - } - } - return newmap -} diff --git a/bench/prettify.go b/bench/prettify.go new file mode 100644 index 000000000..f9fdb04bf --- /dev/null +++ b/bench/prettify.go @@ -0,0 +1,27 @@ +package bench + +import ( + "time" +) + +// wrapper type to force human-readable JSON output +type PrettyDuration time.Duration + +func (d PrettyDuration) MarshalJSON() ([]byte, error) { + s := time.Duration(d).String() + return []byte("\"" + s + "\""), nil +} + +// Recursively replaces elements of ugly types with their pretty wrappers +func Prettify(m map[string]interface{}) map[string]interface{} { + newmap := make(map[string]interface{}) + for k, v := range m { + switch v.(type) { + case time.Duration: + newmap[k] = PrettyDuration(v.(time.Duration)) + default: + newmap[k] = Prettify(v.(map[string]interface{})) + } + } + return newmap +}