Commit Graph

1162 Commits

Author SHA1 Message Date
Bartosz Taudul
d9fb5c71eb
Add debug info data structures. 2022-04-30 20:07:47 +02:00
Bartosz Taudul
8b477291f2
Initialize debuginfod session. 2022-04-30 19:19:00 +02:00
Bartosz Taudul
532c5a240c
Add no-op callstack cleanup procedure. 2022-04-30 19:18:52 +02:00
Bartosz Taudul
254e87cbac
Fix preprocessor syntax. 2022-04-30 19:00:54 +02:00
Bartosz Taudul
2ef014608f
Notify when software sampling setup has failed. 2022-04-29 19:13:40 +02:00
Blake Taylor
8c5120ee5a Add flag to disable crash handler 2022-04-27 07:11:53 -07:00
Bartosz Taudul
7493663e13
It's Debian, it's always Debian.
/usr/lib/gcc/x86_64-linux-gnu/9/include/cpuid.h:223:1: error: redefinition of ‘unsigned int __get_cpuid_max(unsigned int, unsigned int*)’
In file included from ../../client/TracyProfiler.cpp:108,
                 from ../../TracyClient.cpp:23:
/usr/lib/gcc/x86_64-linux-gnu/9/include/cpuid.h:223:1: note: ‘unsigned int __get_cpuid_max(unsigned int, unsigned int*)’ previously defined here
2022-04-26 22:19:32 +02:00
Bartosz Taudul
80d760d950
Define NEON data tables only if NEON is available. 2022-04-26 22:01:09 +02:00
Bartosz Taudul
95cf143336
Remove unused variables. 2022-04-26 22:01:09 +02:00
Bartosz Taudul
066c266df9
Add missing includes. 2022-04-26 22:01:09 +02:00
Blake Taylor
c176d1d603 -Set thread init false on thread exit for manual lifetime cases 2022-04-05 09:12:05 -07:00
Bartosz Taudul
3d28d1259b
Check if ring buffer was properly mapped. 2022-04-04 17:56:40 +02:00
Bartosz Taudul
e83e83dae9
Revert "Backport SPSCQueue commit 3086fa9."
This reverts commit 2a3a57d245.

Fucking MSVC 2015 has chosen to emit errors on unsupported attributes.
2022-04-01 16:46:50 +02:00
Benoit Jacob
5eb3e3a1f0 set s_numCpus before reading it 2022-03-24 18:31:38 +00:00
Bartosz Taudul
2a3a57d245
Backport SPSCQueue commit 3086fa9. 2022-03-18 02:09:00 +01:00
Bartosz Taudul
c2fcc699be
Apply SPSCQueue commit 62cdc1f3. 2022-03-18 02:05:55 +01:00
Bartosz Taudul
0b1e5d2c96
Define ___tracy_demangle on Android. 2022-03-11 15:40:56 +01:00
Bartosz Taudul
7d3c7049dc
Fix compilation on MSVC 2015. 2022-03-10 12:27:44 +01:00
Dave Rigby
2073ffb684 program_invocation_short_name is Linux-specific
'program_invocation_short_name' is Linux-specific; other OSs such as
macOS do not support it.

Fixes build break on macOS 12.2 with _GNU_SOURCE defined.
2022-02-28 16:09:06 +00:00
Bartosz Taudul
e2b0268d7a
Allow disabling callstack handling. 2022-02-22 21:26:55 +01:00
Bartosz Taudul
d318f75123
Merge pull request #325 from BrychDaneel/automatic_timer_fallback
Automatic timer fallback
2022-02-21 13:47:50 +01:00
Daniil Brychikov
a9ba1ce688 Codestyle fixes 2022-02-19 11:44:15 +03:00
Daniil Brychikov
73f6c66cde Automatic timer fallback 2022-02-16 15:18:45 +03:00
Bartosz Taudul
46d2977694
prev_state is long. 2022-02-14 22:34:20 +01:00
Bartosz Taudul
9f2ffb05ac
Check if memory can be allocated in a thread.
Consider running the following code with operator new and delete overloaded to
track allocations with call stacks:

