Skip to content

Commit

Permalink
Add USDTs for process_events start/finish
Browse files Browse the repository at this point in the history
Co-authored-by: Takafumi Arakaki <[email protected]>
  • Loading branch information
jpsamaroo and tkf committed Dec 30, 2021
1 parent 39f9c01 commit d8c8fd2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions contrib/bpftrace/rt_all.bt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions src/jl_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
2 changes: 2 additions & 0 deletions src/uprobes.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d8c8fd2

Please sign in to comment.