Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in how long my machine spends compiling scala in an average workday. Is there some way to log the total runtime of the scalac command every time it is run, even if it is run by some other tool such as sbt?

I was thinking about just renaming /usr/bin/scalac to /usr/bin/scalac_raw and writing a new /usr/bin/scalac that's just a bash script that runs scalac_raw (passing through all command-line parameters) and then logs its run time somewhere.

Is that a reasonable approach? If so, how might I write such a script? If not, any other ideas?

share|improve this question
You could also use some auditing software to accomplish that. See How can I log all process launches in Linux. – Petr Pudlák Feb 8 '13 at 13:10

If all you need are time-stamps basically then you can use the following model:

scalac script:


date >> ~/scalac.log
scalac-raw $@
date >> ~/scalac.log
share|improve this answer

Use the time program. e.g.: time command

If this program didn't exist, however, wrapping the command in a shell script is always helpful. But no, in this particular context, it's not a reasonable approach.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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