Skip to content

Commit

Permalink
Add USDT for task finish
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsamaroo committed Jan 25, 2022
1 parent bb28ba0 commit 1f98662
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions contrib/bpftrace/rt_all.bt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ usdt:usr/lib/libjulia-internal.so:julia:rt__new__task
printf("Task created: %x (Parent %x)\n", arg1, arg0);
}

usdt:usr/lib/libjulia-internal.so:julia:rt__finish__task
{
printf("Task finished: %x\n", arg0);
}

usdt:usr/lib/libjulia-internal.so:julia:rt__start__process__events
{
printf("Task processing libuv events: %x\n", arg0);
Expand Down
5 changes: 3 additions & 2 deletions doc/src/devdocs/probes.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ the probe handler.
1. `julia:rt__run__task(task)`: Switching to task `task` on current thread.
2. `julia:rt__pause__task(task)`: Switching from task `task` on current thread.
3. `julia:rt__new__task(parent, child)`: Task `parent` created task `child` on current thread.
4. `julia:rt__start__process__events(task)`: Task `task` started processing libuv events.
5. `julia:rt__finish__process__events(task)`: Task `task` finished processing libuv events.
4. `julia:rt__finish__task(task)`: Task `task` finished and will no longer execute.
5. `julia:rt__start__process__events(task)`: Task `task` started processing libuv events.
6. `julia:rt__finish__process__events(task)`: Task `task` finished processing libuv events.

### Thread sleep/wake probes

Expand Down
2 changes: 2 additions & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,7 @@ uint16_t __gnu_f2h_ieee(float param) JL_NOTSAFEPOINT;
#define JL_PROBE_RT_RUN_TASK(task) do ; while (0)
#define JL_PROBE_RT_PAUSE_TASK(task) do ; while (0)
#define JL_PROBE_RT_NEW_TASK(parent, child) do ; while (0)
#define JL_PROBE_RT_FINISH_TASK(task) 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_RT_SLEEP_CHECK_WAKE(other, old_state) do ; while (0)
Expand All @@ -1553,6 +1554,7 @@ uint16_t __gnu_f2h_ieee(float param) JL_NOTSAFEPOINT;
#define JL_PROBE_GC_END_ENABLED() (0)
#define JL_PROBE_GC_FINALIZER_ENABLED() (0)
#define JL_PROBE_RT_RUN_TASK_ENABLED() (0)
#define JL_PROBE_RT_FINISH_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)
Expand Down
1 change: 1 addition & 0 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ static void ctx_switch(jl_task_t *lastt)
// early free of stkbuf back to the pool
jl_release_task_stack(ptls, lastt);
}
JL_PROBE_RT_FINISH_TASK(lastt);
}
else {
#ifdef COPY_STACKS
Expand Down
1 change: 1 addition & 0 deletions src/uprobes.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ provider julia {
probe rt__run__task(jl_task_t *task);
probe rt__pause__task(jl_task_t *task);
probe rt__new__task(jl_task_t *parent, jl_task_t *child);
probe rt__finish__task(jl_task_t *task);
probe rt__start__process__events(jl_task_t *task);
probe rt__finish__process__events(jl_task_t *task);
probe rt__sleep__check__wake(jl_ptls_t other, int8_t old_state);
Expand Down

0 comments on commit 1f98662

Please sign in to comment.