Skip to content
Merged
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
3 changes: 2 additions & 1 deletion Python/perf_jit_trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sys/types.h>
#include <unistd.h> // sysconf()
#include <sys/time.h> // gettimeofday()
#include <sys/syscall.h>

// ----------------------------------
// Perf jitdump API
Expand Down Expand Up @@ -575,7 +576,7 @@ static void perf_map_jit_write_entry(void *state, const void *code_addr,
ev.base.size = sizeof(ev) + (name_length+1) + size;
ev.base.time_stamp = get_current_monotonic_ticks();
ev.process_id = getpid();
ev.thread_id = gettid();
ev.thread_id = syscall(SYS_gettid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would make sense to leverage the existing thread API, e.g. PyThread_get_thread_native_id()?

Copy link
Member Author

@pablogsal pablogsal May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that first but that has a check first for !initialized that calls PyThread_init_thread and that was causing problems when fork happens.

ev.vma = base;
ev.code_address = base;
ev.code_size = size;
Expand Down