// GetPercent returns the percent full of the bar
421260
func (c *ProgressBar) GetPercent() int {
	return int(float64(c.progress) / float64(c.total) * 100)
}
283970
func PercentValue(value, sum float64) (s string) {
	value *= 100 / sum
	s = AbsoluteValue(value, sum) + "% "
	return
}
380394
func PercentilInt(data []int, p int) int {
	n := len(data)
	if n == 0 {
		return 0
	}
	if n == 1 {
		return data[0]
	}

	pos := float64(p) * float64(n+1) / 100
	fpos := math.Floor(pos)
	intPos := int(fpos)
	dif := pos - fpos
	if intPos < 1 {
		return data[0]
	}
	if intPos >= n {
		return data[n-1]
	}
	lower := data[intPos-1]
	upper := data[intPos]
	val := float64(lower) + dif*float64(upper-lower)
	return int(math.Floor(val + 0.5))
}
695044
func (s *TreatmentResource) SetSizePercent(v int64) *TreatmentResource {
	s.SizePercent = &v
	return s
}
833056
func (s *DBSnapshot) SetPercentProgress(v int64) *DBSnapshot {
	s.PercentProgress = &v
	return s
}
563608
func (t *StandardTimer) Percentile(p float64) float64 {
	return t.histogram.Percentile(p)
}
482074
func (s *WriteTreatmentResource) SetSizePercent(v int64) *WriteTreatmentResource {
	s.SizePercent = &v
	return s
}
958183
func SamplePercentile(values int64Slice, p float64) float64 {
	return SamplePercentiles(values, []float64{p})[0]
}
1131695
func (c *Configuration) GetsPerPromote(count int32) *Configuration {
	c.getsPerPromote = count
	return c
}
668101
func PercentValueFormatter(v interface{}) string {
	if typed, isTyped := v.(float64); isTyped {
		return FloatValueFormatterWithFormat(typed*100.0, DefaultPercentValueFormat)
	}
	return ""
}
229519
func percentile(totalCount uint64, proportions proportionArray,
	percentile float64) (float64, error) {
	//TODO(tyler) handle multiple percentiles at once for efficiency
	sort.Sort(proportions)
	sofar := uint64(0)
	for _, proportion := range proportions {
		sofar += proportion.Count
		if float64(sofar)/float64(totalCount) >= percentile {
			return proportion.Value, nil
		}
	}
	return 0, errors.New("Invalid percentile.  Should be between 0 and 1.")
}
952352
func ExtractPercentileComputation(opts ...interface{}) *opt.PercentileComputationOption {
	for _, o := range opts {
		if v, ok := o.(*opt.PercentileComputationOption); ok {
			return v
		}
	}
	return nil
}
844162
func (s *Job) SetPercentDone(v string) *Job {
	s.PercentDone = &v
	return s
}
1272763
func CpuRestGetPercent(context *gin.Context) {
	body, err := cpu.ServiceGetPercent()
	util.RestHandleResponse(context, body, err)
}
957394
func percentUsed(path string) (float64, error) {
	var stat syscall.Statfs_t
	err := syscall.Statfs(path, &stat)
	if err != nil {
		return 0, trace.Wrap(err)
	}
	ratio := float64(stat.Blocks-stat.Bfree) / float64(stat.Blocks)
	return math.Round(ratio * 100), nil
}
375659
func (s *CanarySettings) SetPercentTraffic(v float64) *CanarySettings {
	s.PercentTraffic = &v
	return s
}
374044
func (l *kvLedger) GetMissingPvtDataInfoForMostRecentBlocks(maxBlock int) (ledger.MissingPvtDataInfo, error) {
	return l.blockStore.GetMissingPvtDataInfoForMostRecentBlocks(maxBlock)
}