Commit Graph

171 Commits

Author SHA1 Message Date
Bartosz Taudul
5437185858
Decrease sampling worker sleep time from 10 to 1 ms. 2022-06-16 14:31:47 +02:00
Bartosz Taudul
d99024dd02
Run sampling worker thread at max priority. 2022-06-16 14:24:11 +02:00
Bartosz Taudul
8383682306
Emit warning if priority change failed. 2022-06-16 14:23:42 +02:00
Bartosz Taudul
2240fd3b0c
Remove invalid assert.
The original intention was to ensure that either a ring buffer with data was
selected (sel >= 0 ), or there is no data left to process (activeNum == 0).
However, in an unlikely case that all ring buffers contain a PERF_RECORD_LOST
event, it is possible for the assert to fail, as there may still be data in
buffers, but at the same time no buffer would be selected. Buffer processing
advances the data pointers, so in the next loop iteration the results may be
different.
2022-06-16 14:07:51 +02:00
Bartosz Taudul
aee8336847
Move ring identifier check out of the loop. 2022-06-16 13:48:15 +02:00
Bartosz Taudul
145e3e213a
Move ring identifier extraction out of loop. 2022-06-16 13:39:07 +02:00
Honeybunch
80a9865bbf Making mingw check more explicit 2022-05-10 17:30:59 -07:00
Honeybunch
45bd17b7e8 Slight tweak to get client library working with mingw 2022-05-03 18:31:49 -07:00
Bartosz Taudul
2ef014608f
Notify when software sampling setup has failed. 2022-04-29 19:13:40 +02:00
Bartosz Taudul
7493663e13
It's Debian, it's always Debian.
/usr/lib/gcc/x86_64-linux-gnu/9/include/cpuid.h:223:1: error: redefinition of ‘unsigned int __get_cpuid_max(unsigned int, unsigned int*)’
In file included from ../../client/TracyProfiler.cpp:108,
                 from ../../TracyClient.cpp:23:
/usr/lib/gcc/x86_64-linux-gnu/9/include/cpuid.h:223:1: note: ‘unsigned int __get_cpuid_max(unsigned int, unsigned int*)’ previously defined here
2022-04-26 22:19:32 +02:00
Bartosz Taudul
95cf143336
Remove unused variables. 2022-04-26 22:01:09 +02:00
Bartosz Taudul
066c266df9
Add missing includes. 2022-04-26 22:01:09 +02:00
Bartosz Taudul
3d28d1259b
Check if ring buffer was properly mapped. 2022-04-04 17:56:40 +02:00
Benoit Jacob
5eb3e3a1f0 set s_numCpus before reading it 2022-03-24 18:31:38 +00:00
Bartosz Taudul
46d2977694
prev_state is long. 2022-02-14 22:34:20 +01:00
Bartosz Taudul
f058ad01fc
Don't process ring buffers when not connected in on-demand mode. 2022-01-31 20:53:10 +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
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
Bartosz Taudul
14cdf3d43e
Use perf_event_open for context switch tracking. 2021-12-05 12:02:28 +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
Bartosz Taudul
97c519811c
Capture context switch call stacks on Windows. 2021-11-12 12:22:29 +01:00
Bartosz Taudul
8b15cd049c
Skip comparing known to be matching memory. 2021-10-30 01:26:31 +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
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
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
7e1622083e
Use monotonic raw clock for hardware sampling. 2021-06-19 13:40:31 +02:00
Bartosz Taudul
6d03b18d1c
Don't filter out kernel frames on win32. 2021-06-15 01:40:21 +02:00
Bartosz Taudul
698e5f0210
Probe precise_ip for software sampling. 2021-06-13 01:21:09 +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
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
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
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
cfb6d0d2ae
Timestamp conversion might be temporarily unavailable. 2021-05-23 20:32:09 +02:00
Bartosz Taudul
233a0bb6d6
Set precise_ip to 0 for cache on Intel.
Fuck knows how this is supposed to work. perf_event_open() opens the
descriptor successfully, but it produces no samples, if precise_ip is not 0.
There are no such problems on ARM (where precise_ip is 3, but maybe it is not
supported at all on that architecture, again, fuck knows if), and on AMD
perf_event_open() does not succeed when precise_ip > 0.
2021-05-23 19:45:13 +02:00