-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (36 loc) · 928 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"log"
"math/rand"
"strconv"
"time"
"github.com/go-echarts/statsview"
"github.com/pkg/browser"
)
// Visit your browser at http://localhost:18066/debug/statsview
// Or debug as always via http://localhost:18066/debug/pprof, http://localhost:18066/debug/pprof/heap, ...
func main() {
go func() {
mgr := statsview.New()
// Start() runs a HTTP server at `localhost:18066` by default.
mgr.Start()
// Stop() will shutdown the http server gracefully
// mgr.Stop()
}()
time.Sleep(time.Second)
err := browser.OpenURL("http://localhost:18066/debug/statsview")
if err != nil {
log.Fatal(err)
}
// busy working....
// Force the GC to work to make the plots "move".
m := map[string][]byte{}
for {
b := make([]byte, 512+rand.Intn(16*1024))
m[strconv.Itoa(len(m)%(10*100))] = b
if len(m)%(10*100) == 0 {
m = make(map[string][]byte)
}
time.Sleep(10 * time.Millisecond)
}
}