【问题标题】:How to find out the number of CPUs in Go lang?如何找出 Go 语言中的 CPU 数量?
【发布时间】:2014-07-27 05:51:03
【问题描述】:

有没有一种简单的方法可以使用 Go lang 找出本地机器上的 CPU 数量?

【问题讨论】:

标签: go system cpu-cores


【解决方案1】:

http://play.golang.org/p/cuaf2ZHLIx

package main

import (  
    "fmt"
    "runtime"
)

func main() {
    fmt.Println(runtime.NumCPU())
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-23
    • 1970-01-01
    • 1970-01-01
    • 2017-07-22
    • 1970-01-01
    • 2011-05-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多