Skip to content

Commit 82dc2d6

Browse files
IanButterworthKristofferC
authored and
KristofferC
committed
Profile: Fix stdlib paths (#55327)
(cherry picked from commit b759fe2)
1 parent 2eef480 commit 82dc2d6

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/signals-mach.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -681,16 +681,16 @@ void *mach_profile_listener(void *arg)
681681
#endif
682682
jl_ptls_t ptls = jl_atomic_load_relaxed(&jl_all_tls_states)[i];
683683

684-
// store threadid but add 1 as 0 is preserved to indicate end of block
684+
// META_OFFSET_THREADID store threadid but add 1 as 0 is preserved to indicate end of block
685685
bt_data_prof[bt_size_cur++].uintptr = ptls->tid + 1;
686686

687-
// store task id (never null)
687+
// META_OFFSET_TASKID store task id (never null)
688688
bt_data_prof[bt_size_cur++].jlvalue = (jl_value_t*)jl_atomic_load_relaxed(&ptls->current_task);
689689

690-
// store cpu cycle clock
690+
// META_OFFSET_CPUCYCLECLOCK store cpu cycle clock
691691
bt_data_prof[bt_size_cur++].uintptr = cycleclock();
692692

693-
// store whether thread is sleeping but add 1 as 0 is preserved to indicate end of block
693+
// META_OFFSET_SLEEPSTATE store whether thread is sleeping but add 1 as 0 is preserved to indicate end of block
694694
bt_data_prof[bt_size_cur++].uintptr = jl_atomic_load_relaxed(&ptls->sleep_check_state) + 1;
695695

696696
// Mark the end of this block with two 0's

src/signals-unix.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -899,16 +899,16 @@ static void *signal_listener(void *arg)
899899

900900
jl_ptls_t ptls2 = jl_atomic_load_relaxed(&jl_all_tls_states)[i];
901901

902-
// store threadid but add 1 as 0 is preserved to indicate end of block
902+
// META_OFFSET_THREADID store threadid but add 1 as 0 is preserved to indicate end of block
903903
bt_data_prof[bt_size_cur++].uintptr = ptls2->tid + 1;
904904

905-
// store task id (never null)
905+
// META_OFFSET_TASKID store task id (never null)
906906
bt_data_prof[bt_size_cur++].jlvalue = (jl_value_t*)jl_atomic_load_relaxed(&ptls2->current_task);
907907

908-
// store cpu cycle clock
908+
// META_OFFSET_CPUCYCLECLOCK store cpu cycle clock
909909
bt_data_prof[bt_size_cur++].uintptr = cycleclock();
910910

911-
// store whether thread is sleeping but add 1 as 0 is preserved to indicate end of block
911+
// META_OFFSET_SLEEPSTATE store whether thread is sleeping but add 1 as 0 is preserved to indicate end of block
912912
bt_data_prof[bt_size_cur++].uintptr = jl_atomic_load_relaxed(&ptls2->sleep_check_state) + 1;
913913

914914
// Mark the end of this block with two 0's

src/signals-win.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,16 @@ static DWORD WINAPI profile_bt( LPVOID lparam )
420420

421421
jl_ptls_t ptls = jl_atomic_load_relaxed(&jl_all_tls_states)[0]; // given only profiling hMainThread
422422

423-
// store threadid but add 1 as 0 is preserved to indicate end of block
423+
// META_OFFSET_THREADID store threadid but add 1 as 0 is preserved to indicate end of block
424424
bt_data_prof[bt_size_cur++].uintptr = ptls->tid + 1;
425425

426-
// store task id (never null)
426+
// META_OFFSET_TASKID store task id (never null)
427427
bt_data_prof[bt_size_cur++].jlvalue = (jl_value_t*)jl_atomic_load_relaxed(&ptls->current_task);
428428

429-
// store cpu cycle clock
429+
// META_OFFSET_CPUCYCLECLOCK store cpu cycle clock
430430
bt_data_prof[bt_size_cur++].uintptr = cycleclock();
431431

432-
// store whether thread is sleeping but add 1 as 0 is preserved to indicate end of block
432+
// META_OFFSET_SLEEPSTATE store whether thread is sleeping but add 1 as 0 is preserved to indicate end of block
433433
bt_data_prof[bt_size_cur++].uintptr = jl_atomic_load_relaxed(&ptls->sleep_check_state) + 1;
434434

435435
// Mark the end of this block with two 0's

stdlib/Profile/src/Profile.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ end
492492
# based on the package ecosystem
493493
function short_path(spath::Symbol, filenamecache::Dict{Symbol, String})
494494
return get!(filenamecache, spath) do
495-
path = string(spath)
495+
path = Base.fixup_stdlib_path(string(spath))
496496
if isabspath(path)
497497
if ispath(path)
498498
# try to replace the file-system prefix with a short "@Module" one,
@@ -668,7 +668,7 @@ function add_fake_meta(data; threadid = 1, taskid = 0xf0f0f0f0)
668668
for i = 1:length(data)
669669
val = data[i]
670670
if iszero(val)
671-
# (threadid, taskid, cpu_cycle_clock, thread_sleeping)
671+
# META_OFFSET_THREADID, META_OFFSET_TASKID, META_OFFSET_CPUCYCLECLOCK, META_OFFSET_SLEEPSTATE
672672
push!(data_with_meta, threadid, taskid, cpu_clock_cycle+=1, false+1, 0, 0)
673673
else
674674
push!(data_with_meta, val)

0 commit comments

Comments
 (0)