// SetCpu sets the Cpu field's value.
552290
func (s *ContainerDefinition) SetCpu(v int64) *ContainerDefinition {
	s.Cpu = &v
	return s
}
954301
func setCPU(cpu string) error {
	var numCPU int

	availCPU := runtime.NumCPU()

	if strings.HasSuffix(cpu, "%") {
		// Percent
		var percent float32
		pctStr := cpu[:len(cpu)-1]
		pctInt, err := strconv.Atoi(pctStr)
		if err != nil || pctInt < 1 || pctInt > 100 {
			return errors.New("invalid CPU value: percentage must be between 1-100")
		}
		percent = float32(pctInt) / 100
		numCPU = int(float32(availCPU) * percent)
		if numCPU < 1 {
			numCPU = 1
		}
	} else {
		// Number
		num, err := strconv.Atoi(cpu)
		if err != nil || num < 1 {
			return errors.New("invalid CPU value: provide a number or percent greater than 0")
		}
		numCPU = num
	}

	if numCPU > availCPU {
		numCPU = availCPU
	}

	runtime.GOMAXPROCS(numCPU)
	return nil
}
358045
func (s *UpdateVirtualInterfaceAttributesOutput) SetMtu(v int64) *UpdateVirtualInterfaceAttributesOutput {
	s.Mtu = &v
	return s
}
188611
func (s *Device) SetCpu(v *CPU) *Device {
	s.Cpu = v
	return s
}
866105
func (p *propServerPlan) GetCPU() int {
	if p.ServerPlan == nil {
		return -1
	}

	return p.ServerPlan.GetCPU()
}
472457
func (s *AutoScalingThresholds) SetCpuThreshold(v float64) *AutoScalingThresholds {
	s.CpuThreshold = &v
	return s
}
965256
func generateCPU(p domainParams) *CPU {
	if p.Arch() == arch.ARM64 {
		return &CPU{
			Mode:  "custom",
			Match: "exact",
			Model: Model{
				Fallback: "allow",
				Text:     "cortex-a53"},
		}
	}
	return nil
}
798531
func (Ctx *Context) GetOnlineCpus() (onCpus int, err error) {
	err = Ctx.CheckOpen()
	if err != nil {
		return
	}

	ret := C.libxl_get_online_cpus(Ctx.ctx)
	if ret < 0 {
		err = Error(-ret)
		return
	}
	onCpus = int(ret)
	return
}
1239104
func (s *SystemStatus) SetCPUUtilization(v *CPUUtilization) *SystemStatus {
	s.CPUUtilization = v
	return s
}
689086
func (a *cpuAccumulator) freeCPUs() []int {
	result := []int{}
	cores := a.details.Cores().ToSlice()

	sort.Slice(
		cores,
		func(i, j int) bool {
			iCore := cores[i]
			jCore := cores[j]

			iCPUs := a.topo.CPUDetails.CPUsInCore(iCore).ToSlice()
			jCPUs := a.topo.CPUDetails.CPUsInCore(jCore).ToSlice()

			iSocket := a.topo.CPUDetails[iCPUs[0]].SocketID
			jSocket := a.topo.CPUDetails[jCPUs[0]].SocketID

			// Compute the number of CPUs in the result reside on the same socket
			// as each core.
			iSocketColoScore := a.topo.CPUDetails.CPUsInSocket(iSocket).Intersection(a.result).Size()
			jSocketColoScore := a.topo.CPUDetails.CPUsInSocket(jSocket).Intersection(a.result).Size()

			// Compute the number of available CPUs available on the same socket
			// as each core.
			iSocketFreeScore := a.details.CPUsInSocket(iSocket).Size()
			jSocketFreeScore := a.details.CPUsInSocket(jSocket).Size()

			// Compute the number of available CPUs on each core.
			iCoreFreeScore := a.details.CPUsInCore(iCore).Size()
			jCoreFreeScore := a.details.CPUsInCore(jCore).Size()

			return iSocketColoScore > jSocketColoScore ||
				iSocketFreeScore < jSocketFreeScore ||
				iCoreFreeScore < jCoreFreeScore ||
				iSocket < jSocket ||
				iCore < jCore
		})

	// For each core, append sorted CPU IDs to result.
	for _, core := range cores {
		result = append(result, a.details.CPUsInCore(core).ToSlice()...)
	}
	return result
}
159127
func (s *AacSettings) SetCodecProfile(v string) *AacSettings {
	s.CodecProfile = &v
	return s
}
138725
func (api *ServerAPI) SortByCPU(reverse bool) *ServerAPI {
	api.sortBy("ServerPlan.CPU", reverse)
	return api
}
1097184
func (s *RelationalDatabaseBundle) SetCpuCount(v int64) *RelationalDatabaseBundle {
	s.CpuCount = &v
	return s
}
121271
func setLinux(s *Spec) {
	if s.Linux == nil {
		s.Linux = &specs.Linux{}
	}
}
465792
func (thread *Thread) SetPC(pc uint64) error {
	context := winutil.NewCONTEXT()
	context.ContextFlags = _CONTEXT_ALL

	err := _GetThreadContext(thread.os.hThread, context)
	if err != nil {
		return err
	}

	context.Rip = pc

	return _SetThreadContext(thread.os.hThread, context)
}
1246920
func (s *ContainerOverride) SetCpu(v int64) *ContainerOverride {
	s.Cpu = &v
	return s
}
31573
func (soc *Socket) SetRcvbuf(value uint64) error {
	return soc.setUInt64(C.ZMQ_RCVBUF, value)
}