Returns the source lines where the most CPU time is spent. Requires source
references (use devtools::load_all() for best results).
Value
A data frame with columns:
location: File path and line number (e.g., "R/foo.R:42")label: Function name at this locationfilename: Source file pathlinenum: Line numbersamples: Number of profiling samplestime_ms: Time in millisecondspct: Percentage of total time
Examples
p <- pv_example()
pv_hot_lines(p)
#> location samples label filename
#> 1 example_code.R:13 10 rnorm example_code.R
#> 2 example_code.R:5 3 generate_data example_code.R
#> 3 example_code.R:21 1 result[i] <- sqrt(abs(x[i])) * 2 example_code.R
#> linenum time_ms pct
#> 1 13 50 71.4
#> 2 5 15 21.4
#> 3 21 5 7.1
# Only lines with >= 10% of time
pv_hot_lines(p, min_pct = 10)
#> location samples label filename linenum time_ms pct
#> 1 example_code.R:13 10 rnorm example_code.R 13 50 71.4
#> 2 example_code.R:5 3 generate_data example_code.R 5 15 21.4
