// NameToConfig converts a string representation of an event to a perf
// configurator.
NameToConfig converts a string representation of an event to a perf
configurator.
// NameToConfig converts a string representation of an event to a perf // configurator .
func NameToConfig(name string) (perf.Configurator, error) {
	if ev, ok := hardwareEvents[name]; ok {
		return ev, nil
	} else if ev, ok := softwareEvents[name]; ok {
		return ev, nil
	} else if ev, ok := cacheEvents()[name]; ok {
		return ev, nil
	} else if strings.Contains(name, ":") {
		parts := strings.Split(name, ":")
		subsystem, event := parts[0], parts[1]
		config := perf.Tracepoint(subsystem, event)
		return config, nil
	}
	return nil, fmt.Errorf("not found: event %s", name)
}
func NameToConfig ( name string ) ( perf . Configurator , error ) { if ev , ok := hardwareEvents [ name ] ; ok { return ev , nil } else if ev , ok := softwareEvents [ name ] ; ok { return ev , nil } else if ev , ok := cacheEvents ( ) [ name ] ; ok { return ev , nil } else if strings . Contains ( name , " " ) { parts := strings . Split ( name , " " ) subsystem , event := parts [ 0 ] , parts [ 1 ] config := perf . Tracepoint ( subsystem , event ) return config , nil } return nil , fmt . Errorf ( " " , name ) }
NameToConfig converts a string representation of an event to a perf
configurator.
NameToConfig converts a string representation of an event to a perf configurator .