Skip to content

Commit 90ce1ab

Browse files
EtiennePerotgvisor-bot
authored andcommitted
Implement a timing library that can time a multi-goroutine procedure.
This library can record points in time and have its objects be passed around across goroutines, and then pretty-print all the data after the procedure is done. Example output: ``` ---- ContainerManager.RestoreSubcontainer timing information ---- [02:07:25.476281] ╭─ ContainerManager.RestoreSubcontainer [02:07:25.476281] +0µs ├─ containerManager locked: 0µs [02:07:25.476503] +221µs ▉▉▉▉▉▉▉▉▉▉▉▉ ├─ spec validated: 221µs [02:07:25.476521] +17µs ▉ ├─ gofer files done: 17µs [02:07:25.476521] +0µs │ ... 0µs ... ╭─ restorer.restoreSubcontainer [02:07:25.476524] +2µs ▏ │ ... 3µs ... ├─ restorer locked: 2µs [02:07:25.476551] +26µs ▉▌ │ ... 30µs ... ├─ subcontainer restore skipped: 26µs [02:07:25.476551] +0µs │ ... 30µs ... ╰─ END: 0µs [02:07:25.476560] +8µs ▌ ╰─ END: 38µs ---- End of ContainerManager.RestoreSubcontainer timing information ---- ``` PiperOrigin-RevId: 752019739
1 parent 60ec4e7 commit 90ce1ab

File tree

2 files changed

+865
-0
lines changed

2 files changed

+865
-0
lines changed

pkg/timing/BUILD

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
load("//tools:defs.bzl", "go_library")
2+
3+
package(
4+
default_applicable_licenses = ["//:license"],
5+
licenses = ["notice"],
6+
)
7+
8+
go_library(
9+
name = "timing",
10+
srcs = ["timing.go"],
11+
visibility = ["//:sandbox"],
12+
deps = [
13+
"//pkg/atomicbitops",
14+
"//pkg/log",
15+
],
16+
)

0 commit comments

Comments
 (0)