std::thread( []({ thread_local std::string str; });

Each call stack requires a memory allocation to be performed by the profiler,
to make the stack available at a later time. When the thread is created, the
TLS block is initialized and the std::string buffer can be allocated. To track
this allocation, rpmalloc has to be initialized. This initialization also
happens within the TLS block.

Now, when the thread exits, the heap managed by rpmalloc may be released first
during the TLS block destruction (and if the destruction is performed in
reverse creation order, then it *will* be destroyed first, as rpmalloc was
initialized only after the std::string initialization, to track the allocation
performed within). The next thing to happen is destruction of std::string and
release of the memory block it contains.

The release is tracked by the profiler, and as mentioned earlier, to save the
call stack for later use, a memory allocation is needed. But the allocator is
no longer available in this thread, because rpmalloc was released just before!

As a solution to this issue, profiler will detect whether the allocator is
still available and will ignore the call stack, if it's not. The other
solution is to disable the rpmalloc thread cleanup, which may potentially
cause leak-like behavior, in case a large number of threads is spawned and
destroyed.

Note that this is not a water-tight solution. Other functions will still want
to allocate memory for call stacks, but it is rather unlikely that such calls
would be performed during TLS block destruction. It is also possible that the
event queue will run out of allocated space for events at this very moment,
and in such a case the allocator will also fail.
2022-02-14 17:55:46 +01:00
Bartosz Taudul
793e6b0e29
Add rpmalloc thread state accessor. 2022-02-14 17:53:27 +01:00
Bartosz Taudul
20680fa6a3
Keep track of rpmalloc thread shutdown state. 2022-02-14 17:52:33 +01:00
Balazs Kovacsics
aa44cedcd2 Fix indentation 2022-02-11 17:14:16 +01:00
Balazs Kovacsics
a0a56eaf9e Move TRACY_UWP define to own header 2022-02-10 20:26:45 +01:00
Balazs Kovacsics
7169f5f30a Fix compiling TracyClient.cpp on UWP with defined TRACY_ENABLE 2022-02-09 22:14:36 +01:00
Bartosz Taudul
f058ad01fc
Don't process ring buffers when not connected in on-demand mode. 2022-01-31 20:53:10 +01:00
hulakdar
e98f7e5019 Fix potentially unitialized value warning 2022-01-26 21:08:54 +02:00
hulakdar
9fda60820a Silence padding warnings, as this is intended behaviour 2022-01-26 21:08:54 +02:00
Bartosz Taudul
4731bb9ec1
Cast GetProcAddress() ptr to const void*. 2022-01-05 20:03:20 +01:00
Bartosz Taudul
621c68352b
Call RtlWalkFrameChain directly from inlined function. 2022-01-01 17:33:39 +01:00
Bartosz Taudul
e368266837
Add custom demangler interface. 2021-12-22 18:17:48 +01:00
Bartosz Taudul
2f0d4a7707
Merge pull request #294 from Lectem/symbols_post_init
Call SymLoadModuleEx for modules loaded after init (Fixes #293)
2021-12-22 16:36:08 +01:00
Bartosz Taudul
29dc2fadf9
Do not bail-out on software sampling failure. 2021-12-21 22:09:40 +01:00
Bartosz Taudul
f1fa352a13
/sys/kernel/debug/tracing/... files are accessible on android. 2021-12-21 21:10:17 +01:00
Bartosz Taudul
efae847690
Replace getline(). 2021-12-21 20:28:18 +01:00
Bartosz Taudul
7f10265e34
Keep ring buffer size unsigned. 2021-12-21 20:24:52 +01:00
Bartosz Taudul
81ae7c06b8
Android libstdc++ is really stupid, it seems. 2021-12-21 19:56:32 +01:00
Bartosz Taudul
5741bcfd32
Make ring buffer size adjustable.
If call stack capture is enabled for context switch data, the 64KB buffer is
too small to work without overruns. However, if the default buffer size is
increased, then the maximum locked memory limit is hit.

This change keeps the small buffer size for all the buffers that may be used
without escalated privileges. The context switch buffer is bigger, but it does
not need to obey the limits, as the application is running as root, if it is
to be used.
2021-12-21 15:48:40 +01:00
Bartosz Taudul
d88bf2c7a8
Separate message type for context switch callstack samples. 2021-12-21 14:05:07 +01:00
Bartosz Taudul
0ba2c0a86e
Collect context switch callstack on Linux. 2021-12-21 13:59:16 +01:00
Bartosz Taudul
0c041795b6
Move Linux calltrace processing to a separate function. 2021-12-21 13:58:43 +01:00
Bartosz Taudul
4a89a30556
Implement checking if any TID is within current process. 2021-12-21 13:52:52 +01:00
Bartosz Taudul
b8d7824a4f
Increase ring buffer size. 2021-12-21 13:27:08 +01:00
Lectem
5d0466b729 Rename GetModuleName and call it before sym* use 2021-12-12 14:32:24 +01:00
Lectem
17855cbac5 Call SymLoadModuleEx for modules loaded after init
This fixes issue #293. Symbols are not loaded if the module is loaded dynamically after the SymInitialize call.
This may stall the symbol resolver thread a bit the first time a module is loaded.
2021-12-08 21:30:06 +01:00