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?


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

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.

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.