Skip to content

Commit 6536a24

Browse files
committed
Address review comment
And small tweaks to conform to standard API.
1 parent c936301 commit 6536a24

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

base/timing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171
# Retrieve the specified thread's, or the aggregated value across all threads
7272
# of wait time on all the locks for which wait-time measurement has been
7373
# enabled (for RAI, currently only the codegen lock).
74-
lock_waiting_time_ns(tid::Int16) = ccall(:jl_get_thread_lock_waiting_time, UInt64, (Int16,), tid)
74+
lock_waiting_time_ns(tid::Integer) = ccall(:jl_get_thread_lock_waiting_time, UInt64, (Cint,), tid-1)
7575
lock_waiting_time_ns() = ccall(:jl_get_lock_waiting_time, UInt64, ())
7676

7777
# cumulative total time spent on compilation and recompilation, in nanoseconds

src/threading.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,9 @@ void _jl_mutex_unlock(jl_task_t *self, jl_mutex_t *lock)
932932
}
933933
}
934934

935-
JL_DLLEXPORT uint64_t jl_get_thread_lock_waiting_time(int64_t tid)
935+
JL_DLLEXPORT uint64_t jl_get_thread_lock_waiting_time(int16_t tid)
936936
{
937-
int nthreads = jl_atomic_load_acquire(&jl_n_threads);
937+
int nthreads = jl_atomic_load_relaxed(&jl_n_threads);
938938
jl_ptls_t *all_tls_states = jl_atomic_load_relaxed(&jl_all_tls_states);
939939
if (tid < nthreads) {
940940
jl_ptls_t ptls = all_tls_states[tid];
@@ -948,8 +948,8 @@ JL_DLLEXPORT uint64_t jl_get_thread_lock_waiting_time(int64_t tid)
948948
JL_DLLEXPORT uint64_t jl_get_lock_waiting_time(void)
949949
{
950950
uint64_t waiting_time = 0;
951-
int nthreads = jl_atomic_load_acquire(&jl_n_threads);
952-
int ngcthreads = jl_atomic_load_acquire(&jl_n_gcthreads);
951+
int nthreads = jl_atomic_load_relaxed(&jl_n_threads);
952+
int ngcthreads = jl_atomic_load_relaxed(&jl_n_gcthreads);
953953
int nmutatorthreads = nthreads - ngcthreads;
954954
jl_ptls_t *all_tls_states = jl_atomic_load_relaxed(&jl_all_tls_states);
955955
for (int i = 0; i < nmutatorthreads; i++) {

0 commit comments

Comments
 (0)