Example #1
0
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)
}
Example #2
0
File: pi.go Project: 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())
}