1

I was wondering, if there is a program similar to time, but instead of just printing out the time it took to execute the command, it also prints out the average CPU and Memory usage. Alternatively a program which records the CPU and memory usage every couple of seconds and then writes it to a file would also work.

Any help is appreciated!

Thanks

1 Answer 1

3

Sysstat package is useful. You can customize how often and how many times to harvest the information. It consists tools for CPU usage , memory , processes. Also can store information in different formats

  1. iostat: Reports all statistics about your CPU and I/O statistics for I/O devices.
  2. mpstat: Details about CPUs (individual or combined).
  3. pidstat: Statistics about running processes/task, CPU, memory etc.
  4. sar: Save and report details about different resources (CPU, Memory, IO, Network, kernel etc..).
  5. sadc: System activity data collector, used for collecting data in backend for sar.
  6. sa1: Fetch and store binary data in sadc data file. This is used with sadc.
  7. sa2: Summaries daily report to be used with sar.
  8. Sadf: Used for displaying data generated by sar in different formats (CSV or XML).
  9. nfsiostat-sysstat: I/O statistics for NFS.
  10. cifsiostat: Statistics for CIFS.
3
  • Thanks alot! This looks like what I needed! Do you know if using this slows down the actual command?
    – nhaus
    Jun 14, 2020 at 14:30
  • As every process - will have an impact on the system but in normal case (if you are not on the edge of the resources) it won't affect the performance
    – Angel
    Jun 14, 2020 at 14:34
  • Please, mark as "Answered" if this answered your question
    – Angel
    Jun 14, 2020 at 15:42

You must log in to answer this question.

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