0

I need to measure the time that Firefox takes to build itself from the source code. Here's what I do normaly:

nohup ./mach build > my_log.log &

I then prepended time to it:

time nohup ./mach build > my_log.log &

However, this hasn't made it generate any report about the time spent, at the end of the my_log file.

Why not? How to fix it?

3
  • I think you may need a 2&1 redirect
    – djdomi
    May 27 at 16:22
  • 2
    Have you try nohup time ./mach build >my_log.log 2>&1 & May 27 at 16:28
  • 1
    this might be smarter: nohup time -o build.out ./mach build >my_log.log 2>&1 & the output from time is in build.out/, ( or even add --verbose after the -o build.out )
    – Luuk
    May 27 at 16:40

1 Answer 1

1

In your second attempt you measure the execution time of nohup command itself. So to get the build time you should put time after nohup:

nohup time ./mach build >my_log.log  2>&1 &

Also redirect the STDERR is good practice.

And as mentioned in comment you can have dedicated log for time command:

nohup time -o build.time ./mach build >my_log.log  2>&1 &

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