Commit Graph

96 Commits

Author SHA1 Message Date
trodrigues
2988d0a136 rename libunwind option and add it to cmake 2023-11-10 16:17:39 -06:00
Tiago Rodrigues
95cb3e1f5a Add "TRACY_NO_SYS_TRACE" env var to allow force disabling system trace even if the underlying system supports it 2023-11-10 17:02:47 -05:00
Tiago Rodrigues
790d28911d Add env var "TRACY_NO_DBHELP_INIT_LOAD" to allow disabling dbghelp loading of DeviceDriver and ProcessModules at startup 2023-11-10 17:02:03 -05:00
Tiago Rodrigues
4c94b3eff7 Add support to use libunwind for backtrace capturing on linux platforms (which is ~ 4x faster than execinfo) 2023-11-10 17:00:39 -05:00
Bartosz Taudul
0b21b2f3b4
Merge pull request #649 from michaeldleslie/support_qnx
Add basic QNX support
2023-10-30 23:44:58 +01:00
Ivan Molodetskikh
852a1a5f14 Add TracyIsStarted
When using TRACY_MANUAL_LIFETIME, calling most Tracy functions
before starting the profiler results in an assertion. Notably, even
TracyIsConnected is affected. There is, however, no function to check if
the profiler had already started. This commit adds such a function.
2023-10-25 14:56:29 +04:00
Michael Leslie
8263bfb829 clean up indentation 2023-10-24 17:44:46 -07:00
Michael Leslie
daba5ae1d8 add qnx support for instrumentation profiling only 2023-10-24 17:40:13 -07:00
Ivan Molodetskikh
41fc293043 Add GpuTimeSync event
Allows to resynchronise GPU and CPU timestamps during profiling.
2023-10-22 10:16:41 +04:00
Bartosz Taudul
3601576b3f
Add some more ogryzek device identifiers. 2023-10-20 01:32:05 +02:00
Ivan Molodetskikh
52caae3a51 Defer GPU contexts from the C API
Same as how the C++ API does it. Otherwise with on demand mode the
profiler never receives the GPU context info.
2023-10-19 15:33:06 +04:00
Marcos Slomp
ded5b81fa4 eliminate "already defined" warning when passing TRACY_DELAYED_INIT to the compiler on Apple clients 2023-10-09 13:24:54 -07:00
Keno Fischer
5417227e83 Use patchable rdtsc sequence to avoid slowdowns under rr
We (Julia) ship both support for using tracy to trace julia applications,
as well as using `rr` (https://github.com/rr-debugger/rr) for record-replay debugging.
After our most recent rebuild of tracy, users have been reporting signfificant performance
slowdowns when `rr` recording a session that happens to also load the tracy library
(even if tracing is not enabled). Upon further examination, the recompile happened
to trigger a protective heuristic that disabled rr's patching of tracy's use of
`rdtsc` because an earlier part of the same function happened to look like a
conditional branch into the patch region. See https://github.com/rr-debugger/rr/pull/3580
for details. To avoid this issue occurring again in future rebuilds of tracy,
adjust tracy's `rdtsc` sequence to be `nopl; rdtsc`, which (as of of the
linked PR) is a sequence that is guaranteed to bypass this heuristic
and not incur the additional overhead when run under rr.

This functionality is kept behind a compile-time flag `TRACY_PATCHABLE_NOPSLEDS`
in order to avoid polluting the instruction cache unnecessarily.
2023-09-20 20:21:40 -04:00
Vincent Loppin
98de2ed1c4 Remove warning (unused parameters) 2023-09-07 10:06:42 +02:00
Mathias Lang
c6d9741136 Fix and test TRACY_DEMANGLE for TracyClient
The configuration wasn't tested and stopped compiling.
This fixes it and adds a test to ensure it doesn't break again.
2023-09-06 01:28:58 +02:00
Björn Blissing
e1b1fd72dc Wrap std::numeric_limits<T>::max() in parenthesis
The windows.h header file defines the macro max. If the max macro is include
it will lead to name collisions with the std::numeric_limits<T>::max() function.

