I would like to measure how much time it takes for some softwares to start.

I know the command time but in the case of firefox (iceweasel for me on Debian), this command prints only the time I let firefox open. If I launch:

$ time iceweasel www.google.com

I will have a startup time only after I closed firefox and this time will only indicate how long I left firefox opened. For example:

real    0m50.565s
user    0m4.276s
sys 0m0.248s

How can I know exactly how much firefox need to start?

  • 5
    Define "start". Is it when it opens its first window, when it will first respond to mouse clicks, when it finishes loading the web site, etc.
    – derobert
    Commented Feb 4, 2015 at 18:31
  • @derobert By "start" I mean to see the window. In fact, I don't really care, I just want a exact way of measuring the "startup" (whatever it is) to be able to do some tests (i.e. removing some addons and see if there is a improvement).
    – ppr
    Commented Feb 4, 2015 at 19:48
  • 1
    You could also try this extension: about:startup. Commented Feb 4, 2015 at 20:06

5 Answers 5


This is hacky and unscriptable.

Firefox can run javascript via command line like so:

firefox "javascript:alert(Date.now())"

That will open Firefox and run javascript that pops up a message box containing the current epoch time to the millisecond.

You can get the number of milliseconds elapsed in epoch time at your command line with

date +%s%N | cut -b1-13

So to answer your question, run

date +%s%N | cut -b1-13; iceweasel "javascript:alert(Date.now())"

Then subtract the number in your terminal from the number in Firefox. This gives you the number of milliseconds Firefox took to open and display some basic javascript.



You can use some tool which can get window id associated with PID, and wait until that window is created. The process id of previously started program is available in $! variable.

As an example - using wmctrl one can get list of all windows and check if any of them is started by given PID:

$ wmctrl -lp
0x00e00003 -1 397    jjmach sawfishpager
0x01200003  6 399    jjmach wmctrl -lp jimmij@jjmach: /proc
0x0180004b  0 655    jjmach [email protected]
0x02800078  7 680    jjmach How to measure Firefox's startup time? - Mozilla Firefox

Window id is in first column, and process id in third, so we need to pipe it to awk in order to check if given process id has associated window.

wmctrl -lp | awk -v pid="$!" '$3==pid{print "Window is created with id "$1}'

Now we need to put it in some loop and measure the time until above command will end successfully:

firefox & time (while wmctrl -lp | awk -v pid="$!" '$3==pid{exit 1}'; do :; done)

So we start firefox and immediately start a loop which in body does nothing (:) and ends when awk returns non-zero value.

  1. start a listening netcat in the background
  2. call firefox to connect it
  3. wait it with a wait bash builtin.
  4. finally kill everything nc -l 64738 & firefox & wait <...yet to be solved that only the nc should be waited for...> killall firefox <..yet to be solved to not kill your girlfriends browser>

AFAIK the startup time in milliseconds can be found here:

about:telemetry -> Simple Measurements -> firstPaint


You can read the measured startup time from the configuration (about:config):


You must log in to answer this question.

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