Commit Graph

600 Commits

Author SHA1 Message Date
Ben Vanik
7dfdad2e02 Adding ZoneColor to set a dynamic color override to an existing zone. 2020-11-27 20:12:24 +01:00
Benoit Jacob
fc8ef12a78 fix condition in LookUpMapping, and some cosmetic fixes 2020-11-23 11:56:08 -05:00
Benoit Jacob
d787636804 remove some useless inline keywords 2020-11-22 09:49:46 -05:00
bjacob
d05641d70c
Ensure that mappings have read permission before decoding symbols and reading code. (#129) 2020-11-21 21:05:39 +01:00
Bartosz Taudul
09203905d6 Support memory pools in the C API. 2020-11-15 15:23:22 +01:00
Bartosz Taudul
bd31e3d2d6 Send callstacks before sending events they belong to. 2020-09-29 16:40:19 +02:00
Bartosz Taudul
8eb51aa01d Get LFQ item before capturing callstack.
This is to ensure that thread local structures have been properly
initialized (lock-free queue buffers are thread local), as capturing
callstack involves allocating memory from rpmalloc, which must be
initialized in each thread before allocation.
2020-09-29 15:10:55 +02:00
Bartosz Taudul
4db092437c Add support for custom allocator tracking to client. 2020-09-24 01:31:23 +02:00
Bartosz Taudul
593ce74042 Notify servers that client is no longer listening for connections.
This happens in these two cases:
- The client is exiting.
- A connection attempt is performed.

This message type is indicated by negative time value.
2020-09-20 22:20:33 +02:00
Bartosz Taudul
5c826c2723 Send signed active time in broadcast message.
This allows special treatment of negative values.
2020-09-20 22:15:10 +02:00
Bartosz Taudul
1e34b22a82 There's no QPC on non-windows systems. 2020-09-20 19:47:00 +02:00
Bartosz Taudul
f3eabc28e2 Don't handle crashes, if there's no connection. 2020-08-28 17:21:52 +02:00
Bartosz Taudul
5239b706c3 Allow disabling code transfer. 2020-08-16 01:31:54 +02:00
Bartosz Taudul
649994706b Use clock monotonic raw on Linux.
Because Linux kernel interfaces are fucking stupid.
2020-08-12 16:49:30 +02:00
Bartosz Taudul
be2ffb2023 Compile ARM CPU decoding functions only if used. 2020-07-31 01:51:31 +02:00
Bartosz Taudul
b696f1b466 GetHex() is only used on ARM linux. 2020-07-31 01:46:16 +02:00
Bartosz Taudul
2be3f1766f Use constexpr instead of enum. 2020-07-31 00:58:59 +02:00
Bartosz Taudul
7e6a41e647 No need for lean alloc srcloc zone begin messages. 2020-07-26 14:35:04 +02:00
Bartosz Taudul
062bb3044f No need for lean callstack sample message. 2020-07-26 14:28:13 +02:00
Bartosz Taudul
4252cac654 No need for lean callstack alloc message. 2020-07-26 14:25:32 +02:00
Bartosz Taudul
18713de70c No need for lean frame image message. 2020-07-26 14:23:04 +02:00
Bartosz Taudul
b76726c597 No need for lean callstack, callstack memory messages. 2020-07-26 14:23:03 +02:00
Bartosz Taudul
3e3aa80fa7 Completely serialize lock events. 2020-07-26 13:46:05 +02:00
Bartosz Taudul
03f46d7228 Custom string data is no longer needed. 2020-07-26 01:47:49 +02:00
Bartosz Taudul
c0b73c248f Add second single string transfer. 2020-07-26 01:47:49 +02:00
Bartosz Taudul
a7d2ab4d4f Send single string for lock name. 2020-07-26 01:47:49 +02:00
Bartosz Taudul
e91950f006 Send single string for messages. 2020-07-26 01:35:52 +02:00
Bartosz Taudul
5553761c02 Send single string for zone text and name. 2020-07-26 01:35:52 +02:00
Bartosz Taudul
309a151610 Symbol length no longer has to be packed. 2020-07-26 01:35:52 +02:00
Bartosz Taudul
88685440b6 Send single string for callstack frame. 2020-07-26 01:35:52 +02:00
Bartosz Taudul
61e3acde06 Send single string for callstack frame size. 2020-07-26 01:35:52 +02:00
Bartosz Taudul
06ca4e2d16 Send single string for symbol information. 2020-07-26 01:35:52 +02:00
Bartosz Taudul
14b180cd16 Send single string for code information. 2020-07-26 01:35:51 +02:00
Bartosz Taudul
81d5a8db5e Implement transport of single string data.
In most cases only one string is sent per message and no pointer
tracking is needed.

This is only plumbing work, no changes to messages have been made yet.
2020-07-26 01:35:51 +02:00
Bartosz Taudul
02e7893c75 Preserve messages size. 2020-07-21 20:58:58 +02:00
Bartosz Taudul
9d01fa86ab Preserve zone text, zone name string length. 2020-07-21 20:58:58 +02:00
Bartosz Taudul
5d748f3568 Don't calculate known strings length. 2020-07-21 20:58:58 +02:00
Bartosz Taudul
e4fbf60668 Add SendString() with length parameter. 2020-07-21 20:58:58 +02:00
Bartosz Taudul
2bef3629b7
Merge pull request #74 from avoroshilov/manual-lifetime
Manual lifetime management for Multi-DLL
2020-07-19 12:06:11 +02:00
Andrey Voroshilov
175ec3e3d8 Moving ThreadExitHandler to a commonly accessible space, adding thread handler usage to SysTrace worker threads 2020-07-18 18:24:49 -07:00
Bartosz Taudul
b8df7a1302 Expose m_isConnected in non-on-demand builds. 2020-07-16 11:22:06 +02:00
Andrey Voroshilov
cbfb19816b Merge remote-tracking branch 'tracy/master' into manual-lifetime
# Conflicts:
#	AUTHORS
2020-07-13 01:49:11 -07:00
Andrey Voroshilov
4c397ebe1e Fixing some of the copy-paste errors 2020-07-12 10:12:50 -07:00
Andrey Voroshilov
3ae84647c4 Moving GetProfiler back to the original place 2020-07-12 10:10:09 -07:00
Andrey Voroshilov
a758de2f03 Moving GetProfiler back to the original place 2020-07-12 10:06:09 -07:00
Andrey Voroshilov
6b790d778d Replacing removing spinlock that is not needed anymore, making TRACY_MANUAL_LIFETIME a sub-option of TRACY_DELAYED_INIT, and addressing feedback 2020-07-12 10:04:07 -07:00
Andrey Voroshilov
4d505f507b Fixed rogue TAB indentation 2020-07-08 03:52:00 -07:00
Andrey Voroshilov
199dc46e7d Fixing crash on exit due to RP malloc not being deinitialized 2020-07-08 03:50:25 -07:00
Andrey Voroshilov
71ca0683d6 Fixing preprocessor formatting 2020-07-08 03:48:37 -07:00
Bartosz Taudul
5e5bf928a5 Add QPC frequency query to API. 2020-07-07 21:25:35 +02:00
Andrey Voroshilov
6a72560989 Fixing functions case to match the source capitalization rules 2020-07-07 03:12:02 -07:00
Andrey Voroshilov
da5e58682f Adding manual lifetime management to aid multi-DLL usecase 2020-07-07 00:39:09 -07:00
Bartosz Taudul
384e2e3fa1 Reduce memory requirements of allocated call stacks. 2020-07-05 17:33:29 +02:00
Bartosz Taudul
f718761905 Reduce allocated source location size by 2 bytes. 2020-07-05 17:11:15 +02:00
Bartosz Taudul
4bbeb51e34 Add secure alloc/free macros. 2020-06-24 01:33:26 +02:00
Bartosz Taudul
530e464347 Add checker for profiler availability. 2020-06-24 01:32:57 +02:00
Bartosz Taudul
cf8620b956 Cosmetics. 2020-06-24 01:14:55 +02:00
Simonas Kazlauskas
b0d67064b5 Check for null FILE handles in ReportTopology
On Linux `/sys` is not guaranteed to exist. When it doesn't, tracy
would crash with a SIGSEGV due to a nullptr dereference. Not actually
sure how well tracy clients will handle the case where this information
is missing, though.
2020-06-21 20:14:05 +03:00
Bartosz Taudul
b353eb753b
Merge pull request #56 from nagisa/nagisa/fix-macos-build
Fix build on macos
2020-06-20 19:57:09 +02:00
Simonas Kazlauskas
b03da81afa Fix build on macos
It was broken by a110b42011.

In addition, adjust the CI definition to test builds on macOS.
2020-06-20 20:44:55 +03:00
Simonas Kazlauskas
29886435b4 ___tracy_alloc_* take pointer-size pairs
This enables better bindings in languages that do not have 0-terminated
strings for source/function name. It does not introduce any additional
overhead in languages that do use 0-terminated strings, either, but it
_is_ a breaking API change.

Fixes https://github.com/wolfpld/tracy/issues/53
2020-06-20 20:35:42 +03:00
Simonas Kazlauskas
a110b42011 Add ___tracy_init_thread function
This function needs to be called for each non-main thread before calling
the `___tracy_alloc_` functions.

Alternative way to achieve this could be initializing the allocator
transparently in the `___tracy_alloc_*` calls.
2020-06-20 04:22:32 +03:00
Bartosz Taudul
aa3b0de1f5 Use proper cpuid flag. 2020-06-10 16:25:19 +02:00
Bartosz Taudul
284d49b34b Change rdtscp check to rdtsc check. 2020-06-08 19:35:42 +02:00
Graydon Hoare
93b7b5a8e7
ensure regs is initialized even if cpuid fails 2020-06-03 19:54:48 -07:00
Bartosz Taudul
2b304581cf Implement transfer of integral values for zones. 2020-05-24 16:13:09 +02:00
Bartosz Taudul
4eb78f5c86 Auto-initialize profiler in delayed init scenario. 2020-05-19 13:55:54 +02:00
Bartosz Taudul
21c168156c Restrict client to C++11. 2020-05-13 18:15:12 +02:00
Bartosz Taudul
e9f93f5bc7 Send lean frame images. 2020-05-10 20:16:08 +02:00
Bartosz Taudul
03b5dfacd6 Send lean callstack samples. 2020-05-10 20:00:51 +02:00
Bartosz Taudul
09388f3c99 Send lean callstack allocs. 2020-05-10 19:56:36 +02:00
Bartosz Taudul
5a774c82cc Send lean callstacks. 2020-05-10 19:43:12 +02:00
Bartosz Taudul
f0ade07be8 Send lean memory callstacks. 2020-05-10 19:28:08 +02:00
Bartosz Taudul
2dc07fca0b Send lean allocated source locations. 2020-05-10 19:20:59 +02:00
Bartosz Taudul
a47c7d467f Send x86 processor info in welcome message. 2020-05-06 19:18:17 +02:00
Bartosz Taudul
f13413922d Use one cpuid implementation. 2020-05-06 18:52:36 +02:00
Bartosz Taudul
14ec246659 Fix typo. 2020-04-24 00:55:57 +02:00
Bartosz Taudul
a5bff2f7e5 Sleep to force rescheduling main thread during init.
This fixes problems with first context switch data region possibly not being
available for the main thread, if no rescheduling was performed after sys
tracing has started.
2020-04-14 22:45:32 +02:00
Bartosz Taudul
3b85c51e5f Search for free listen port, if default is occupied. 2020-04-13 21:40:52 +02:00
Bartosz Taudul
b389ccbb38 Issue just one read call when handling server queries. 2020-04-13 14:32:31 +02:00
Bartosz Taudul
1bbece649f Implement socket read without exit check. 2020-04-13 14:22:58 +02:00
Bartosz Taudul
b69aaf04e9 Add support for QPC timer. 2020-04-07 22:01:31 +02:00
Bartosz Taudul
8d9a611874 Get rid of unicode ifdefs. 2020-04-07 21:35:37 +02:00
Bartosz Taudul
a6468b6b6e Sleep when clearing queues if listen port is occupied. 2020-04-04 21:08:13 +02:00
Bartosz Taudul
b2a8b53efa Query source location of each assembly instruction. 2020-04-01 21:43:03 +02:00
Bartosz Taudul
40281ce2a1 Add default no-op to switch. 2020-03-26 01:07:25 +01:00
Bartosz Taudul
add5b29d03 Report CPU architecture in welcome message. 2020-03-25 21:28:02 +01:00
Bartosz Taudul
ce449ac0e2 Notify server that parameter was handled. 2020-03-25 20:37:26 +01:00
Bartosz Taudul
f114ec3f80 Add code transfer from client to server. 2020-03-25 20:04:55 +01:00
Bartosz Taudul
3e0e120222 Add extra parameter to server queries. 2020-03-25 20:04:01 +01:00
Bartosz Taudul
c999a74d34 Symbol length transfer. 2020-03-25 18:32:36 +01:00
Bartosz Taudul
c6bb08355c Allow specification of port through env variable. 2020-03-08 16:14:36 +01:00
Bartosz Taudul
1da62c2190 Send deferred lock names. 2020-03-08 15:05:35 +01:00
Bartosz Taudul
127224acc6 Send listen port in broadcast message. 2020-03-08 14:37:59 +01:00
Bartosz Taudul
14c896573d Separate config for data and broadcast port. 2020-03-08 14:34:09 +01:00
Bartosz Taudul
e7240cb77d Custom lock name transfer. 2020-03-08 13:47:38 +01:00
Bartosz Taudul
c36ed4b8b8 Boring warning fixes. 2020-03-01 01:48:20 +01:00
Bartosz Taudul
4346620afa No need to copy module name. 2020-02-27 13:45:39 +01:00
Bartosz Taudul
474383b656 Only copy symbol strings, if needed. 2020-02-27 13:17:26 +01:00
Bartosz Taudul
2df6f9068a Don't retrieve symbol name for address. 2020-02-27 12:58:01 +01:00
Bartosz Taudul
be5793987e Don't send symbol name. 2020-02-27 12:49:48 +01:00
Bartosz Taudul
26cee8acf0 Perform symbol information queries. 2020-02-26 22:35:15 +01:00
Bartosz Taudul
abf8c42a7c Send module name. 2020-02-26 00:33:09 +01:00
Bartosz Taudul
c5b2d14f8c Send sampling period in welcome message. 2020-02-25 23:12:31 +01:00
Bartosz Taudul
2b7f5091f1 Store sampling period. 2020-02-25 23:08:52 +01:00
Bartosz Taudul
3402d16548 Send symbol base address. 2020-02-25 23:03:40 +01:00
Bartosz Taudul
02d200878d Process queue data in-place. 2020-02-23 15:18:24 +01:00
Bartosz Taudul
96034bca3e Force inline AppendData(), NeedDataSize(). 2020-02-23 14:44:19 +01:00
Bartosz Taudul
e270603117 Don't write reference time to memory in each iteration. 2020-02-22 18:52:37 +01:00
Bartosz Taudul
054a6f8563 Send time deltas in callstack sample data packets. 2020-02-22 16:42:47 +01:00
Bartosz Taudul
1ee80e0df5 Send/free callstack sample payloads. 2020-02-22 16:20:43 +01:00
Bartosz Taudul
23fe3e623d 64-bit only version of callstack payload sender. 2020-02-22 14:05:01 +01:00
Bartosz Taudul
f186540c4f Fix callstack pointers in 32-bit builds. 2020-02-22 13:38:09 +01:00
Bartosz Taudul
838c0aaaa9 Check if BUS_MCEERR_AR and BUS_MCEERR_AO are defined. 2020-02-12 01:27:03 +01:00
Bartosz Taudul
2c8d519d70 Fix typo. 2020-02-11 15:12:06 +01:00
Bartosz Taudul
8d5f4d7363 Always use init once to initialize rpmalloc. 2020-01-30 20:08:34 +01:00
Bartosz Taudul
aa94df0845 Replace rpmalloc_thread_initialize with InitRPMallocThread(). 2020-01-25 17:16:08 +01:00
Bartosz Taudul
ab2fbd6164 Move ParamaterSetup() implementation to header. 2020-01-25 16:51:17 +01:00
Bartosz Taudul
a90004b983 Move Set/GetThreadName() to Tracy API. 2020-01-25 16:36:58 +01:00
Bartosz Taudul
55d03cb03e Hide async queue setup/commit behind macros. 2020-01-19 15:06:11 +01:00
Bartosz Taudul
25082b2bec Don't report CPU topology if delayed init is active.
Reporting topology requires producer to be available, which creates a
deadlock during delayed init data structures construction.

Calling GetProducer() results in a call to GetProfilerThreadData(),
which in turn calls GetProfilerData() to construct its thread local
variable. However, at this point we already are calling
GetProfilerData() (to construct the profiler itself). This would result
in an incorrect double construction of data, but the code already
prevents this by allowing init code to be entered only once. Hence the
deadlock.

Currently this is a non-issue, as no platform which can report CPU
topology needs to use delayed init.
2020-01-14 19:41:34 +01:00
Bartosz Taudul
129b80ef0f Free source location, if zone is not active. 2019-12-06 00:42:42 +01:00
Bartosz Taudul
b9cdf2cbb7 Expose srcloc allocation in C API. 2019-12-06 00:25:52 +01:00
Bartosz Taudul
399b87fecc Add allocated srcloc zone begin emit functions to C API. 2019-12-06 00:22:49 +01:00
Bartosz Taudul
e8fcc250a1 Report CPU topology on Linux. 2019-11-30 01:51:29 +01:00
Bartosz Taudul
712403e9fd Transfer, display, save CPU topology data. 2019-11-29 22:41:41 +01:00
Bartosz Taudul
59371eef5a Obtain CPU topology on windows. 2019-11-29 18:29:31 +01:00
Bartosz Taudul
a7d2d5f08b Fix DeferItem() call. 2019-11-26 01:10:50 +01:00
Bartosz Taudul
4551553eb4 Implement setting client parameters from server. 2019-11-25 23:59:48 +01:00
Bartosz Taudul
c5c9dfb0c9 Native callstacks are now optional in allocated callstack messages. 2019-11-25 22:54:10 +01:00
Bartosz Taudul
c79449a6a1 Get proper program name on BSD. 2019-11-21 02:16:12 +01:00
Bartosz Taudul
7940977dba Report physical memory size on BSD. 2019-11-21 02:14:08 +01:00
Bartosz Taudul
8286b0b72f Plumbing for message call stacks. 2019-11-14 23:40:41 +01:00
Bartosz Taudul
0befc75f83 Fix conflicts with X.h. 2019-11-14 18:24:29 +01:00
Bartosz Taudul
655864eb7c Enable crash handler on cygwin.
Crash is properly recorded, but the profiler hangs while waiting for
shutdown finish.
2019-11-07 19:20:13 +01:00
Bartosz Taudul
3fd74a92f9 Native threads are used on mingw. 2019-11-07 19:02:54 +01:00
Bartosz Taudul
351e220d30 Don't calculate queue delay if delayed init is used.
Queue calibration requires queue access during profiler construction. This
in turn requires construction of profiler data block, *which at this point
is underway*, because the profiler is being constructed.
2019-06-19 17:29:04 +02:00
Bartosz Taudul
c98f1f0b6b Make sure profiler is initialized only once in delayed init scenario. 2019-06-19 17:28:18 +02:00
Bartosz Taudul
b5590ed197 Include <mutex> for std::once. 2019-11-05 21:40:35 +01:00
Bartosz Taudul
3e9bb80217 More header cleanup. 2019-11-05 20:15:53 +01:00
Bartosz Taudul
ca0fae33d1 Remove obsolete assert.
Before-terminate-events now include events that have time delta
processing, with no memory to free.
2019-11-01 20:10:24 +01:00
Bartosz Taudul
1f0c18882c Don't collect sys time after application has exited. 2019-10-29 23:05:14 +01:00
Bartosz Taudul
0f2503d334 Send time deltas in GPU time events. 2019-10-25 19:52:01 +02:00
Bartosz Taudul
8fa5188176 Send delta times for context switches. 2019-10-25 19:13:11 +02:00
Bartosz Taudul
25b3cdc1ee Send thread wakeups when handling disconnect request. 2019-10-25 18:22:42 +02:00
Bartosz Taudul
04b132b6e2 Check if requested data size doesn't overflow buffer. 2019-10-24 21:22:22 +02:00
Bartosz Taudul
ba61a9ed84 Transfer time deltas, not absolute times.
This change significantly reduces network bandwidth requirements.

Implemented for:
- CPU zones,
- GPU zones,
- locks,
- plots,
- memory events.
2019-10-24 00:06:41 +02:00
Bartosz Taudul
07b66cd4ab Move fake source location out of loop. 2019-10-20 22:18:05 +02:00
Bartosz Taudul
909503403b Simplify delay calibration. 2019-10-20 22:13:29 +02:00
Bartosz Taudul
9e1935f070 Make C API symbols visible across dlls. 2019-10-03 22:39:26 +02:00