// getData is used for getting data without * in counter name.
549725
func (p *perfCounter) getData() (uint64, error) {
	ret := win_pdh.PdhCollectQueryData(p.queryHandle)
	if ret != win_pdh.ERROR_SUCCESS {
		return 0, fmt.Errorf("unable to collect data from counter. Error code is %x", ret)
	}

	var bufSize, bufCount uint32
	var size = uint32(unsafe.Sizeof(win_pdh.PDH_FMT_COUNTERVALUE_ITEM_DOUBLE{}))
	var emptyBuf [1]win_pdh.PDH_FMT_COUNTERVALUE_ITEM_DOUBLE // need at least 1 addressable null ptr.
	var data uint64

	ret = win_pdh.PdhGetFormattedCounterArrayDouble(p.counterHandle, &bufSize, &bufCount, &emptyBuf[0])
	if ret != win_pdh.PDH_MORE_DATA {
		return 0, fmt.Errorf("unable to collect data from counter. Error code is %x", ret)
	}

	filledBuf := make([]win_pdh.PDH_FMT_COUNTERVALUE_ITEM_DOUBLE, bufCount*size)
	ret = win_pdh.PdhGetFormattedCounterArrayDouble(p.counterHandle, &bufSize, &bufCount, &filledBuf[0])
	if ret != win_pdh.ERROR_SUCCESS {
		return 0, fmt.Errorf("unable to collect data from counter. Error code is %x", ret)
	}

	for i := 0; i < int(bufCount); i++ {
		c := filledBuf[i]
		data = uint64(c.FmtValue.DoubleValue)
	}

	return data, nil
}
1170669
func (c *Context) GetRawData() ([]byte, error) {
	return ioutil.ReadAll(c.Request.Body)
}
46018
func (m *Milestone) GetUpdatedAt() time.Time {
	if m == nil || m.UpdatedAt == nil {
		return time.Time{}
	}
	return *m.UpdatedAt
}
887570
func (c *Context) WriteData(data interface{}) (err error) {
	var bytes []byte
	if bytes, err = c.Serialize(data); err == nil {
		_, err = c.Write(bytes)
	}
	return
}
1278585
func (c *ClusterManager) GetData() (map[string]*api.Node, error) {
	nodes := make(map[string]*api.Node)
	c.nodeCacheLock.Lock()
	defer c.nodeCacheLock.Unlock()
	for _, value := range c.nodeCache {
		copyValue := value.Copy()
		nodes[value.Id] = copyValue
	}
	return nodes, nil
}
1157523
func (c *Client) GetDatasets(ctx context.Context) ([]*Dataset, error) {
	datasets := make([]*Dataset, 0)
	req, err := c.NewRequest("GET", datasetsPath, nil, nil)
	if err != nil {
		return nil, err
	}

	if err := c.Do(ctx, req, &datasets); err != nil {
		return nil, err
	}

	return datasets, nil
}
878297
func (r Hardware_Component_Partition_Template) GetData() (resp []datatypes.Hardware_Component_Partition_Template_Partition, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_Component_Partition_Template", "getData", nil, &r.Options, &resp)
	return
}
1232528
func (c *nvmlClient) GetStatsData() ([]*StatsData, error) {
	/*
	   nvml fields to be reported to stats api     # nvml_library_call
	   1  - Used Memory                            # nvmlDeviceGetMemoryInfo
	   2  - Utilization of GPU                     # nvmlDeviceGetUtilizationRates
	   3  - Utilization of Memory                  # nvmlDeviceGetUtilizationRates
	   4  - Utilization of Decoder                 # nvmlDeviceGetDecoderUtilization
	   5  - Utilization of Encoder                 # nvmlDeviceGetEncoderUtilization
	   6  - Current GPU Temperature                # nvmlDeviceGetTemperature
	   7  - Power Draw                             # nvmlDeviceGetPowerUsage
	   8  - BAR1 Used memory                       # nvmlDeviceGetBAR1MemoryInfo
	   9  - ECC Errors on requesting L1Cache       # nvmlDeviceGetMemoryErrorCounter
	   10 - ECC Errors on requesting L2Cache       # nvmlDeviceGetMemoryErrorCounter
	   11 - ECC Errors on requesting Device memory # nvmlDeviceGetMemoryErrorCounter
	*/

	// Assumed that this method is called with receiver retrieved from
	// NewNvmlClient
	// because this method handles initialization of NVML library

	numDevices, err := c.driver.DeviceCount()
	if err != nil {
		return nil, fmt.Errorf("nvidia nvml DeviceCount() error: %v\n", err)
	}

	allNvidiaGPUStats := make([]*StatsData, numDevices)

	for i := 0; i < int(numDevices); i++ {
		deviceInfo, deviceStatus, err := c.driver.DeviceInfoAndStatusByIndex(uint(i))
		if err != nil {
			return nil, fmt.Errorf("nvidia nvml DeviceInfoAndStatusByIndex() error: %v\n", err)
		}

		allNvidiaGPUStats[i] = &StatsData{
			DeviceData: &DeviceData{
				DeviceName: deviceInfo.Name,
				UUID:       deviceInfo.UUID,
				MemoryMiB:  deviceInfo.MemoryMiB,
				PowerW:     deviceInfo.PowerW,
				BAR1MiB:    deviceInfo.BAR1MiB,
			},
			PowerUsageW:        deviceStatus.PowerUsageW,
			GPUUtilization:     deviceStatus.GPUUtilization,
			MemoryUtilization:  deviceStatus.MemoryUtilization,
			EncoderUtilization: deviceStatus.EncoderUtilization,
			DecoderUtilization: deviceStatus.DecoderUtilization,
			TemperatureC:       deviceStatus.TemperatureC,
			UsedMemoryMiB:      deviceStatus.UsedMemoryMiB,
			BAR1UsedMiB:        deviceStatus.BAR1UsedMiB,
			ECCErrorsL1Cache:   deviceStatus.ECCErrorsL1Cache,
			ECCErrorsL2Cache:   deviceStatus.ECCErrorsL2Cache,
			ECCErrorsDevice:    deviceStatus.ECCErrorsDevice,
		}
	}
	return allNvidiaGPUStats, nil
}
345758
func (g *Grant) GetUpdatedAt() Timestamp {
	if g == nil || g.UpdatedAt == nil {
		return Timestamp{}
	}
	return *g.UpdatedAt
}
12155
func Get(data []int) Stats {
	if len(data) == 0 {
		return Stats{}
	}
	min, max := minmax(data)

	return Stats{
		Avg: avg(data) / msFactor,
		Min: min / msFactor,
		Max: max / msFactor,
		P50: p(data, 0.5) / msFactor,
		P75: p(data, 0.75) / msFactor,
		P90: p(data, 0.9) / msFactor,
		P95: p(data, 0.95) / msFactor,
		P99: p(data, 0.99) / msFactor,
	}
}
1300177
func (e *Element) GetCharacterData() (string, error) {
	e.lock.RLock()
	defer e.lock.RUnlock()

	if !e.ready {
		return "", &ElementNotReadyErr{}
	}

	return e.characterData, nil
}
188348
func GetMetadata(data []byte, format string) (metadata []byte, err error) {
	return webpGetMetadata(data, strings.ToUpper(format))
}
279676
func (d *DeploymentStatus) GetUpdatedAt() Timestamp {
	if d == nil || d.UpdatedAt == nil {
		return Timestamp{}
	}
	return *d.UpdatedAt
}
1303890
func (m Iteration) GetETagData() []interface{} {
	// using the 'ID' and 'UpdatedAt' (converted to number of seconds since epoch) fields
	values := []interface{}{m.ID, strconv.FormatInt(m.UpdatedAt.Unix(), 10), m.RelationShipsChangedAt}
	return values
}
935576
func (p *BlockPrefetchClient) GetBlockData(hash *chainhash.Hash) (*wire.MsgBlock, *dcrjson.GetBlockHeaderVerboseResult, error) {
	p.Lock()

	retargetAndUnlock := func(nextHash string) {
		p.retarget(nextHash)
		p.Unlock()
	}

	// If the block is already fetched, and the current block, return it. Do not
	// retarget.
	if p.current.hash == *hash /*p.haveBlockHash(*hash)*/ {
		p.hits++
		// Return the requested block.
		defer p.Unlock()
		return p.current.msgBlock, p.current.headerResult, nil
	}

	// If the block is already fetched, and next, return it and retarget with a
	// new range starting at this block's height.
	if p.next.hash == *hash /*p.haveBlockHash(*hash)*/ {
		// Grab the result before retarget() changes p.next (via fetcher ->
		// RetrieveAndStoreNext -> storeNext).
		msgBlock, headerResult := p.next.msgBlock, p.next.headerResult
		go retargetAndUnlock(p.next.headerResult.NextHash)
		p.hits++
		// Return the requested block.
		return msgBlock, headerResult, nil
	}

	p.misses++

	// Immediately retrieve msgBlock and header verbose result while fetcher is
	// blocked by the Mutex.
	msgBlock, headerResult, _, err := p.retrieveBlockAndHeaderResult(hash)
	if err != nil {
		p.Unlock()
		return nil, nil, err
	}

	// Leaving the mutex locked, fire off a goroutine to retarget to the next
	// block. The fetcher goroutine and other locking methods will stay blocked
	// until the mutex unlocks, but the msgBlock can be returned right away.
	go retargetAndUnlock(headerResult.NextHash)

	return msgBlock, headerResult, err
}
1215102
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
	m := make(map[string]string)
	m["dir"] = d.dir(id)
	return m, nil
}
290014
func (s *SwarmSyncerServer) GetData(ctx context.Context, key []byte) ([]byte, error) {
	chunk, err := s.store.Get(ctx, storage.Address(key))
	if err != nil {
		return nil, err
	}
	return chunk.Data(), nil
}