chore(startup): measure the part of a slow launch the log could not see

An operator reporting "nothing happens for two or three seconds after I click"
was impossible to answer from opslog.log, because the first line applog writes
already sits inside startup(). Everything spent loading the binary and creating
the WebView2 environment happened before the log begins.

In one of the reported logs, startup() to window-visible is 251 ms end to end -
so whatever the wait is, it is not OpsLog initialising. It just could not be
proven, only asserted.

processStart is stamped on the first instruction of main. Two lines now bracket
the launch: how long was spent before startup() ran at all, and click-to-window,
which is the only number that matches what the operator experiences.
This commit is contained in:
2026-08-10 20:30:08 +02:00
parent 4f87cedc2c
commit e0dfa53f54
2 changed files with 21 additions and 1 deletions
+11
View File
@@ -67,6 +67,17 @@ func acquireInstance(postUpdate bool) bool {
return false
}
// processStart is stamped on the very first instruction of main, before the
// single-instance guard and before anything else runs.
//
// It exists to split a slow launch in two, because the log alone could not: the
// first line applog writes already sits inside startup(), so everything spent
// loading the binary and creating the WebView2 environment happened before the
// log begins and was invisible. An operator reporting "nothing happens for three
// seconds" was impossible to answer from a file whose first timestamp is the
// moment the app was already running.
var processStart = time.Now()
func main() {
// Single-instance guard: if OpsLog is already running, focus that window and
// exit instead of spawning a duplicate. A second process would open its own