func parseExtraMetrics()

in main.go [466:501]


func parseExtraMetrics(line string) map[string]float64 {
	entries := strings.Split(line, "\t")
	// If the result has less than 3 columns, it doesn't contain
	// extra metrics to be reported.
	if len(entries) < 3 {
		return nil
	}

	result := make(map[string]float64)
	// Ignore the first three entries since they're fixed to be the benchmark,
	// name, iterations and ns/op.
	for _, entry := range entries[3:] {
		parts := strings.Split(strings.TrimSpace(entry), " ")
		if len(parts) < 2 {
			continue
		}

		key := strings.TrimSpace(parts[1])
		value, err := strconv.ParseFloat(strings.TrimSpace(parts[0]), 64)
		if err != nil {
			continue
		}
		switch key {
		case "ns/op", "MB/s", "B/op", "allocs/op":
			// Ignore the native benchmark fields
			continue
		default:
			escapedKey := strings.ReplaceAll(key, "/", "_")
			result[escapedKey] = value
		}
	}
	if len(result) > 0 {
		return result
	}
	return nil
}