0

I'd like to see how long it takes a certain app to fully start.

Is there a way to do this launching the app via terminal using some command?

2

There's no standard definition for “fully start”. If you come up with a definition, there may or may not be a way to detect it.

If your definition of “fully start” is “wait until the application becomes idle, waiting for user input”, then you can trace its system calls and look how long it takes to start reading user input.

strace -o myapp.strace -tt myapp

When the application has finished starting, look at the trace file in myapp.strace and locate the line at which the application issued a wait for user input. For example, in the example below, the select call I show is the point at which the application waited for user input to do anything else; the next line corresponds to something happening to the application.

01:07:53.975957 execve("/usr/bin/xterm", ["xterm"], [/* 83 vars */]) = 0
…
01:07:54.319288 select(5, [3 4], [], NULL, NULL) = 1 (in [3])
01:07:57.129481 recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\10\4\344\1\343q\257

Some applications don't go idle, but keep polling forever. Then you have to use your own judgement to decide when the application has “fully started”.

Some applications may start responding to user input while they're still loading some files or otherwise performing some predefined startup actions. There's no formal definition of “fully started”, so you get to pick what counts as “fully started”.

If you count “fully started” as “shows a GUI window”, you can use xtoolwait, which launches an application and waits until a window is displayed, then exits. Note that it can return a false positive if some other application happens to display a new window at the same time, since windows are not associated with applications in a fully reliable way.

time xtoolwait xterm
0

What do you mean by "app"? A GUI app? And which app? And what do you mean by "start up"?

All programs pretty much start instantly — the delay is in the receiving the output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.