# Monitoring a Program's Resource Consumption



## rob34 (Jul 19, 2012)

I am interested in determining how much memory and disk I/O a script consumes while it executes.  Is there some type of utility that would provide this information in a way similar to time?

For example, I can run time myscript and get

```
real    0m0.105s
user    0m0.071s
sys     0m0.037s
```

Does anything exist that could do something like this:
# monitor myscript

```
memory     22,596 bytes
disk_read  5,994 bytes
disk_write 4,220 bytes
```


----------



## fluca1978 (Jul 23, 2012)

I suspect you have to use os(1) or top(1) from another terminal to _inspect_ the behavior of such process, or use getrusage(2) in a wrapper or use dtrace.


----------

