示例#1
0
文件: expvar.go 项目: adamsxu/twister
func init() {
	start := time.Seconds()
	Publish("runtime", map[string]interface{}{
		"cgocalls":   Func(func() interface{} { return runtime.Cgocalls() }),
		"goroutines": Func(func() interface{} { return runtime.Goroutines() }),
		"version":    runtime.Version(),
		"memstats":   &runtime.MemStats,
	})
	Publish("uptimeSeconds", Func(func() interface{} { return time.Seconds() - start }))
	Publish("cmdline", &os.Args)
}
示例#2
0
文件: pi.go 项目: joninvski/go
func main() {
	i := 0
	k := int64(0)
	for {
		d := int64(-1)
		for d < 0 {
			k++
			nextTerm(k)
			d = extractDigit()
		}
		eliminateDigit(d)
		fmt.Printf("%c", d+'0')

		if i++; i%50 == 0 {
			fmt.Printf("\n")
			if i >= 1000 {
				break
			}
		}
	}

	fmt.Printf("\n%d calls; bit sizes: %d %d %d\n", runtime.Cgocalls(), numer.Len(), accum.Len(), denom.Len())
}