Commit Graph

1180 Commits

Author SHA1 Message Date
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
Bartosz Taudul
14cdf3d43e
Use perf_event_open for context switch tracking. 2021-12-05 12:02:28 +01:00
Bartosz Taudul
0a3da9efdb
Optional CPU idx storage in RingBuffer. 2021-12-05 03:03:14 +01:00
Bartosz Taudul
6a0d233613
Proper mmap failure detection. 2021-12-05 01:32:33 +01:00
Bartosz Taudul
22284d57e7
Don't identify samples if there will be no context switches. 2021-12-05 01:32:30 +01:00
Nathan Day
bdafd0c7b6 Added IsConnected C API Equivalent 2021-12-04 16:55:41 +00:00
Bartosz Taudul
20f8c8b8a4
Add IdentifySamples flag to the protocol.
On Windows there is no way to distinguish callstack data coming from random
sampling and from context switches. Each callstack timestamp has to be matched
against the context switch data in order to decide its origin. This is
obviously non-trivial.

On some other platforms, the origin information may be available right away,
in which case the process of matching against the context switch data, which
possibly includes postponing callstacks for processing in the future, may be
completely omitted.
2021-12-04 14:50:25 +01:00
Bartosz Taudul
2008c88983
Silence compiler warnings. 2021-12-04 13:41:55 +01:00
Bartosz Taudul
74e2a63516
Don't require time to be available for samples. 2021-12-02 01:29:22 +01:00
Bartosz Taudul
051b1ba8f5
Display sampling disabled message on debug log channel. 2021-12-02 00:49:01 +01:00
slembcke
87a727dd7f Add fibers to TracyC.h 2021-11-26 16:49:39 -06:00
Bartosz Taudul
d41447b0c9
Pass full module path to LoadLibraryEx(). 2021-11-25 23:27:20 +01:00
Bartosz Taudul
a27d1902ae
Store paths to kernel modules. 2021-11-25 23:27:05 +01:00
Bartosz Taudul
8428ede59d
Retrieve kernel symbols on Windows. 2021-11-25 23:12:41 +01:00
Bartosz Taudul
4bde9022e1
Properly acknowledge unavailable symbol code. 2021-11-25 22:44:56 +01:00
Bartosz Taudul
e8fb2abb2a
Dispatch kernel code retrieval. 2021-11-25 22:27:35 +01:00
Bartosz Taudul
01db142144
Rpmalloc is initialized here. 2021-11-25 22:23:28 +01:00
Bartosz Taudul
1ed174c1b6
Expose GetModuleName() outside TracyCallstack.cpp. 2021-11-25 21:56:13 +01:00
Bartosz Taudul
2bd1e5bca7
Merge pull request #283 from expenses/c-gpu-zones
Implement a bare-bones C API for graphics profiling
2021-11-24 12:50:20 +01:00
Ashley Ruglys
2db109ab98
Add serial functions 2021-11-24 11:56:43 +01:00
Ashley Ruglys
2995db4b5e
Remove the 'active' argument 2021-11-24 11:45:37 +01:00
Bartosz Taudul
cad65ab52f
Handle magic dbghelp line numbers.
https://github.com/Microsoft/microsoft-pdb/issues/16
https://docs.microsoft.com/en-us/archive/blogs/jmstall/line-hidden-and-0xfeefee-sequence-points
2021-11-20 17:09:20 +01:00
Bartosz Taudul
bbbd78883c
Allow crash signal selection by user. 2021-11-18 20:20:10 +01:00
Ashley Ruglys
bf1896f6ba
memset the thread to 0 when writing the GpuZoneEnd as this seems to prevent an assert failure 2021-11-17 18:14:57 +01:00
Ashley Ruglys
cc45865239
Small formatting changes 2021-11-17 11:31:02 +01:00
Ashley Ruglys
91b4058dc4
Implement bare-bones functionality for gpu contexts in the C api 2021-11-17 11:27:52 +01:00
Bartosz Taudul
590a4afb89
Full dequeue is needed to handle symbol queries. 2021-11-14 19:24:05 +01:00
Bartosz Taudul
a5f5dcc00f
Remove capacity safeties. 2021-11-14 18:52:57 +01:00
Bartosz Taudul
5306034893
Remove unused methods. 2021-11-14 18:52:27 +01:00
Bartosz Taudul
9055a31156
Decrease number of SPSCQueue items to 8K.
This matches the query limit set on the server.
2021-11-14 18:51:11 +01:00
Bartosz Taudul
a203eb5aef
Adapt to SPSCQueue interface. 2021-11-14 18:50:59 +01:00
Bartosz Taudul
93f83fc50c
Remove allocator silliness. 2021-11-14 18:42:07 +01:00
Bartosz Taudul
fe04cf0b35
Move SPSCQueue to tracy namespace. 2021-11-14 18:31:58 +01:00
Bartosz Taudul
20e3ec92b9
Replace readerwriterqueue with SPSCQueue. 2021-11-14 18:27:25 +01:00
Bartosz Taudul
97c519811c
Capture context switch call stacks on Windows. 2021-11-12 12:22:29 +01:00
Bartosz Taudul
987f70a9d4
Signal initialization failure through exit code. 2021-11-11 12:43:59 +01:00
Bartosz Taudul
765561de81
Serialize continuous frame events. 2021-11-05 01:13:24 +01:00
Nathan Day
4fece233d9 Added unused parameters when TRACY_HAS_CALLSTACK is undefined 2021-11-04 15:24:58 +00:00
Bartosz Taudul
887826a28a
Remove dead code. 2021-11-03 18:58:53 +01:00
Bartosz Taudul
fceb065329
Fiber name transport. 2021-11-03 18:57:30 +01:00
Bartosz Taudul
229d547e91
Add fiber support on client side. 2021-11-02 00:11:09 +01:00
Bartosz Taudul
8b15cd049c
Skip comparing known to be matching memory. 2021-10-30 01:26:31 +02:00
Bartosz Taudul
1ecdb8aa2a
Report device name on Android. 2021-10-26 18:09:56 +02:00
Bartosz Taudul
bd108220cb
Drain symbols queue if on-demand and not connected. 2021-10-23 01:54:38 +02:00
Bartosz Taudul
3d13ec7018
Pump symbols queue during profiler termination. 2021-10-23 01:47:04 +02:00
Bartosz Taudul
fe9c63b8d2
Signal symbol resolution thread destruction. 2021-10-23 01:46:00 +02:00
Bartosz Taudul
02ce9b7d8b
Extract symbol queue item handling. 2021-10-23 01:35:01 +02:00
Bartosz Taudul
2b9265cc40
Move symbol resolution to a separate thread. 2021-10-22 22:25:09 +02:00
Bartosz Taudul
b4cfb1f2d5
Add SPSC symbol queue. 2021-10-22 22:22:27 +02:00
Bartosz Taudul
f2b0aadedc
Return external names, instead of sending them.
Note that the old function is still used by code, so this commit won't
compile.
2021-10-22 22:20:30 +02:00
Bartosz Taudul
af5da6f53c
Move inline string copy helpers to a separate header. 2021-10-22 21:53:46 +02:00
Bartosz Taudul
75f77a068f
Use rpmalloc in readerwriterqueue. 2021-10-22 20:39:10 +02:00
Bartosz Taudul
60b36df077
Cosmetics. 2021-10-21 01:49:20 +02:00
Bartosz Taudul
6c53c36bfe
Remove server query quota. 2021-10-21 01:48:52 +02:00
Bartosz Taudul
93b6fd72c3
Keep lock until we're done with the data. 2021-10-21 01:31:03 +02:00
Bartosz Taudul
4348c5428d
Returned strings may be invalidated, so copy them. 2021-10-21 01:30:17 +02:00
Bartosz Taudul
ff54317a87
Move EnsureReadable() and co. to top of source file. 2021-10-21 00:06:14 +02:00
Bartosz Taudul
6d490ffd28
Revert "Use SPSC queue for frame images."
This reverts commit 02e76faff7.

