// ParseBenchmarkSuite parses out each test line from the benchmarking
// output and reorders it by library. For each library, the results are
// ordered by action.
ParseBenchmarkSuite parses out each test line from the benchmarking
output and reorders it by library. For each library, the results are
ordered by action.
// ParseBenchmarkSuite parses out each test line from the benchmarking // output and reorders it by library . For each library the results are // ordered by action .
func ParseBenchmarkSuite(r io.Reader) *BenchmarkMap {
	lines, _ := parse.ParseSet(r)
	parsed := BenchmarkMap{}
	re1, _ := regexp.Compile("/(\\w+)")
	re2, _ := regexp.Compile("([A-Z][a-z]+)")
	for name, data := range lines {
		matches := re1.FindAllStringSubmatch(name, -1)
		library, action := strings.ToLower(matches[0][1]), matches[1][1]
		action = re2.FindStringSubmatch(action)[1]
		if _, ok := parsed[library]; !ok {
			parsed[library] = make(map[string][]int)
		}
		parsed[library][action] = append(parsed[library][action], int(data[0].NsPerOp)) 
	}
	return &parsed
}
func ParseBenchmarkSuite ( r io . Reader ) * BenchmarkMap { lines , _ := parse . ParseSet ( r ) parsed := BenchmarkMap { } re1 , _ := regexp . Compile ( " \\ " ) re2 , _ := regexp . Compile ( " " ) for name , data := range lines { matches := re1 . FindAllStringSubmatch ( name , - 1 ) library , action := strings . ToLower ( matches [ 0 ] [ 1 ] ) , matches [ 1 ] [ 1 ] action = re2 . FindStringSubmatch ( action ) [ 1 ] if _ , ok := parsed [ library ] ; ! ok { parsed [ library ] = make ( map [ string ] [ ] int ) } parsed [ library ] [ action ] = append ( parsed [ library ] [ action ] , int ( data [ 0 ] . NsPerOp ) ) } return & parsed }
ParseBenchmarkSuite parses out each test line from the benchmarking
output and reorders it by library.
ParseBenchmarkSuite parses out each test line from the benchmarking output and reorders it by library .
// TODO right now only grabbing NsPrOp, but need to extend to other metrics