One solution is to define NOMINMAX before the inclusion of windows.h.
However, that might be a demanding task for a large codebase. Defining the
NOMINMAX as global define may also break previous code.

Another to solution to the problem is to wrap the numeric_limits function in
parenthesis to instruct the compiler to treat it as a function and not a macro.

This commit wraps the std::numeric_limits<T>::max() calls in the public
interfacing header files, with parenthesis.
2023-08-17 10:03:52 +02:00
menduz
e05545b04a
Fix mac compile for latest macos SDK
Following 3feb2473a2, `mach_vm.h` seems to have been deleted
2023-08-15 21:00:46 -03:00
Ястребков Дмитрий Ирикович
de45af63cc Fix compilation for the case of using TRACY_NO_CALLSTACK 2023-07-31 11:40:12 +07:00
Bartosz Taudul
72cfa3e0d1
Fix copy pasta. 2023-05-04 15:16:46 +02:00
Cody Tapscott
6249999153 linux: respect TRACY_NO_SAMPLING for sys-tracing
This compile-time flag was being ignored on Linux. This change adds
gating for software-sampled stack trace sampling following the same
pattern as other `TRACY_NO_SAMPLE_*` options.

If `TRACY_NO_SAMPLING=1` is provided as an environment variable,
software stack sampling is also disabled.
2023-04-04 17:22:31 -04:00
Bartosz Taudul
e2e55a77b5
Add TracySetProgramName() macro to set broadcast contents. 2023-03-30 21:51:00 +02:00
Bartosz Taudul
2971db21e3
Read and report power usage. 2023-03-10 00:23:09 +01:00
Bartosz Taudul
c3e7157cd5
Detect power domains. 2023-03-10 00:05:18 +01:00
Bartosz Taudul
5e2e5eeefb
Add system power use tracking skeleton. 2023-03-09 22:31:31 +01:00
Bartosz Taudul
7151c6afd9
Add support for configuring plots to C API. 2023-03-08 23:18:36 +01:00
Lectem
ecdf6adc32 Fix race condition for symbols resolution on windows
There might have been new modules loaded by another thread between the `SymInitialize` and `EnumProcessModules` calls.
Since we register the enumerated modules into the cache, we need to make sure that symbols for this module are loaded.
The only way to do that is to call `SymLoadModuleEx`, just like we do when finding new modules after `InitCallstack`.
2023-02-14 15:32:37 +01:00
John Plate
37bc03fd63 Fix MSVC compiler warning 2023-02-08 13:27:17 +00:00
mwl4
1439e93a69 Fix compilation on linux: always initialize ScopedZone::m_connectionId to 0.
gcc error:
public/tracy/../client/TracyScoped.hpp:102:9: error: ‘___tracy_scoped_zone.tracy::ScopedZone::m_connectionId’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
         if( GetProfiler().ConnectionId() != m_connectionId ) return;
         ^~
2023-01-25 15:11:49 +01:00
mwl4
789f572332 Fix compilation on linux: use abort() instead of assert( false ).
assert() in release configuration resolves to empty code, while abort() is marked as [[noreturn]] and always is available.

gcc error:
error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]:
public/tracy/../client/../common/TracyAlign.hpp: In function ‘void tracy::SysTraceWorker(void*)’:
public/tracy/../client/../common/TracyAlign.hpp:22:11: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     memcpy( ptr, &val, sizeof( T ) );
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from public/TracyClient.cpp:26,
                 from X.cpp:
public/client/TracySysTrace.cpp:1258:35: note: ‘type’ was declared here
                         QueueType type;
                                   ^~~~
