Visualize a metric of a log over time for a single process ID in a single log file.

log_plot(log, pid = NULL, name = NULL, phase = NULL, metric = "resident", ...)

Arguments

log

Data frame returned by log_read(). Must be nonempty. log_plot() only includes rows with status code equal to 0.

pid

Either NULL or a non-negative integer with the process ID to plot. At least one of pid or name must be NULL.

name

Either NULL or a non-negative integer with the name of the process to plot. The name was previously specified in the names of the pid argument of log_start() or log_print(). At least one of pid or name must be NULL.

phase

Either NULL or a character string specifying the name of a log phase (see log_phase_set()). If not NULL, then log_print() will only visualize data from the given log phase.

metric

Character string with the name of a metric to plot against time. Must be only a single string. Defaults to the resident set size (RSS), the total amount of memory used by the process. See log_read() for descriptions of the metrics available.

...

Named optional parameters to pass to the base function plot().

Value

A base plot of a metric of a log over time.

Examples

  path <- tempfile()
  log_start(seconds = 0.25, path = path)
  Sys.sleep(1)
  log_stop()
  Sys.sleep(2)
  log <- log_read(path)
  log_plot(log, metric = "cpu")

  unlink(path)