Commit Graph

851 Commits

Author SHA1 Message Date
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
Bartosz Taudul
65314e0c90 Set proper SymbolData contents on symbol retrieval error. 2020-06-04 17:46:39 +02:00
Graydon Hoare
28a29d071f
only write SysTime::used if fscanf succeeds 2020-06-03 19:54:49 -07:00
Graydon Hoare
93b7b5a8e7
ensure regs is initialized even if cpuid fails 2020-06-03 19:54:48 -07:00
Bartosz Taudul
54eb75b063 Report symbol entry address in inline function discovery. 2020-05-30 15:38:59 +02:00
Bartosz Taudul
2b304581cf Implement transfer of integral values for zones. 2020-05-24 16:13:09 +02:00
Bartosz Taudul
1bcde1f2ff Only one branch. 2020-05-24 13:41:41 +02:00
kudansam
1151ec1328 Fix defines when compiling with -Werror=undef
Some ARM defines fail when compiling with -Werror=undef as they rely on
the missing define mapping to 0.
2020-05-22 15:48:59 +02:00
Thales Sabino
c2c234cf5a Fix crash when running Tracy from DLLs
Instantiating Tracy from within a DLL will tie its internal threads life-time to the DLL. Windows does not guarantee
that threads will be alive after the main function. This has implications in the Profiler dtor since will try to perform
some deallocations, however, _memory_deallocate_large will try to get the heap of the current thread which can
be invalid at the point of shutdown causing a crash. Checking the pointer here will won't make TRACE_NO_EXIT
work, but it will prevent the Profiler from crashing.
2020-05-21 14:26:29 +01:00
Bartosz Taudul
4eb78f5c86 Auto-initialize profiler in delayed init scenario. 2020-05-19 13:55:54 +02:00
Bartosz Taudul
fad7e72fd4 Harden against uninitialized rpmalloc.
Initialize rpmalloc either by explicitly calling InitRPMallocThread(),
or by forcing initialization of thread local variables block.
2020-05-19 13:51:11 +02:00
Bartosz Taudul
665c6d6699 Don't check for allocation validity.
Will fail anyway right afterwards, if nullptr.
2020-05-16 16:40:25 +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
91bb392678 Avoid executing strlen() twice in assert-enabled builds. 2020-05-10 15:55:12 +02:00
txfx
412d252eea Remove extra semicolons at the end of namespaces 2020-05-10 15:32:39 +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
Rokas Kupstys
04eaf358d0 Fix linking error in some configurations. Unresolved CallTrace symbol was observed in static MSVC RelWithDebInfo build (but not in debug build). 2020-05-05 13:23:46 +03:00
ikrima
707117c04f Build sanitization & Static analysis warning fixes
- Wrapping FORCEINLINE & WIN32_LEAN_AND_MEAN definess with ifndef bc other libraries may define it and trigger redefinition warning
- Possibly contentious given tone in the manual (:P) but removing variable shadowing in TracySysTrace.cpp
  - Alternate Solution: Add #define TRACY_FORCE_SILENT_WARNINGS toggle-able flag. If flag is enabled, push/pop warning disables that have to be included in client code
