MCPcopy Create free account
hub / github.com/ddev/ddev / TimeTrack

Function TimeTrack

pkg/util/debug.go:31–46  ·  view source on GitHub ↗

TimeTrack determines the amount of time a function takes to return. Timer starts when it is called. The printed name is determined from the calling function. It returns an anonymous function that, when called, will print the elapsed run time. It only tracks if DDEV_VERBOSE is set. Usage: defer u

()

Source from the content-addressed store, hash-verified

29// ...
30// tracker()
31func TimeTrack() func() {
32 if globalconfig.DdevVerbose {
33 // Determine name from calling function.
34 var name string
35
36 if counter, _, _, success := runtime.Caller(1); !success {
37 name = "<failed to determine caller name>"
38 } else {
39 name = runtime.FuncForPC(counter).Name() + "()"
40 }
41
42 return timeTrack(&name)
43 }
44
45 return func() {}
46}
47
48// TimeTrackC determines the amount of time a function takes to return. Timer
49// starts when it is called. The customName parameter is printed. It returns an

Callers 6

ListFunction · 0.92
CheckDockerVersionFunction · 0.92
CheckDockerComposeFunction · 0.92
CheckDockerBuildxVersionFunction · 0.92
ComposeWithStreamsFunction · 0.92
mainFunction · 0.92

Calls 1

timeTrackFunction · 0.85

Tested by

no test coverage detected