(f *fetchbot.Fetcher, tick time.Duration)
| 125 | } |
| 126 | |
| 127 | func runMemStats(f *fetchbot.Fetcher, tick time.Duration) { |
| 128 | var mu sync.Mutex |
| 129 | var di *fetchbot.DebugInfo |
| 130 | |
| 131 | // Start goroutine to collect fetchbot debug info |
| 132 | go func() { |
| 133 | for v := range f.Debug() { |
| 134 | mu.Lock() |
| 135 | di = v |
| 136 | mu.Unlock() |
| 137 | } |
| 138 | }() |
| 139 | // Start ticker goroutine to print mem stats at regular intervals |
| 140 | go func() { |
| 141 | c := time.Tick(tick) |
| 142 | for _ = range c { |
| 143 | mu.Lock() |
| 144 | printMemStats(di) |
| 145 | mu.Unlock() |
| 146 | } |
| 147 | }() |
| 148 | } |
| 149 | |
| 150 | func printMemStats(di *fetchbot.DebugInfo) { |
| 151 | var mem runtime.MemStats |
no test coverage detected