Let's not limit frame image reporting to just one thread.
2021-10-20 23:18:03 +02:00
Bartosz Taudul
ce2a7d6741
Offset field is not used. 2021-10-20 22:57:23 +02:00
Bartosz Taudul
02e76faff7
Use SPSC queue for frame images. 2021-10-20 22:57:23 +02:00
Bartosz Taudul
ff3382391e
Remove BlockingReaderWriterQueue and semephores. 2021-10-20 22:57:22 +02:00
Bartosz Taudul
3d21c4e7ea
Add amalgamated readerwriterqueue 1.0.5. 2021-10-20 22:45:30 +02:00
Bartosz Taudul
a1511a39bd
Delta-encode code information pointers. 2021-10-16 16:29:06 +02:00
Bartosz Taudul
5ccf369919
Implement callstack serialization. 2021-10-10 16:14:17 +02:00
Bartosz Taudul
a421083e58
Crash reports may be serialized. 2021-10-10 15:58:24 +02:00
Bartosz Taudul
082255f940
Messages may now use serialized queue. 2021-10-10 15:54:21 +02:00
Bartosz Taudul
20074e64f4
Fix processing of serialized zone color, value and validation. 2021-10-10 14:43:36 +02:00
Bartosz Taudul
909f5916b1
Use possibly-synchronous macros for C API zones. 2021-10-09 15:51:29 +02:00
Bartosz Taudul
2cea5bc5b2
Add C API async-or-sync queue macros. 2021-10-09 15:50:30 +02:00
Bartosz Taudul
5835011d0f
Allow serialized zone validation. 2021-10-09 15:50:09 +02:00
Bartosz Taudul
7527f33d6c
Handle serialized zones. 2021-10-09 15:31:45 +02:00
Bartosz Taudul
2eeade89ba
Add macro for handling serial dequeue thread context checks. 2021-10-09 15:30:58 +02:00
Bartosz Taudul
2d5d4293a9
Move thread context check to a separate function. 2021-10-09 15:16:36 +02:00
Bartosz Taudul
13acec38f7
Use the possibly-synchronous macros in C++ zones. 2021-10-09 14:58:33 +02:00
Bartosz Taudul
6411b35d68
Provide macros for async-or-sync queue insertion.
If fibers are enabled, then some events which were traditionally stored in
async queues will have to be serialized. These macros provide the needed
infrastructure for this.
2021-10-09 14:55:32 +02:00
Bartosz Taudul
250ef2cf6e
Change thread id size from 64 to 32 bits.
Both Windows and Linux use 32-bit thread identifiers. MacOS has a 64-bit
counter, but in practice it will never overflow during profiling and no false
aliasing will happen.

