(di *fetchbot.DebugInfo)
| 148 | } |
| 149 | |
| 150 | func printMemStats(di *fetchbot.DebugInfo) { |
| 151 | var mem runtime.MemStats |
| 152 | runtime.ReadMemStats(&mem) |
| 153 | buf := bytes.NewBuffer(nil) |
| 154 | buf.WriteString(strings.Repeat("=", 72) + "\n") |
| 155 | buf.WriteString("Memory Profile:\n") |
| 156 | buf.WriteString(fmt.Sprintf("\tAlloc: %d Kb\n", mem.Alloc/1024)) |
| 157 | buf.WriteString(fmt.Sprintf("\tTotalAlloc: %d Kb\n", mem.TotalAlloc/1024)) |
| 158 | buf.WriteString(fmt.Sprintf("\tNumGC: %d\n", mem.NumGC)) |
| 159 | buf.WriteString(fmt.Sprintf("\tGoroutines: %d\n", runtime.NumGoroutine())) |
| 160 | if di != nil { |
| 161 | buf.WriteString(fmt.Sprintf("\tNumHosts: %d\n", di.NumHosts)) |
| 162 | } |
| 163 | buf.WriteString(strings.Repeat("=", 72)) |
| 164 | fmt.Println(buf.String()) |
| 165 | } |
| 166 | |
| 167 | // stopHandler stops the fetcher if the stopurl is reached. Otherwise it dispatches |
| 168 | // the call to the wrapped Handler. |
no outgoing calls
no test coverage detected