MCPcopy
hub / github.com/cayleygraph/cayley / mustSetupProfile

Function mustSetupProfile

cmd/cayley/command/database.go:273–289  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

271}
272
273func mustSetupProfile(cmd *cobra.Command) profileData {
274 p := profileData{}
275 mpp := cmd.Flag("memprofile")
276 p.memPath = mpp.Value.String()
277 cpp := cmd.Flag("cpuprofile")
278 v := cpp.Value.String()
279 if v != "" {
280 f, err := os.Create(v)
281 if err != nil {
282 fmt.Fprintf(os.Stderr, "Could not open CPU profile file %s\n", v)
283 os.Exit(1)
284 }
285 p.cpuProfile = f
286 pprof.StartCPUProfile(f)
287 }
288 return p
289}
290
291func mustFinishProfile(p profileData) {
292 if p.cpuProfile != nil {

Callers 4

NewHttpCmdFunction · 0.85
NewLoadDatabaseCmdFunction · 0.85
NewReplCmdFunction · 0.85
NewQueryCmdFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected