Commit Graph

159 Commits

Author SHA1 Message Date
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
Bartosz Taudul
b2d5fe8e1f
Reduce sampling frequency. 2021-05-23 19:03:11 +02:00
Bartosz Taudul
b1e4d16537
PIDs are no longer needed in samples. 2021-05-23 19:00:45 +02:00
Bartosz Taudul
bbd1c4505c
Restrict perf to return events only for the current PID. 2021-05-23 18:53:09 +02:00
Bartosz Taudul
4ad6f682c8
Exclude VM-related stuff. 2021-05-23 18:44:16 +02:00
Bartosz Taudul
fece23a32b
Set frequency, not period.
This enables sampling on ARM dev board.
2021-05-23 18:02:06 +02:00
Bartosz Taudul
7d3119cbac
Remove irrelevant flag. 2021-05-23 18:01:18 +02:00
Bartosz Taudul
34ca6d865e
Sample branches and cache more frequently. 2021-05-22 02:28:32 +02:00
Bartosz Taudul
c7026cbc1f
Reduce hw sample period. 2021-05-22 02:27:34 +02:00
Bartosz Taudul
089eda0be9
Precise_ip should be shared in each pair of counters. 2021-05-22 02:16:49 +02:00
Bartosz Taudul
8ec08465ee
Add debug messages to perf event setup. 2021-05-21 01:47:45 +02:00
Bartosz Taudul
4d668741eb
Probe for acceptable precise_ip value.
This is stupid, but it's exactly what perf does... Sigh.
2021-05-21 01:33:37 +02:00
Bartosz Taudul
bcb7b94272
Tid is not needed. 2021-05-20 02:39:22 +02:00