| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/fuse.R |
| 3 |
\name{timing_data} |
| 4 |
\alias{timing_data} |
| 5 |
\title{Get the timing data of code chunks and text blocks in a document} |
| 6 |
\usage{ |
| 7 |
timing_data(threshold = 0, sort = TRUE, total = TRUE) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{threshold}{A number (time in seconds) to subset data with. Only rows |
| 11 |
with time above this threshold are returned.} |
| 12 |
|
| 13 |
\item{sort}{Whether to sort the data by time in the decreasing order.} |
| 14 |
|
| 15 |
\item{total}{Whether to append the total time to the data.} |
| 16 |
} |
| 17 |
\value{ |
| 18 |
A data frame containing input file paths, line numbers, chunk labels, |
| 19 |
and time. If no timing data is available, \code{NULL} is returned. |
| 20 |
} |
| 21 |
\description{ |
| 22 |
Timing can be enabled via the chunk option \code{time = TRUE} (e.g., set |
| 23 |
\link{reactor}\code{(time = TRUE)} in the first code chunk). After it is |
| 24 |
enabled, the execution time for code chunks and text blocks will be recorded. |
| 25 |
This function can be called to retrieve the timing data later in the document |
| 26 |
(e.g., in the last code chunk). |
| 27 |
} |
| 28 |
\note{ |
| 29 |
By default, the data will be cleared after each call of \code{\link[=fuse]{fuse()}} and |
| 30 |
will not be available outside \code{\link[=fuse]{fuse()}}. To store the data persistently, you |
| 31 |
can set the \code{time} option to a file path. This is necessary if you want to |
| 32 |
get the timing data for multiple input documents (such as all chapters of a |
| 33 |
book). Each document needs to point the \code{time} option to the same path. |
| 34 |
When you do not need timing any more, you will need to delete this file by |
| 35 |
yourself. |
| 36 |
} |