...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package numcpus_test
16
17 import (
18 "fmt"
19 "os"
20
21 "github.com/tklauser/numcpus"
22 )
23
24 func ExampleGetOffline() {
25 offline, err := numcpus.GetOffline()
26 if err != nil {
27 fmt.Fprintf(os.Stderr, "GetOffline: %v\n", err)
28 }
29 fmt.Printf("# of offline CPUs: %v\n", offline)
30 }
31
32 func ExampleGetOnline() {
33 online, err := numcpus.GetOnline()
34 if err != nil {
35 fmt.Fprintf(os.Stderr, "GetOnline: %v\n", err)
36 }
37 fmt.Printf("# of online CPUs: %v\n", online)
38 }
39
40 func ExampleGetPossible() {
41 possible, err := numcpus.GetPossible()
42 if err != nil {
43 fmt.Fprintf(os.Stderr, "GetPossible: %v\n", err)
44 }
45 fmt.Printf("# of possible CPUs: %v\n", possible)
46 }
47
48 func ExampleGetPresent() {
49 present, err := numcpus.GetPresent()
50 if err != nil {
51 fmt.Fprintf(os.Stderr, "GetPresent: %v\n", err)
52 }
53 fmt.Printf("# of present CPUs: %v\n", present)
54 }
55
View as plain text