diff --git a/contrib/bpftrace/rt_all.bt b/contrib/bpftrace/rt_all.bt index 0bba03e45cee3..4979780489d15 100755 --- a/contrib/bpftrace/rt_all.bt +++ b/contrib/bpftrace/rt_all.bt @@ -19,3 +19,13 @@ usdt:usr/lib/libjulia-internal.so:julia:rt__new__task { printf("Task created: %x (Parent %x) (with PTLS %x)\n", arg1, arg0, arg2); } + +usdt:usr/lib/libjulia-internal.so:julia:rt__start__process__events +{ + printf("Task processing libuv events: %x\n", arg0); +} + +usdt:usr/lib/libjulia-internal.so:julia:rt__finish__process__events +{ + printf("Task processed libuv events: %x\n", arg0); +} diff --git a/src/jl_uv.c b/src/jl_uv.c index 2c9c129d7bbf6..1ef982d6905e6 100644 --- a/src/jl_uv.c +++ b/src/jl_uv.c @@ -205,8 +205,10 @@ JL_DLLEXPORT int jl_process_events(void) jl_gc_safepoint_(ct->ptls); if (loop && (jl_atomic_load_relaxed(&_threadedregion) || jl_atomic_load_relaxed(&ct->tid) == 0)) { if (jl_atomic_load(&jl_uv_n_waiters) == 0 && jl_mutex_trylock(&jl_uv_mutex)) { + JL_PROBE_RT_START_PROCESS_EVENTS(ct); loop->stop_flag = 0; int r = uv_run(loop, UV_RUN_NOWAIT); + JL_PROBE_RT_FINISH_PROCESS_EVENTS(ct); JL_UV_UNLOCK(); return r; } diff --git a/src/julia_internal.h b/src/julia_internal.h index 930848d4eda47..0996fda9a0bc4 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -1535,6 +1535,8 @@ uint16_t __gnu_f2h_ieee(float param) JL_NOTSAFEPOINT; #define JL_PROBE_RT_RUN_TASK(task, ptls) do ; while (0) #define JL_PROBE_RT_PAUSE_TASK(task, ptls) do ; while (0) #define JL_PROBE_RT_NEW_TASK(parent, child, ptls) do ; while (0) +#define JL_PROBE_RT_START_PROCESS_EVENTS(task) do ; while (0) +#define JL_PROBE_RT_FINISH_PROCESS_EVENTS(task) do ; while (0) #define JL_PROBE_GC_BEGIN_ENABLED() (0) #define JL_PROBE_GC_STOP_THE_WORLD_ENABLED() (0) @@ -1547,6 +1549,8 @@ uint16_t __gnu_f2h_ieee(float param) JL_NOTSAFEPOINT; #define JL_PROBE_RT_RUN_TASK_ENABLED() (0) #define JL_PROBE_RT_PAUSE_TASK_ENABLED() (0) #define JL_PROBE_RT_NEW_TASK_ENABLED() (0) +#define JL_PROBE_RT_START_PROCESS_EVENTS_ENABLED() (0) +#define JL_PROBE_RT_FINISH_PROCESS_EVENTS_ENABLED() (0) #endif #endif diff --git a/src/uprobes.d b/src/uprobes.d index d96ccbd99203c..493092cb80cd4 100644 --- a/src/uprobes.d +++ b/src/uprobes.d @@ -13,6 +13,8 @@ provider julia { probe rt__run__task(jl_task_t *task, jl_ptls_t ptls); probe rt__pause__task(jl_task_t *task, jl_ptls_t ptls); probe rt__new__task(jl_task_t *parent, jl_task_t *child, jl_ptls_t ptls); + probe rt__start__process__events(jl_task_t *task); + probe rt__finish__process__events(jl_task_t *task); }; #pragma D attributes Evolving/Evolving/Common provider julia provider