top | R Documentation |
This function runs the unix 'top' command and returns the overall CPU and RAM usage, and optionally the table of processes and resource use for each. Works only with unix-based systems such as Mac OS X and Linux, where 'top' is installed. Default is to return CPU and RAM overall stats, to get detailed stats instead, set Table=TRUE.
top( CPU = !Table, RAM = !Table, Table = FALSE, procs = 20, mem.key = NULL, cpu.key = NULL )
CPU |
logical, whether to return overall CPU usage information |
RAM |
logical, whether to return overall RAM usage information |
Table |
logical, whether to return system information for separate processes. This is returned as table with all of the same columns as a command line 'top' command. If 'Table=TRUE' is set, then the default becomes not to return the overall CPU/RAM usage stats. The dataframe returned will have been sorted by descending memory usage. |
procs |
integer, if Table=TRUE, then the maximum number of processes to return (default 20) |
mem.key |
character, default for Linux is 'mem' and for Mac OS X, 'physmem', but if the 'top' command on your system displays memory usage using a different label, then enter it here (case insensitive) to override defaults. |
cpu.key |
character, default for Linux and Mac OS X is 'cpu', but if the top command on your system displays CPU usage using a different label, then enter it here. |
a list containing CPU and RAM usage, or with alternate parameters can return stats for each process
Nicholas Cooper
# not run # top() # not run # top(Table=TRUE,proc=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.