2023-01-25 15:08:51 +01:00
Bartosz Taudul
d47122586c
Fix color channel names in source location message. 2023-01-23 01:23:15 +01:00
Bartosz Taudul
6652999a60
Fix color channels names in zone color message. 2023-01-23 01:18:54 +01:00
Bartosz Taudul
eb7c13e7bb
Fix message color component names in the protocol.
Red and blue channels were mislabeled. Otherwise, coding and decoding was
performed correctly, as far as the color channel order described in the manual
is followed by the user.

No change to the binary protocol was made.
2023-01-23 01:07:07 +01:00
Bartosz Taudul
ecb4a0527a
Do not retrieve call stacks if sampling is not requested. 2023-01-05 21:45:44 +01:00
Bartosz Taudul
c12505c19d
Fix TRACY_NO_CALLSTACK on Windows. 2022-12-22 21:17:31 +01:00
Bartosz Taudul
ba6416f68c
Merge pull request #497 from pshurgal/detailed_function_names
More detailed function names under Clang and GCC
2022-11-30 12:14:46 +01:00
Petr Shurgalin
5ddf62b54e Customizable source location data 2022-11-30 12:39:50 +02:00
ReplayCoding
311ad7b061
Fix compile error when TRACY_NO_CRASH_HANDLER is enabled 2022-11-27 13:40:45 -08:00
Bartosz Taudul
2c03306341
Always provide Callstack() implementation, even if dummy.
This fixes usage with TRACY_HAS_CALLSTACK undefined, allowing compilation of
otherwise unused functions, which are already protected from being called
through macro redirections.

See https://github.com/wolfpld/tracy/pull/492 for more information.
2022-11-09 21:55:41 +01:00
Bartosz Taudul
6c74320b3e
Merge pull request #488 from xxxbxxx/master
Added typed plots variants to the C API
2022-11-03 19:28:04 +01:00
Bartosz Taudul
e7ac54fba6
Signals are only set if TRACY_NO_CRASH_HANDLER is not defined. 2022-11-03 17:21:09 +01:00
xxxbxxx
a0cb8eb1d5 Added typed plots variants to the C API 2022-11-03 13:47:04 +01:00
Bartosz Taudul
970468f937
Override dlclose() to do nothing.
Provide a custom no-op implementation of dlclose(), in order to prevent shared
object data from disappearing from profiler view. The server makes queries for
program executable code, which has to be always available, otherwise wrong
data may be provided, or the program may crash, due to referencing no longer
mapped memory.

The dlclose() documentation states that the function internally decreases the
reference count, and only does unload the shared object when the count reaches
zero. There is no guarantee that the shared object data will be unloaded
immediately after any dlclose call originating from the program. This function
override exploits this fact.
2022-10-28 01:21:52 +02:00
Bartosz Taudul
898140fbda
Don't read payload.extra, if not needed. 2022-10-28 00:34:46 +02:00
Bartosz Taudul
b88ef29792
Make sure source file data is properly tracked. 2022-10-13 19:00:22 +02:00
Bartosz Taudul
a85c0e18d2
Decouple source code retrieval from the profiler thread.
This will prevent apparent freezes of the profiler when debuginfod queries are
made.
2022-10-13 00:30:17 +02:00
Bartosz Taudul
6ca1c98655
Handle symbol thread crashes.
Should the symbol thread crash, mark that it is gone. This will allow the
profiler to transmit crash call stack, including resolved symbol names and
locations (which will resolve on the main profiler thread).
2022-10-13 00:30:17 +02:00
Bartosz Taudul
9657bdec72
Initialize rpmalloc properly in symbol worker. 2022-10-12 23:51:50 +02:00
Bartosz Taudul
4416dff342
Increase extra data in SymbolQueueItem to 64 bit. 2022-10-12 22:23:06 +02:00
Bartosz Taudul
f64fb95a77
Fix preprocesor condition. 2022-10-12 22:05:19 +02:00
Bartosz Taudul
8ca4bc761d
s_symbolTid is only available if crash handler is there. 2022-10-12 19:56:46 +02:00