MCPcopy
hub / github.com/evilsocket/opensnitch / setupProfiling

Function setupProfiling

daemon/main.go:224–249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222}
223
224func setupProfiling() {
225 if traceFile != "" {
226 log.Info("setup trace profile: %s", traceFile)
227 f, err := os.Create(traceFile)
228 if err != nil {
229 log.Fatal("could not create trace profile: %s", err)
230 }
231 trace.Start(f)
232 }
233 if memProfile != "" {
234 log.Info("setup mem profile: %s", memProfile)
235 var err error
236 memFile, err = os.Create(memProfile)
237 if err != nil {
238 log.Fatal("could not create memory profile: %s", err)
239 }
240 }
241 if cpuProfile != "" {
242 log.Info("setup cpu profile: %s", cpuProfile)
243 if f, err := os.Create(cpuProfile); err != nil {
244 log.Fatal("%s", err)
245 } else if err := pprof.StartCPUProfile(f); err != nil {
246 log.Fatal("%s", err)
247 }
248 }
249}
250
251func setupSignals() {
252 sigChan = make(chan os.Signal, 1)

Callers 1

mainFunction · 0.85

Calls 1

StartMethod · 0.65

Tested by

no test coverage detected