]> Cypherpunks repositories - gostls13.git/commitdiff
effective_go: provide reference to runtime.NumCPU()
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 12 Jan 2012 18:06:50 +0000 (22:06 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 12 Jan 2012 18:06:50 +0000 (22:06 +0400)
R=golang-dev, robert.hencke, r
CC=golang-dev
https://golang.org/cl/5538050

doc/effective_go.html
doc/effective_go.tmpl
src/pkg/runtime/debug.go
src/pkg/runtime/extern.go

index fdf8aa101d4bdc27f6b4f4365063f60b4529e534..3c16e10c3a71bcea76ff20997fc611ebb5ef733e 100644 (file)
@@ -2623,8 +2623,10 @@ is if you want CPU parallelism you must tell the run-time
 how many goroutines you want executing code simultaneously.  There
 are two related ways to do this.  Either run your job with environment
 variable <code>GOMAXPROCS</code> set to the number of cores to use
-(default 1); or import the <code>runtime</code> package and call
+or import the <code>runtime</code> package and call
 <code>runtime.GOMAXPROCS(NCPU)</code>.
+A helpful value might be <code>runtime.NumCPU()</code>, which reports the number
+of logical CPUs on the local machine.
 Again, this requirement is expected to be retired as the scheduling and run-time improve.
 </p>
 
index e3d311eea210d5d1ab29f91550a0e900a0e18a7b..af1bc1ea4391dd4b8e0aaa4e47c08cdbf51752fb 100644 (file)
@@ -2560,8 +2560,10 @@ is if you want CPU parallelism you must tell the run-time
 how many goroutines you want executing code simultaneously.  There
 are two related ways to do this.  Either run your job with environment
 variable <code>GOMAXPROCS</code> set to the number of cores to use
-(default 1); or import the <code>runtime</code> package and call
+or import the <code>runtime</code> package and call
 <code>runtime.GOMAXPROCS(NCPU)</code>.
+A helpful value might be <code>runtime.NumCPU()</code>, which reports the number
+of logical CPUs on the local machine.
 Again, this requirement is expected to be retired as the scheduling and run-time improve.
 </p>
 
index 124370384c095ebfc46f5059ef89a50913021b01..c2b90566a9989e6f20b7e859e7b8dac01380afad 100644 (file)
@@ -19,6 +19,7 @@ func UnlockOSThread()
 // GOMAXPROCS sets the maximum number of CPUs that can be executing
 // simultaneously and returns the previous setting.  If n < 1, it does not
 // change the current setting.
+// The number of logical CPUs on the local machine can be queried with NumCPU.
 // This call will go away when the scheduler improves.
 func GOMAXPROCS(n int) int
 
index 1860c5b896b438d097d0b01e8e62a5ab2b41f1c2..25c7470aab16900284e62b84417e0502f92961a4 100644 (file)
@@ -68,7 +68,7 @@ func funcline_go(*Func, uintptr) (string, int)
 // mid returns the current os thread (m) id.
 func mid() uint32
 
-// NumCPU returns the number of CPUs on the local machine.
+// NumCPU returns the number of logical CPUs on the local machine.
 func NumCPU() int
 
 // Semacquire waits until *s > 0 and then atomically decrements it.