plot_directory: Plot metrics across versions for all files in a given...

View source: R/plot_metrics.R

plot_directoryR Documentation

Plot metrics across versions for all files in a given directory.

Description

Given a directory path, plot the memory and time usage statistics of all files in the directory against the commit message summaries of the specified number of commits in the current git repository.

Usage

plot_directory(test_directory, metric = "testMetrics", num_commits = 5,
  save_data = FALSE, save_plots = TRUE)

Arguments

test_directory

Directory containing the test-files which are to be used.

metric

Type of plot(s) desired. This can be set to time, memory, memtime or testMetrics. (See examples below for more details)

num_commits

Number of commits (versions) against which the files are to be tested, with default being 5.

save_data

If set to TRUE, the metrics data is saved in a folder 'Rperform_Data' in the current directory.

save_plots

If set to TRUE, the plots generated are stored in the 'Rperform_plots' directory in the root of the repo rather than being printed.

WARNING

Library assumes the current directory to be the root directory of the package being tested.

Examples


## Not run: 
# Set to the git repository in consideration.
setwd("path/to/repo")
d_path <- "path/to/tests"

# Load the library
library(Rperform)

## Example-1

# Pass the parameters and obtain the run-time followed by memory details against 10 commits.
plot_directory(test_directory = d_path, metric = "time", num_commits = 10,
               save_data = F, save_plots = T)
plot_directory(test_directory = d_path, metric = "memory", num_commits = 10,
               save_data = F, save_plots = T)

## Example-2

# Obtain both memory and time metrics for each individual testthat block
# inside a file and the file itself ,and save the resulting plot as well as
# data.
plot_directory(d_path, metric = "testMetrics", num_commits = 5, save_data = F,
               save_plots = T)

## End(Not run)


analyticalmonk/Rperform documentation built on July 3, 2022, 2:36 a.m.