Skip to content

Commit bd25c76

Browse files
committed
Profile.Allocs: Add task and timestamp
1 parent e623275 commit bd25c76

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/gc-alloc-profiler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ struct jl_raw_alloc_t {
2020
jl_datatype_t *type_address;
2121
jl_raw_backtrace_t backtrace;
2222
size_t size;
23+
jl_task_t *task;
24+
uint64_t timestamp;
2325
};
2426

2527
// == These structs define the global singleton profile buffer that will be used by
@@ -133,7 +135,9 @@ void _maybe_record_alloc_to_profile(jl_value_t *val, size_t size) JL_NOTSAFEPOIN
133135
profile.allocs.emplace_back(jl_raw_alloc_t{
134136
type,
135137
get_raw_backtrace(),
136-
size
138+
size,
139+
jl_current_task,
140+
cycleclock()
137141
});
138142
}
139143

stdlib/Profile/src/Allocs.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ struct RawAlloc
1919
type::Ptr{Type}
2020
backtrace::RawBacktrace
2121
size::Csize_t
22+
task::Ptr{Cvoid}
23+
timestamp::UInt64
2224
end
2325

2426
# matches jl_profile_allocs_raw_results_t on the C side
@@ -147,6 +149,8 @@ struct Alloc
147149
type::Any
148150
stacktrace::StackTrace
149151
size::Int
152+
task::Ptr{Cvoid}
153+
timestamp::UInt64
150154
end
151155

152156
struct AllocResults
@@ -180,7 +184,9 @@ function decode_alloc(cache::BacktraceCache, raw_alloc::RawAlloc)::Alloc
180184
Alloc(
181185
load_type(raw_alloc.type),
182186
stacktrace_memoized(cache, load_backtrace(raw_alloc.backtrace)),
183-
UInt(raw_alloc.size)
187+
UInt(raw_alloc.size),
188+
raw_alloc.task,
189+
raw_alloc.timestamp
184190
)
185191
end
186192

0 commit comments

Comments
 (0)