1

I was going to install a script on my web hosting account, and they said they were concerned that it would take too much CPU to run.

I know you can monitor the instantaneous use of a process with top or ps, but is there a way to log how much total CPU demand (not sure the units here) a script takes from start to finish?

I would be interested in a -nix solution for linux or OSX command-line.

0

1 Answer 1

2

I would be interested in a -nix solution for linux or OSX command-line.

I have no OS X to test with, but as for the linux part: time

Example:

FreeBSD:/home/hennes/test>time ls
real  0m0.003s
user  0m0.000s
sys   0m0.002s

Ofcourse rather than ls you would use your script or program. Run it somewhere where you can log information (e.g. in screen or tmux, script it or redirect its output. Let it run long enough to collect data and then stop it (e.g. controlC, kill SIGHUP, ...)

Alternatively ControlT might yield information about the process, though that is also untested on OS X and on Linux.

1
  • Great! That does what I need and works in OSX too.
    – beroe
    May 7, 2015 at 0:06

You must log in to answer this question.

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