These changes are only done client-side and in the network protocol. The
server still uses 64-bit thread identifiers, to enable virtual threads, etc.
2021-10-08 00:42:52 +02:00
Bartosz Taudul
07bc665d8c
Drop support for Cygwin. 2021-10-07 23:28:40 +02:00
Bartosz Taudul
12f693372a
Cosmetics. 2021-10-07 23:28:31 +02:00
Simonas Kazlauskas
54ee3d8a94 Expose TRACY_MANUAL_LIFETIME APIs to C API clients
These are extremely useful for ecosystems such as Rust. There are a
couple of reasons why:

1. Rust strongly advises against relying on life before/after main, as
   it is difficult to reason about. Most users working in Rust will
   generally be quite surprised when encountering this concept.
2. Rust and its package manager makes it easy to use packages (crates)
   and somewhat less straightforward to consider the implications of
   including a dependency.

   In case of the `rust_tracy_client` set of packages, I currently have
   to warn throughout the documentation of the package that simply
   adding a dependency on the bindings package is sufficient to
   potentially accidentally broadcast a lot of information about the
   instrumented binary to the broader world. This seems like a major
   footgun given how easy is it to forget about having added this
   dependency.

Ability to manually manage the lifetime of the profiler would be a great
solution to these problems.
2021-09-18 14:54:00 +03:00
Michal Ziulek
789328f73d
Undo my previous change.
-D_WIN32_WINNT=0x601 must be defined when building TracyClient.cpp for mingw-w64 on Windows. In that case definitions I've added are not needed.
2021-09-17 11:34:40 +02:00
Michal Ziulek
ad97854f12
Fixed compile error when using zig cc. 2021-09-14 19:30:20 +02:00
Bartosz Taudul
924224501e
Remove exception handler during profiler destruction. 2021-07-25 11:48:27 +02:00
Bartosz Taudul
61c9e8e6d8
Crash handler may be not installed. 2021-07-25 11:46:20 +02:00