0

I am trying to time how long it takes to open some browsers.

Not working.

 time seamonkey
 ReminderFox  clh(1)  {rmFx_cmdLine: [xpconnect wrapped nsICommandLine]}

Does time only work with simple commands?

3
  • 2
    The problem is to determine when the browser "finished opening". time measures the time from starting an application until it returns/terminates, which in the case of GUI applications is usually when you close them.
    – danzel
    Jul 12, 2018 at 23:15
  • 2
    @Terrance are you sure? How does time know when the application is "ready to use"? sys is the CPU time used in kernel space AFAIK, so the whole GUI stuff and possible waiting times are not reflected in the sys time.
    – danzel
    Jul 12, 2018 at 23:53
  • 1
    @Terrance sys time will likely include time spent in various I/O (disk, network, etc.), so if the bulk of the time taken while starting was in simply reading the application, related libraries, and profile data to memory, that maybe why you see the values you see. If, later on, the browser performs substantial I/O (which it will over normal usage), the values will begin to disagree.
    – muru
    Jul 13, 2018 at 0:10

1 Answer 1

4

This is not really an answer, but maybe an acceptable workaround, depending on what you actually want to measure. The following method will measure how long it takes to open a browser and display an html page in milliseconds:

Create an html file with the following content:

<html>
  <head>
   <script type="text/javascript">
    var readyMillis = new Date().getTime();
    var startMillis = new URL(window.location.href).searchParams.get("startTime");
    document.write("Started at: " + startMillis + "<br>Ready at: " + readyMillis + "<br>Time elapsed: " + (readyMillis - startMillis) + "ms");
   </script>
  </head>
</html>

...and run (replacing the path to your file):

firefox "file:///path/to/file.html?startTime=$(date +%s%N | cut -b1-13)"

I don't have seamonkey installed, but I tested it with firefox and chromium and it should work with any browser that accepts a URL as parameter. It will also show you how long it takes if an instance is already running.

You must log in to answer this question.

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