I'd like to measure the time it takes a program to open on my system. I've tryed using the time utility with Atom, but it prints the response in the terminal before Atom even opens. Atom opens on my screen 2 or 3 seconds later.

$ time atom

real    0m0.021s
user    0m0.021s
sys     0m0.003s

Any ideas how to measure the time it takes a GUI to open and be ready for user input?


Using the xdotool utility as described below, I got the following output.

$ atom && time while true; do xdotool search --limit 1 --name "Project — Atom" >/dev/null && break; done

real    0m0.021s
user    0m0.009s
sys     0m0.005s

1 Answer 1


There is a reason people often use a stopwatch for this type of stuff or modify the app to output some trigger when it's "done".

The problem is what is "open"? When the window appears? After the application initializes? After it goes idle? Something else?

You could use something like this to detect the window:

$ atom
$ time while true; do xdotool search --limit 1 --name atom >/dev/null && break; done

Replace "atom" in the --name field with the actual window title name (it is a regex). I don't know what title atom uses. Note this will potentially use a lot of CPU while scanning and this won't work in Wayland.

You could also additionally use screen capture using something like import from imagemagick looking for the final state (get the WID to use from the above xdotool) but egads... Might be OK if the startup time is really long.

  • I updated the question with the response of that while loop. I may not understand how to use that, but it's not working. It prints those time numbers before Atom opens. As for the "what is 'open'" question, I would say, when the window appears and is ready for user input.
    – Brad West
    Commented Mar 11, 2022 at 15:02
  • @BradWest It might be detecting the window before you see it or you already have a window with the word "atom" in it if you used my example verbatim. As far as I know there is no concrete way to determine what "ready for input" means except inside the application itself. Since it's running in node.js there may be a way to hook in to Electron but I don't have experience with that.
    – CR.
    Commented Mar 11, 2022 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .