Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tcmalloc/allocation_sampling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <utility>

#include "absl/base/attributes.h"
#include "absl/base/internal/sysinfo.h"
#include "absl/base/nullability.h"
#include "absl/base/optimization.h"
#include "absl/debugging/stacktrace.h"
Expand Down Expand Up @@ -238,6 +239,10 @@ SampleifyAllocation(Static& state, DynamicPolicy policy, size_t requested_size,
};
MallocHook::InvokeSampledNewHook(sampled_alloc);

stack_trace.cpu_id = subtle::percpu::GetRealCpu();
stack_trace.vcpu_id = subtle::percpu::VirtualCpu::get();
stack_trace.thread_id = absl::base_internal::GetTID();

state.allocation_samples.ReportMalloc(stack_trace);

state.deallocation_samples.ReportMalloc(stack_trace);
Expand Down
12 changes: 7 additions & 5 deletions tcmalloc/deallocation_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,11 @@ class DeallocationProfiler {

allocation.stack_trace = stack_trace;
// TODO(mmaas): Do we need to worry about b/65384231 anymore?
allocation.cpu_id = tcmalloc_internal::subtle::percpu::GetRealCpu();
allocation.vcpu_id = tcmalloc_internal::subtle::percpu::VirtualCpu::get();
allocation.cpu_id = stack_trace.cpu_id;
allocation.vcpu_id = stack_trace.vcpu_id;
allocation.l3_id = GetL3Id(allocation.cpu_id);
allocation.numa_id = GetNumaId(allocation.cpu_id);
allocation.thread_id = absl::base_internal::GetTID();
allocation.thread_id = stack_trace.thread_id;
}

void ReportFree(tcmalloc_internal::AllocHandle handle,
Expand Down Expand Up @@ -569,7 +569,8 @@ class DeallocationProfiler {
}
};

void DeallocationProfilerList::Add(DeallocationProfiler* profiler) {
void DeallocationProfilerList::Add(
DeallocationProfiler* absl_nonnull profiler) {
AllocationGuardSpinLockHolder h(profilers_lock_);
profiler->next_ = first_.load(std::memory_order_relaxed);
first_.store(profiler, std::memory_order_release);
Expand All @@ -583,7 +584,8 @@ void DeallocationProfilerList::Add(DeallocationProfiler* profiler) {
}

// This list is very short and we're nowhere near a hot path, just walk
void DeallocationProfilerList::Remove(DeallocationProfiler* profiler) {
void DeallocationProfilerList::Remove(
DeallocationProfiler* absl_nonnull profiler) {
AllocationGuardSpinLockHolder h(profilers_lock_);
DeallocationProfiler* cur = first_.load(std::memory_order_relaxed);
if (cur == profiler) {
Expand Down
8 changes: 4 additions & 4 deletions tcmalloc/experimental_pow2_size_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static constexpr SizeClassInfo List[] = {
{ 128, 8192, 32}, // 5 64 0.78% 0.42% --------- 100.00% -----------
{ 256, 8192, 32}, // 6 32 0.78% 0.41% --------- 100.00% -----------
{ 512, 8192, 32}, // 7 16 0.78% 0.40% --------- 100.00% -----------
{ 1024, 8192, 32}, // 8 8 0.78% 0.37% --------- 100.00% -----------
{ 1024, 8192, 32}, // 8 8 0.78% 0.38% --------- 100.00% -----------
{ 2048, 8192, 32}, // 9 4 0.78% 0.33% --------- 100.00% -----------
{ 4096, 8192, 16}, // 10 2 0.78% 0.23% --------- 100.00% -----------
{ 8192, 8192, 8}, // 11 1 0.78% 0.03% --------- 100.00% -----------
Expand All @@ -94,7 +94,7 @@ static constexpr SizeClassInfo List[] = {
// bytes span_bytes batch class objs | fixed sampling int.frag | inc used
{ 0, 0, 0}, // 0 0 0.00% 0.00% --------- 0.00% -----------
{ 8, 32768, 32}, // 1 4096 0.20% 1.60% --------- 0.00% -----------
{ 16, 32768, 32}, // 2 2048 0.20% 1.59% --------- 100.00% -----------
{ 16, 32768, 32}, // 2 2048 0.20% 1.60% --------- 100.00% -----------
{ 32, 32768, 32}, // 3 1024 0.20% 1.59% --------- 100.00% -----------
{ 64, 32768, 32}, // 4 512 0.20% 1.59% --------- 100.00% -----------
{ 128, 32768, 32}, // 5 256 0.20% 1.59% --------- 100.00% -----------
Expand Down Expand Up @@ -189,7 +189,7 @@ static constexpr SizeClassInfo List[] = {
{ 128, 8192, 32}, // 5 64 0.78% 0.42% --------- 100.00% -----------
{ 256, 8192, 32}, // 6 32 0.78% 0.41% --------- 100.00% -----------
{ 512, 8192, 32}, // 7 16 0.78% 0.40% --------- 100.00% -----------
{ 1024, 8192, 32}, // 8 8 0.78% 0.37% --------- 100.00% -----------
{ 1024, 8192, 32}, // 8 8 0.78% 0.38% --------- 100.00% -----------
{ 2048, 8192, 32}, // 9 4 0.78% 0.33% --------- 100.00% -----------
{ 4096, 8192, 16}, // 10 2 0.78% 0.23% --------- 100.00% -----------
{ 8192, 8192, 8}, // 11 1 0.78% 0.03% --------- 100.00% -----------
Expand All @@ -213,7 +213,7 @@ static constexpr SizeClassInfo List[] = {
// bytes span_bytes batch class objs | fixed sampling int.frag | inc used
{ 0, 0, 0}, // 0 0 0.00% 0.00% --------- 0.00% -----------
{ 8, 32768, 32}, // 1 4096 0.20% 1.60% --------- 0.00% -----------
{ 16, 32768, 32}, // 2 2048 0.20% 1.59% --------- 100.00% -----------
{ 16, 32768, 32}, // 2 2048 0.20% 1.60% --------- 100.00% -----------
{ 32, 32768, 32}, // 3 1024 0.20% 1.59% --------- 100.00% -----------
{ 64, 32768, 32}, // 4 512 0.20% 1.59% --------- 100.00% -----------
{ 128, 32768, 32}, // 5 256 0.20% 1.59% --------- 100.00% -----------
Expand Down
Loading
Loading