Permalink
Browse files

Merge branch 'master' of github.com:hadley/profr

# Conflicts:
#	DESCRIPTION
#	NEWS
  • Loading branch information...
2 parents 6df2ba4 + b48326c commit ccf216172397bd4d170f80d9a9cdb244228f30b9 @hadley committed Nov 13, 2015
Showing with 22 additions and 1 deletion.
  1. +2 −0 NEWS
  2. +16 −0 R/parse.r
  3. +4 −1 R/profile.r
View
2 NEWS
@@ -3,6 +3,8 @@ Version 0.3.2
* Fixes for outstanding R CMD check notes
+* `profr` now works when an interrupt is received in running the code.
+
Version 0.3.1
=============
View
16 R/parse.r
@@ -38,6 +38,22 @@ group_id <- function(x, y) {
.simplify <- function(calls) {
+ # Special handling for empty data
+ if (length(calls) == 0) {
+ return(data.frame(stringsAsFactors = FALSE,
+ level = numeric(0),
+ g_id = integer(0),
+ t_id = integer(0),
+ f = character(0),
+ start = numeric(0),
+ end = numeric(0),
+ n = integer(0),
+ leaf = logical(0),
+ time = numeric(0),
+ source = character(0)
+ ))
+ }
+
df <- ldply(seq_along(calls), function(i) {
call <- calls[[i]]
call_info(call, i - 1)
View
5 R/profile.r
@@ -46,7 +46,10 @@ profr <- function(expr, interval = 0.02, quiet = TRUE) {
}
Rprof(tmp, append=TRUE, interval = interval)
- try(force(expr))
+ tryCatch(force(expr),
+ error = function(e) NULL,
+ interrupt = function(e) NULL
+ )
Rprof(NULL)
n <- 6 + sys.nframe()

0 comments on commit ccf2161

Please sign in to comment.