// GetBandwidth returns details bandwidth data for the requested relays/bridges
11568
func GetBandwidth(query map[string]string, lastModifiedSince string) (*Bandwidth, string, error) {
	bandwidth := new(Bandwidth)

	if lastModified, err := executeRequest("bandwidth", query, lastModifiedSince, &bandwidth); err != nil {
		return nil, "", err
	} else {
		return bandwidth, lastModified, nil
	}
}
354219
func getWidth(stdoutFd int) int {
	cols, _, err := GetSize(stdoutFd)
	if err != nil {
		return -1
	}
	return cols
}
184346
func (t *Tabulate) getWidths(headers []string, data []*TabulateRow) []int {
	widths := make([]int, len(headers))
	current_max := len(t.EmptyVar)
	for i := 0; i < len(headers); i++ {
		current_max = runewidth.StringWidth(headers[i])
		for _, item := range data {
			if len(item.Elements) > i && len(widths) > i {
				element := item.Elements[i]
				strLength := runewidth.StringWidth(element)
				if strLength > current_max {
					widths[i] = strLength
					current_max = strLength
				} else {
					widths[i] = current_max
				}
			}
		}
	}

	return widths
}
133452
func (c *Client) GetNetwork() (*Network, error) {
	network := &Network{}
	return network, c.Get("/", network)
}
439555
func (h *ExtendedHeader) GetLength(v protocol.VersionNumber) protocol.ByteCount {
	if h.IsLongHeader {
		length := 1 /* type byte */ + 4 /* version */ + 1 /* conn id len byte */ + protocol.ByteCount(h.DestConnectionID.Len()+h.SrcConnectionID.Len()) + protocol.ByteCount(h.PacketNumberLen) + utils.VarIntLen(uint64(h.Length))
		if h.Type == protocol.PacketTypeInitial {
			length += utils.VarIntLen(uint64(len(h.Token))) + protocol.ByteCount(len(h.Token))
		}
		return length
	}

	length := protocol.ByteCount(1 /* type byte */ + h.DestConnectionID.Len())
	length += protocol.ByteCount(h.PacketNumberLen)
	return length
}
1366856
func (s Style) GetDotWidth(defaults ...float64) float64 {
	if s.DotWidth == 0 {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return DefaultDotWidth
	}
	return s.DotWidth
}
234751
func getlength(bs *BlockDriverState) (int64, error) {
	length, err := nbSectors(bs)
	if err != nil {
		return 0, err
	}

	if length > int64(INT64_MAX/BDRV_SECTOR_SIZE) {
		return 0, syscall.EFBIG
	}
	return length * int64(BDRV_SECTOR_SIZE), nil
}
790961
func terminalWidthFunc(fd int) (width int) {
	var info termInfo
	_, _, errno := syscall.Syscall(procInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
	if errno != 0 {
		return -1
	}

	return int(info.size.x)
}
300278
func (s *CreateNetworkProfileInput) SetDownlinkBandwidthBits(v int64) *CreateNetworkProfileInput {
	s.DownlinkBandwidthBits = &v
	return s
}
208366
func (s Session) AddBandwidth(t BandwidthType, bandwidth int) Session {
	v := make([]byte, 0, 128)
	v = append(v, string(t)...)
	v = appendRune(v, ':')
	v = appendInt(v, bandwidth)
	return s.append(TypeBandwidth, v)
}
633864
func DoByteBufStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallClient, reqSize, respSize int) error {
	out := make([]byte, reqSize)
	if err := stream.(grpc.ClientStream).SendMsg(&out); err != nil {
		return fmt.Errorf("/BenchmarkService/StreamingCall.(ClientStream).SendMsg(_) = %v, want <nil>", err)
	}
	var in []byte
	if err := stream.(grpc.ClientStream).RecvMsg(&in); err != nil {
		// EOF is a valid error here.
		if err == io.EOF {
			return nil
		}
		return fmt.Errorf("/BenchmarkService/StreamingCall.(ClientStream).RecvMsg(_) = %v, want <nil>", err)
	}
	return nil
}
756336
func (r Hardware_SecurityModule750) GetProjectedPublicBandwidthUsage() (resp datatypes.Float64, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_SecurityModule750", "getProjectedPublicBandwidthUsage", nil, &r.Options, &resp)
	return
}
422016
func (c *Cell) LineWidth() uint {
	width := 0
	for _, s := range strings.Split(c.String(), "\n") {
		w := runewidth.StringWidth(s)
		if w > width {
			width = w
		}
	}
	return uint(width)
}
268028
func stringWidth(text string) (width int) {
	g := uniseg.NewGraphemes(text)
	for g.Next() {
		var chWidth int
		for _, r := range g.Runes() {
			chWidth = runewidth.RuneWidth(r)
			if chWidth > 0 {
				break // Our best guess at this point is to use the width of the first non-zero-width rune.
			}
		}
		width += chWidth
	}
	return
}
702084
func GetTTYWidth() int {
	var tty *os.File
	var err error
	if tty, err = os.OpenFile("/dev/tty", os.O_RDWR, 0600); err != nil {
		tty = os.Stdout
	} else {
		defer tty.Close()
	}
	if width, _, err := terminal.GetSize(int(tty.Fd())); err != nil {
		return 80
	} else {
		return width
	}
}
1118108
func (r Network_Storage) CollectBandwidth(typ *string, startDate *datatypes.Time, endDate *datatypes.Time) (resp uint, err error) {
	params := []interface{}{
		typ,
		startDate,
		endDate,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Storage", "collectBandwidth", params, &r.Options, &resp)
	return
}
1050349
func ConvertBandwidth(bandwidth string) int64 {
	var rate int64

	const (
		kilobytes = 1024
		megabytes = 1024 * kilobytes
		gigabytes = 1024 * megabytes
	)

	regex := regexp.MustCompile("[0-9]+")
	bw := regex.FindAllString(bandwidth, -1)
	bwParseInt, err := strconv.ParseInt(bw[0], 10, 64)
	if err != nil {
		log.Errorf("error converting bandwidth string to uint64 %+v", err)
	}
	if strings.ContainsAny(bandwidth, "g|G") {
		rate = gigabytes
	} else if strings.ContainsAny(bandwidth, "m|M") {
		rate = megabytes
	} else if strings.ContainsAny(bandwidth, "k|K") {
		rate = kilobytes
	}
	bwInt := bwParseInt * rate
	bwInt = bwInt / 1000

	return bwInt
}