2020-05-02 14:52:57 -07: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
a2187565d1 Optimize non-native-size memcpy. 2020-04-13 13:45:21 +02:00
Bartosz Taudul
b69aaf04e9 Add support for QPC timer. 2020-04-07 22:01:31 +02:00
Bartosz Taudul
34b512d04b Don't declare unused variables on cygwin. 2020-04-07 21:41:12 +02:00
Bartosz Taudul
8d9a611874 Get rid of unicode ifdefs. 2020-04-07 21:35:37 +02:00
Bartosz Taudul
69c5e667ae Dynamically load Get/SetThreadDescription. 2020-04-07 21:33:03 +02:00
Bartosz Taudul
7fca642c3d Compress full-quality DXT1 on AVX2 path. 2020-04-05 17:10:43 +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
0ba0125eb5 Cosmetics. 2020-04-01 21:42:14 +02:00
Bartosz Taudul
a8e8a4a167 Add code address to function, line decoder. 2020-04-01 21:41:33 +02:00
Bartosz Taudul
36ddd0b98b Don't use new to allocate memory on the client. 2020-03-28 21:27:19 +01:00
Bartosz Taudul
9b8eb69886 Apparently sampled call stacks may be empty. 2020-03-28 16:09:44 +01: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
d47e6819a8 Collect symbol sizes. 2020-03-25 18:28:28 +01:00
Bartosz Taudul
6c0c508280 Ignore kernel-only stacks.
It is common to receive duplicate stack traces for the same timestamp
(and thread), one containing proper user-space stack, and the second one
containing only kernel frames. Discard the second one, as there's no
documentation how this should be interpreted and the kernel stack is
mostly useless.
2020-03-21 15:25:30 +01:00
Bartosz Taudul
c7afda2562 Exit processing loops when trace has stopped. 2020-03-10 18:56:49 +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
2ffaa88c9e Fix typo. 2020-03-08 14:19:08 +01:00
Bartosz Taudul
e7240cb77d Custom lock name transfer. 2020-03-08 13:47:38 +01:00
Bartosz Taudul
f945278959 Fix rpmalloc on android. 2020-03-02 17:10:47 +01:00
Bartosz Taudul
c36ed4b8b8 Boring warning fixes. 2020-03-01 01:48:20 +01:00
Bartosz Taudul
c23984dd6a Fix static assert in rpmalloc. 2020-03-01 01:31:31 +01:00
Bartosz Taudul
e9a32d5dc7 Greatly increase queue block size.
Previous block size could hold only 256 elements (8KB), which stressed
out the memory allocator. Storing 65536 elements (2MB) per block almost
completely reduces the allocator pressure.
2020-03-01 01:15:13 +01:00
Bartosz Taudul
82f463724c Update rpmalloc to 1.4.0.
Notable changes: use C++11 atomics everywhere.
2020-03-01 01:02:25 +01:00
Bartosz Taudul
710a2a64e4 Fix copy pasta. 2020-02-27 14:08:56 +01:00
Bartosz Taudul
4346620afa No need to copy module name. 2020-02-27 13:45:39 +01:00
Bartosz Taudul
fd8a9465d4 Cosmetics. 2020-02-27 13:40:41 +01:00
Bartosz Taudul
9ae71ac4ee Dl_info doesn't destroy data. 2020-02-27 13:28:45 +01:00
Bartosz Taudul
5f6b3d2cd5 No need for module name intermediate buffer. 2020-02-27 13:24:36 +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
56dce646cc Symbol address decoding on unix. 2020-02-26 23:38:04 +01:00
Bartosz Taudul
4ddafdeeaf Symbol address decoding for old androids. 2020-02-26 23:24:18 +01:00
Bartosz Taudul
7c506d5426 Remove unused variables. 2020-02-26 23:24:11 +01:00
Bartosz Taudul
26cee8acf0 Perform symbol information queries. 2020-02-26 22:35:15 +01:00
Bartosz Taudul
ef05570540 Symbol address decoding (win32 implementation). 2020-02-26 22:32:42 +01:00
Bartosz Taudul
03ff08a934 Increase max name size. 2020-02-26 22:32:09 +01:00
Bartosz Taudul
d1fcf80c2d Move definition of max symbol name size to one place. 2020-02-26 22:30:11 +01:00
Bartosz Taudul
c0f49c648b Validate size. 2020-02-26 22:27:10 +01:00
Bartosz Taudul
890cec9872 Retrieve symbol addresses on unix. 2020-02-26 02:25:45 +01:00
Bartosz Taudul
9231261d73 Retrieve image name on unix. 2020-02-26 02:11:51 +01:00
Bartosz Taudul
fe80a7ed46 Retrieve symbol address on old androids. 2020-02-26 02:06:44 +01:00
Bartosz Taudul
abf8c42a7c Send module name. 2020-02-26 00:33:09 +01:00
Bartosz Taudul
7d0dac9ae2 Store callstack frame module name. 2020-02-26 00:32:47 +01:00
Bartosz Taudul
4cf520db93 Unify copying symbol strings. 2020-02-26 00:02:30 +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
85ffe0ea04 Don't search module list for kernel addresses. 2020-02-24 23:04:53 +01:00
Bartosz Taudul
ece32b47df Zero capacity is invalid. 2020-02-24 23:04:53 +01:00
Bartosz Taudul
9c9e854005 Replace list with vector.
Maybe next time let's not forget that there's already a custom
allocating vector available.
2020-02-24 23:04:53 +01:00
Bartosz Taudul
24cd73e366 Fix linux tracing with long pids. 2020-02-23 18:23:53 +01:00
Bartosz Taudul
0fa1d25d98 Disable trace annotations. 2020-02-23 18:20:48 +01:00