Skip to content
A recorder to record cpu and memory usage for specific processes for a period.
C
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
Makefile
README.md
cmrecorder.c
cmrecorder.h
main.c
pidof.c
pidof.h

README.md

CPU Memory Usage Recorder

This is a utility to calculate CPU and memory usage for specific processes during a period of time. It is useful when you need to record these parameters for performance analysis in experiments. Especially, when there are multiple processes you need to record simultaneously, you can just specify the command name or pids. Then, the overall statistics will be generated by adding all up. It uses /proc filesystem to fetch usage information periodically. For instance, I retrieve CPU time information in /proc/:pid/stat and memory usage in /proc/:pid/statm.

Usage

cmrecord [-t<time>] -i<interval> -c<command>|-p<pids> -o<output>:  
    -t = total recording time(s), default is -1 for forever recording  
    -i = recording interval(s)  
    -o = output file  
    -p = pids seperated by .  
    -c = tracing command  

Notice

The Memory Usage is only for resident set, which means I only calculate those resided in physical memory, not swapped out.

The CPU Usage is actually an average value between an interval. Since /proc/stat and /proc/:pid/stat only record cumulative CPU time, the result is for an estimated value at the intermediate time in the interval.

Author: Further Lee

License: GPL2

Something went wrong with that request. Please try again.