Commit Graph

1132 Commits

Author SHA1 Message Date
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
Bartosz Taudul
54fa21bcbb
Restore original signal handlers on profiler exit. 2021-07-25 11:40:22 +02:00
JIA-ss
5936e7c86c
Multi Dll Proj will Crash, Under Unity (#244) 2021-07-25 11:28:42 +02:00
Bartosz Taudul
32b1e8dcb0
No kernel symbol on macos. 2021-06-20 19:35:05 +02:00
Bartosz Taudul
c445c3805c
Merge remote-tracking branch 'origin/master' into hw 2021-06-20 11:13:02 +02:00
Andrey Voroshilov
5670493757 Fix compilation warning 2021-06-19 23:26:03 -07:00
Bartosz Taudul
ee13d3fa44
Retrieve address of symbol, not first instruction in line. 2021-06-19 19:52:33 +02:00
Bartosz Taudul
fe7db6db4e
Send symbol address in code information message. 2021-06-19 19:07:56 +02:00
Bartosz Taudul
3ce2f6209a
Return symbol address in DecodeCodeAddress(). 2021-06-19 19:02:08 +02:00
Bartosz Taudul
7e1622083e
Use monotonic raw clock for hardware sampling. 2021-06-19 13:40:31 +02:00
Bartosz Taudul
7086f2db65
Merge branch 'master' into hw 2021-06-17 01:37:10 +02:00
Bartosz Taudul
fde62b4e6e
Dynamically load some dbghelp functions. 2021-06-17 01:34:45 +02:00
Bartosz Taudul
50e0d4781b
No kernel cache on cygwin. 2021-06-16 00:51:30 +02:00
Bartosz Taudul
f1bf663160
Load kernel symbols. 2021-06-15 21:28:32 +02:00
Bartosz Taudul
2d5f6a411c
Add windows kernel module discovery. 2021-06-15 21:28:32 +02:00
Bartosz Taudul
8fa9860764
Load windows device drivers list. 2021-06-15 21:28:31 +02:00
Bartosz Taudul
bdb11f6e48
Use same kernel module name as on Linux. 2021-06-15 02:31:51 +02:00
Bartosz Taudul
6d03b18d1c
Don't filter out kernel frames on win32. 2021-06-15 01:40:21 +02:00
Bartosz Taudul
697ec4372e
Set combine samples flag on win32. 2021-06-15 01:32:18 +02:00
Bartosz Taudul
06dcdd342f
Combine flags in welcome message. 2021-06-15 01:26:50 +02:00
Bartosz Taudul
004681b02b
Merge remote-tracking branch 'origin/master' into hw 2021-06-14 23:54:34 +02:00
Bartosz Taudul
d07db80b44
Fix rpmalloc init for shared libraries. 2021-06-13 12:15:36 +02:00
Bartosz Taudul
698e5f0210
Probe precise_ip for software sampling. 2021-06-13 01:21:09 +02:00
Bartosz Taudul
1f07a4ce35
One more query to acknowledge. 2021-06-13 01:08:04 +02:00
Bartosz Taudul
b35dfe71d1
Send kernel symbol information. 2021-06-12 16:08:50 +02:00
Bartosz Taudul
4dc05ab858
Implement retrieval of kernel symbol names. 2021-06-12 15:27:35 +02:00
Bartosz Taudul
0168ab6535
Server queries must be always acknowledged. 2021-06-12 14:44:55 +02:00
Bartosz Taudul
0a954fda87
Capture kernel frames on Linux.
Garbage frames ("markers") have to be filtered out.
2021-06-12 14:36:07 +02:00
Bartosz Taudul
ed50447f7a
Use alias for s_ring[i]. 2021-06-12 13:13:53 +02:00
Bartosz Taudul
f4c95eb021
Load linux kernel symbols list. 2021-06-11 01:31:02 +02:00
Bartosz Taudul
ca2130d56c
Process all data available in ring buffers. 2021-06-10 02:07:29 +02:00
Bartosz Taudul
5b7cd06840
Don't init rpmalloc, if we know it has been done already. 2021-06-10 01:48:11 +02:00
Bartosz Taudul
9c2ea8a71f
Specify minimum length of subframe skip in one place. 2021-06-09 02:13:00 +02:00
Bartosz Taudul
e1c3babf43
Check whole ignore list on ARM. 2021-06-09 02:06:28 +02:00
Bartosz Taudul
c79bfa349f
Update ARM CPU parts list. 2021-06-04 19:41:59 +02:00
Bartosz Taudul
ecf0e3d587
Update apple devices list. 2021-06-04 19:16:51 +02:00
Bartosz Taudul
859aa3b2b0
Setup system tracing before launching profiler threads.
This makes sure that profiler threads are properly included in sample data on
Linux. This was previously working because sample capture was performed
system-wide. Now samples are only captured in client context, which includes
all spawned threads. Since this inclusion only works for threads which will be
spawned after the trace starts, no thread can be created before sampling setup
is done.
2021-06-04 14:07:46 +02:00
Bartosz Taudul
2765be92fb
Sample time for hardware samples. 2021-06-04 12:50:55 +02:00
Bartosz Taudul
1616411257
Use AVX2 to search in strings with 32-byte blocks. 2021-06-03 13:49:38 +02:00
Bartosz Taudul
348582d6e4
Search for string matches with 8-byte blocks. 2021-06-03 13:10:26 +02:00
Bartosz Taudul
f8bb24ed36
Search for a character in string in 8-byte blocks. 2021-06-03 12:47:00 +02:00
Bartosz Taudul
483d31c1f4
Ringbuffer tail is not updated by kernel. 2021-06-03 01:14:44 +02:00
Bartosz Taudul
eb38640114
Fix uninitialized pointer. 2021-06-03 00:53:49 +02:00
Bartosz Taudul
b79014f3ee
Optimize parsing numbers.
Don't read byte-by-byte, process data in 8-byte packets.
2021-06-03 00:27:01 +02:00
Bartosz Taudul
b7c5939bb8
Merge remote-tracking branch 'origin/master' into hw 2021-06-02 01:12:28 +02:00
Bartosz Taudul
f4d80a4f5f
Fix rpmalloc init for TRACY_MANUAL_LIFETIME path. 2021-05-31 22:55:30 +02:00
Bartosz Taudul
3da84d1579
Hide rpmalloc init behind thread local boolean. 2021-05-31 22:38:22 +02:00
Bartosz Taudul
b0fc0d5dcc
Check if rpmalloc has to be initialized before each operation.
The C++11 spec states in [basic.stc.thread] thread storage duration:

2. A variable with thread storage duration shall be initialized before its
   first odr-use (3.2) and, if constructed, shall be destroyed on thread exit.

Previously Tracy relied on the TLS data being initialized:
- During thread creation (MSVC).
- Or during first use in a thread, but the initialization was performed for
  the whole TLS block.

It seems that new compilers are more granular with how they perform the
initialization, hence rpmalloc init has to be checked before each allocation,
as it cannot be "folded" into, for example, initialization of the profiler
itself.
2021-05-31 02:31:42 +02:00
Bartosz Taudul
92fb197aac
Use weak compare, yield thread. 2021-05-31 02:22:13 +02:00