// CPUMhz returns the CPU clock speed
972814
func (s *systemInfo) CPUMHz() (int, error) {
	err := s.collectPlatformInfo()
	if err != nil {
		return 0, err
	}
	return s.cpuMHz, nil
}
875326
func GetClock() Clock {
	if !flag.Parsed() {
		panic("GetClock() called before flags are parsed")
	}

	c, ok := clockTypes[*defaultClockType]
	if !ok {
		log.Fatalf("No Clock type named %v", *defaultClockType)
	}
	return c
}
317803
func (prof *Profiler) CPUList(path string) (string, error) {
	p, err := ioutil.ReadFile(filepath.Join(path, CPUList))
	if err != nil {
		return "", err
	}
	// the list is everything except for the trailing new line
	return string(p[:len(p)-1]), nil
}
919886
func CpuRestGetTime(context *gin.Context) {
	body, err := cpu.ServiceGetTime()
	util.RestHandleResponse(context, body, err)
}
706559
func (r Hardware_SecurityModule) GetProcessorCoreAmount() (resp uint, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_SecurityModule", "getProcessorCoreAmount", nil, &r.Options, &resp)
	return
}
329243
func (soc *Socket) SetHwm(value uint64) error {
	return soc.setUInt64(C.ZMQ_HWM, value)
}
538874
func (prof *Profiler) Serialize(cpus *x.CPUs) ([]byte, error) {
	return json.Marshal(cpus)
}
614854
func (s *PlayerLatency) SetLatencyInMilliseconds(v float64) *PlayerLatency {
	s.LatencyInMilliseconds = &v
	return s
}
171246
func (Ctx *Context) CpupoolCpuremoveCpumap(Poolid uint32, Cpumap Bitmap) (err error) {
	err = Ctx.CheckOpen()
	if err != nil {
		return
	}

	cbm := Cpumap.toC()
	defer C.libxl_bitmap_dispose(&cbm)

	ret := C.libxl_cpupool_cpuremove_cpumap(Ctx.ctx, C.uint32_t(Poolid), &cbm)
	if ret != 0 {
		err = Error(-ret)
		return
	}

	return
}
23506
func (exp *explorerUI) mempoolTime(txid string) types.TimeDef {
	exp.invsMtx.RLock()
	defer exp.invsMtx.RUnlock()
	tx, found := exp.invs.Tx(txid)
	if !found {
		return types.NewTimeDefFromUNIX(0)
	}
	return types.NewTimeDefFromUNIX(tx.Time)
}
683083
func Get() (inf *CPUInfo, err error) {
	stdMu.Lock()
	defer stdMu.Unlock()
	if std == nil {
		std, err = NewProfiler()
		if err != nil {
			return nil, err
		}
	}
	return std.Get()
}
1099256
func (s *systemInfo) CPUCores() (physical, logical int, err error) {
	err = s.collectPlatformInfo()
	if err != nil {
		return 0, 0, err
	}
	return s.cpuPhysicalCores, s.cpuLogicalCores, nil
}
199151
func Serialize(cpus *cpux.CPUs) (p []byte) {
	stdMu.Lock()
	defer stdMu.Unlock()
	if std == nil {
		std = NewProfiler()
	}
	return std.Serialize(cpus)
}
550418
func (pm *ProtocolManager) runBenchmark(benchmarks []requestBenchmark, passCount int, targetTime time.Duration) []*benchmarkSetup {
	setup := make([]*benchmarkSetup, len(benchmarks))
	for i, b := range benchmarks {
		setup[i] = &benchmarkSetup{req: b}
	}
	for i := 0; i < passCount; i++ {
		log.Info("Running benchmark", "pass", i+1, "total", passCount)
		todo := make([]*benchmarkSetup, len(benchmarks))
		copy(todo, setup)
		for len(todo) > 0 {
			// select a random element
			index := rand.Intn(len(todo))
			next := todo[index]
			todo[index] = todo[len(todo)-1]
			todo = todo[:len(todo)-1]

			if next.err == nil {
				// calculate request count
				count := 50
				if next.totalTime > 0 {
					count = int(uint64(next.totalCount) * uint64(targetTime) / uint64(next.totalTime))
				}
				if err := pm.measure(next, count); err != nil {
					next.err = err
				}
			}
		}
	}
	log.Info("Benchmark completed")

	for _, s := range setup {
		if s.err == nil {
			s.avgTime = s.totalTime / time.Duration(s.totalCount)
		}
	}
	return setup
}
30637
func (d CPUDetails) CPUsInSocket(id int) cpuset.CPUSet {
	b := cpuset.NewBuilder()
	for cpu, info := range d {
		if info.SocketID == id {
			b.Add(cpu)
		}
	}
	return b.Result()
}
477343
func (c CPUMap) Total() int {
	var count int
	for _, value := range c {
		count += value
	}
	return count
}
952761
func benchmark(c *redis.Client, testname string, command string, params ...interface{}) {
	fmt.Printf("===== %s =====\n", testname)
	start := time.Now()

	for i := 0; i < *requests; i++ {
		c.Cmd(command, params...)
	}

	duration := time.Now().Sub(start)
	rps := float64(*requests) / duration.Seconds()
	fmt.Println("Requests per second:", rps)
	fmt.Printf("Duration: %v\n\n", duration.Seconds())
}