Skip to content

Commit ccd22d5

Browse files
IanButterworthlazarusA
authored andcommitted
Profile: Fix stdlib paths (JuliaLang#55327)
1 parent 2da60b4 commit ccd22d5

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
@@ -738,16 +738,16 @@ void *mach_profile_listener(void *arg)
738738
#endif
739739
jl_ptls_t ptls = jl_atomic_load_relaxed(&jl_all_tls_states)[i];
740740

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

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

747-
// store cpu cycle clock
747+
// META_OFFSET_CPUCYCLECLOCK store cpu cycle clock
748748
bt_data_prof[bt_size_cur++].uintptr = cycleclock();
749749

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

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

src/signals-unix.c

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

966966
jl_ptls_t ptls2 = jl_atomic_load_relaxed(&jl_all_tls_states)[i];
967967

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

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

974-
// store cpu cycle clock
974+
// META_OFFSET_CPUCYCLECLOCK store cpu cycle clock
975975
bt_data_prof[bt_size_cur++].uintptr = cycleclock();
976976

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

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

src/signals-win.c

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

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

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

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

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

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

436436
// 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
@@ -505,7 +505,7 @@ end
505505
# based on the package ecosystem
506506
function short_path(spath::Symbol, filenamecache::Dict{Symbol, String})
507507
return get!(filenamecache, spath) do
508-
path = string(spath)
508+
path = Base.fixup_stdlib_path(string(spath))
509509
if isabspath(path)
510510
if ispath(path)
511511
# try to replace the file-system prefix with a short "@Module" one,
@@ -681,7 +681,7 @@ function add_fake_meta(data; threadid = 1, taskid = 0xf0f0f0f0)
681681
for i = 1:length(data)
682682
val = data[i]
683683
if iszero(val)
684-
# (threadid, taskid, cpu_cycle_clock, thread_sleeping)
684+
# META_OFFSET_THREADID, META_OFFSET_TASKID, META_OFFSET_CPUCYCLECLOCK, META_OFFSET_SLEEPSTATE
685685
push!(data_with_meta, threadid, taskid, cpu_clock_cycle+=1, false+1, 0, 0)
686686
else
687687
push!(data_with_meta, val)

0 commit comments

Comments
 (0)