-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I'm running Ubuntu 20.04.1 LTS with R 3.6.3 installed. I tried to profile the C code in coxph
function of survival
using the following commands (I used coxed
solely to increase the running time of coxph
):
library(survival)
library(jointprof)
library(coxed)
simdata = sim.survdata(N = 10000)
joint_pprof(coxph(Surv(y, failed) ~ X1+X2+X3, data=simdata$data))
The following the graph I got as a result. Before profiling, I recompiled the whole survival package with install.packages("survival", type="source", INSTALL_opts="--with-keep.source")
and CFLAGS
set to -g -O0 -mtune=native
. It's clear that the C code profiling results are missing.
After looking into some intermediate results (the separate pprofile and rprofile files), it is clear that the C code was indeed profiled and the results were stored. However, in the rprofile file:
...
#File 3: /tmp/Rtmp5g7EGI/R.INSTALL235a67daae2bd/survival/R/coxph.fit.R
"aperm.default" "aperm" "apply" 3#55 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
"%in%" 3#55 "FUN" "apply" 3#55 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
"%in%" 3#55 "FUN" "apply" 3#55 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
"%in%" 3#55 "FUN" "apply" 3#55 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
3#59 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
3#59 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
3#59 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
3#59 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
3#59 "coxph.fit" 2#555 "coxph" "comingle_rprof" "comingle_pprof" "joint_pprof"
...
In line 59 of coxph.fit.R
:
coxfit <- .Call(Ccoxfit6, ...
.Call
is called but the function name is not registered in the rprofile result. This is perhaps the reason why the C code profiling results did not show up in the graph, because jointprof
need to know where .Call
is called inside R to locate the position where the two separate profiling results should be combined.
As I am not very familiar with profiling in general, I could not go any further on this issue.