Skip to content

Commit

Permalink
revert changes to the sampler, to implement Gab s idea, it was wrong …
Browse files Browse the repository at this point in the history
…anyway as it was using native id instead of thread id;
  • Loading branch information
taegyunkim committed Oct 30, 2024
1 parent 3cdff6c commit 702e54f
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions ddtrace/internal/datadog/profiling/stack_v2/src/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "echion/threads.h"

#include <pthread.h>
#include <unordered_set>

using namespace Datadog;

Expand All @@ -22,20 +21,13 @@ Sampler::sampling_thread(const uint64_t seq_num)
auto wall_time_us = duration_cast<microseconds>(sample_time_now - sample_time_prev).count();
sample_time_prev = sample_time_now;

// Collect native thread_ids
std::unordered_set<uint64_t> seen_native_thread_ids;

// Perform the sample
for_each_interp([&](PyInterpreterState* interp) -> void {
for_each_thread(interp, [&](PyThreadState* tstate, ThreadInfo& thread) {
thread.sample(interp->id, tstate, wall_time_us);
seen_native_thread_ids.insert(static_cast<uint64_t>(thread.native_id));
});
});

// Clear thread spans link using seen native thread_ids
ThreadSpanLinks::get_instance().clear_unseen(seen_native_thread_ids);

// Before sleeping, check whether the user has called for this thread to die.
if (seq_num != thread_seq_num.load()) {
break;
Expand Down

0 comments on commit 702e54f

Please sign in to comment.