// GetInterfaceStats returns current global operational status of interfaces
325604
func (p *Plugin) GetInterfaceStats() status.InterfaceStats {
	p.access.Lock()
	defer p.access.Unlock()

	return *p.interfaceStat
}
731340
func InterfaceStats() (map[string]InterfaceStat, error) {
	ret := make(map[string]InterfaceStat, 0)
	var current InterfaceStat
	lastline := -1
	lastindex := -1

	lf := func(index int, line string) error {
		if lastline == index && lastindex == 16 {
			ret[current.Device] = current
		}
		current = InterfaceStat{}
		return nil
	}
	el := func(line int, index int, elm string) (err error) {
		switch index {
		case 0:
			current.Device = strings.Split(elm, ":")[0]
		case 1:
			current.RxBytes, err = strconv.ParseUint(elm, 10, 64)
		case 2:
			current.RxPackets, err = strconv.ParseUint(elm, 10, 64)
		case 3:
			current.RxErrors, err = strconv.ParseUint(elm, 10, 64)
		case 4:
			current.RxDrop, err = strconv.ParseUint(elm, 10, 64)
		case 5:
			current.RxFifo, err = strconv.ParseUint(elm, 10, 64)
		case 6:
			current.RxFrame, err = strconv.ParseUint(elm, 10, 64)
		case 7:
			current.RxCompressed, err = strconv.ParseUint(elm, 10, 64)
		case 8:
			current.RxMulticast, err = strconv.ParseUint(elm, 10, 64)
		case 9:
			current.TxBytes, err = strconv.ParseUint(elm, 10, 64)
		case 10:
			current.TxPackets, err = strconv.ParseUint(elm, 10, 64)
		case 11:
			current.TxErrors, err = strconv.ParseUint(elm, 10, 64)
		case 12:
			current.TxDrop, err = strconv.ParseUint(elm, 10, 64)
		case 13:
			current.TxFifo, err = strconv.ParseUint(elm, 10, 64)
		case 14:
			current.TxFrame, err = strconv.ParseUint(elm, 10, 64)
		case 15:
			current.TxCompressed, err = strconv.ParseUint(elm, 10, 64)
		case 16:
			current.TxMulticast, err = strconv.ParseUint(elm, 10, 64)
		}
		lastline = line
		lastindex = index
		return
	}

	// Now actually attempt to parse the config
	if err := ParseSimpleProcFile(DeviceStatsFile, lf, el); err != nil {
		return nil, err
	}

	return ret, nil
}
606003
func (nc *NetworkContext) allInterfaces() (nics []*InterfaceCreated) {
	nc.slotLock.Lock()
	defer nc.slotLock.Unlock()

	for _, v := range nc.eth {
		if v != nil {
			nics = append(nics, v)
		}
	}
	return
}
1275294
func (r Network_Component) GetInterface() (resp datatypes.Network_Bandwidth_Version1_Interface, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Component", "getInterface", nil, &r.Options, &resp)
	return
}
915047
func (gc *GenericChannelAspect) GetStats() interface{} {
	gc.gcdLock.RLock()
	defer gc.gcdLock.RUnlock()

	var mod bytes.Buffer
	enc := gob.NewEncoder(&mod)
	dec := gob.NewDecoder(&mod)

	err := enc.Encode(gc.Gcd)
	if err != nil {
		return err
	}

	var cpy map[string]GenericChannelData
	err = dec.Decode(&cpy)
	if err != nil {
		return err
	}

	return cpy
}
559236
func addrsForInterface(iface *net.Interface) ([]net.IP, []net.IP) {
	var v4, v6, v6local []net.IP

	addrs, _ := iface.Addrs()
	for _, address := range addrs {
		if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
			if ipnet.IP.To4() != nil {
				v4 = append(v4, ipnet.IP)
			} else {
				switch ip := ipnet.IP.To16(); ip != nil {
				case ip.IsGlobalUnicast():
					v6 = append(v6, ipnet.IP)
				case ip.IsLinkLocalUnicast():
					v6local = append(v6local, ipnet.IP)
				}
			}
		}
	}
	if len(v6) == 0 {
		v6 = v6local
	}
	return v4, v6
}
1187037
func netInterfaces() ([]net.Interface, error) {
	validIfaces := []net.Interface{}
	ifaces, err := net.Interfaces()
	if err != nil {
		return nil, err
	}

	for _, iface := range ifaces {
		if !vethRegex.MatchString(iface.Name) && stringSlice(invalidIfaces).pos(iface.Name) == -1 {
			validIfaces = append(validIfaces, iface)
		}
	}

	return validIfaces, nil
}
413104
func (bc *benchmarkClient) getStats(reset bool) *testpb.ClientStats {
	var wallTimeElapsed, uTimeElapsed, sTimeElapsed float64
	mergedHistogram := stats.NewHistogram(bc.histogramOptions)

	if reset {
		// Merging histogram may take some time.
		// Put all histograms aside and merge later.
		toMerge := make([]*stats.Histogram, len(bc.lockingHistograms))
		for i := range bc.lockingHistograms {
			toMerge[i] = bc.lockingHistograms[i].swap(stats.NewHistogram(bc.histogramOptions))
		}

		for i := 0; i < len(toMerge); i++ {
			mergedHistogram.Merge(toMerge[i])
		}

		wallTimeElapsed = time.Since(bc.lastResetTime).Seconds()
		latestRusage := syscall.GetRusage()
		uTimeElapsed, sTimeElapsed = syscall.CPUTimeDiff(bc.rusageLastReset, latestRusage)

		bc.rusageLastReset = latestRusage
		bc.lastResetTime = time.Now()
	} else {
		// Merge only, not reset.
		for i := range bc.lockingHistograms {
			bc.lockingHistograms[i].mergeInto(mergedHistogram)
		}

		wallTimeElapsed = time.Since(bc.lastResetTime).Seconds()
		uTimeElapsed, sTimeElapsed = syscall.CPUTimeDiff(bc.rusageLastReset, syscall.GetRusage())
	}

	b := make([]uint32, len(mergedHistogram.Buckets))
	for i, v := range mergedHistogram.Buckets {
		b[i] = uint32(v.Count)
	}
	return &testpb.ClientStats{
		Latencies: &testpb.HistogramData{
			Bucket:       b,
			MinSeen:      float64(mergedHistogram.Min),
			MaxSeen:      float64(mergedHistogram.Max),
			Sum:          float64(mergedHistogram.Sum),
			SumOfSquares: float64(mergedHistogram.SumOfSquares),
			Count:        float64(mergedHistogram.Count),
		},
		TimeElapsed: wallTimeElapsed,
		TimeUser:    uTimeElapsed,
		TimeSystem:  sTimeElapsed,
	}
}
901438
func GetInterfaces() map[string]struct{} {
	ipmap := map[string]struct{}{}

	ifaces, _ := net.Interfaces()
	for _, intf := range ifaces {
		addrs, _ := intf.Addrs()
		for _, addr := range addrs {
			ip, _, _ := net.ParseCIDR(addr.String())
			if ip.To4() != nil {
				ipmap[ip.String()] = struct{}{}
			}
		}
	}
	return ipmap
}
739621
func (c *Client) IndexStats(indices ...string) *IndicesStatsService {
	return NewIndicesStatsService(c).Index(indices...)
}
1100262
func (r Network_Message_Delivery_Email_Sendgrid) GetStatistics(options *datatypes.Container_Network_Message_Delivery_Email_Sendgrid_Statistics_Options) (resp []datatypes.Container_Network_Message_Delivery_Email_Sendgrid_Statistics, err error) {
	params := []interface{}{
		options,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Message_Delivery_Email_Sendgrid", "getStatistics", params, &r.Options, &resp)
	return
}
430144
func (d *VirDomain) GetInterfaceParameters(device string, params *VirTypedParameters, nParams *int, flags uint32) (int, error) {
	var cParams C.virTypedParameterPtr

	if params != nil && *nParams > 0 {
		cParams = (C.virTypedParameterPtr)(C.calloc(C.size_t(*nParams), C.size_t(unsafe.Sizeof(C.struct__virTypedParameter{}))))
		defer C.virTypedParamsFree(cParams, C.int(*nParams))
	} else {
		cParams = nil
	}

	cDevice := C.CString(device)
	defer C.free(unsafe.Pointer(cDevice))
	result := int(C.virDomainGetInterfaceParameters(d.ptr, cDevice,
		(C.virTypedParameterPtr)(cParams), (*C.int)(unsafe.Pointer(nParams)), C.uint(flags)))
	if result == -1 {
		return result, GetLastError()
	}

	if params != nil && *nParams > 0 {
		params.loadFromCPtr(cParams, *nParams)
	}

	return result, nil
}
706813
func (e *environ) NetworkInterfaces(ctx context.ProviderCallContext, instId instance.Id) ([]network.InterfaceInfo, error) {
	insts, err := e.Instances(ctx, []instance.Id{instId})
	if err != nil {
		return nil, errors.Trace(err)
	}
	envInst, ok := insts[0].(*environInstance)
	if !ok {
		// This shouldn't happen.
		return nil, errors.Errorf("couldn't extract google instance for %q", instId)
	}
	// In GCE all the subnets are in all AZs.
	zones, err := e.zoneNames(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	networks, err := e.networksByURL(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	googleInst := envInst.base
	ifaces := googleInst.NetworkInterfaces()

	var subnetURLs []string
	for _, iface := range ifaces {
		if iface.Subnetwork != "" {
			subnetURLs = append(subnetURLs, iface.Subnetwork)
		}
	}
	subnets, err := e.subnetsByURL(ctx, subnetURLs, networks, zones)
	if err != nil {
		return nil, errors.Trace(err)
	}
	// We know there'll be a subnet for each url requested, otherwise
	// there would have been an error.

	var results []network.InterfaceInfo
	for i, iface := range ifaces {
		details, err := findNetworkDetails(iface, subnets, networks)
		if err != nil {
			return nil, errors.Annotatef(err, "instance %q", instId)
		}
		results = append(results, network.InterfaceInfo{
			DeviceIndex: i,
			CIDR:        details.cidr,
			// The network interface has no id in GCE so it's
			// identified by the machine's id + its name.
			ProviderId:        network.Id(fmt.Sprintf("%s/%s", instId, iface.Name)),
			ProviderSubnetId:  details.subnet,
			ProviderNetworkId: details.network,
			AvailabilityZones: copyStrings(zones),
			InterfaceName:     iface.Name,
			Address:           network.NewScopedAddress(iface.NetworkIP, network.ScopeCloudLocal),
			InterfaceType:     network.EthernetInterface,
			Disabled:          false,
			NoAutoStart:       false,
			ConfigType:        network.ConfigDHCP,
		})
	}
	return results, nil
}
84701
func (_m *FacadeInterface) GetHostStatuses(ctx datastore.Context, hostIDs []string, since time.Time) ([]host.HostStatus, error) {
	ret := _m.Called(ctx, hostIDs, since)

	var r0 []host.HostStatus
	if rf, ok := ret.Get(0).(func(datastore.Context, []string, time.Time) []host.HostStatus); ok {
		r0 = rf(ctx, hostIDs, since)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]host.HostStatus)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, []string, time.Time) error); ok {
		r1 = rf(ctx, hostIDs, since)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
883107
func InterfaceToStats(read time.Time, v interface{}) *Stats {
	return &Stats{
		Metrics: v.(*cgroups.Metrics),
		Read:    read,
	}
}
1357583
func (mr *MockAPICallsMockRecorder) GetContainerInterfaceInfo(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContainerInterfaceInfo", reflect.TypeOf((*MockAPICalls)(nil).GetContainerInterfaceInfo), arg0)
}
379381
func (v *Object) GetInterface(keys ...string) (interface{}, error) {
	child, err := v.getPath(keys)

	if err != nil {
		return nil, err
	} else {
		return child.Interface(), nil
	}
}