Commit Graph

300 Commits

Author SHA1 Message Date
rdb 4b98910789 Use static storage instead of heap for forever-objects (squelches ASan) 2026-01-24 13:24:11 +01:00
rdb b275a72d0f pstats: Fix version check for ref tracing feature 2025-09-14 09:59:05 +02:00
rdb b32d5c6724 pstats: Enable ref tracing feature in Python 3.13.3+ as well
The fix to Python was backported here.
2025-09-05 09:59:44 +02:00
rdb cd791ca7fc pstats: Add new feature to count Python objects by type
This is useful for profiling cases where the number of Python objects is growing more than expected

Requires Python 3.14a6 and can be enabled with pstats-python-ref-tracer true
2025-09-04 16:29:15 +02:00
rdb d63f708e2c pstats: Actually support large frames (remove check)
Fixes #1574
2025-08-26 12:59:18 +02:00
rdb 3082d28fe8 pstatclient: Fix out-of-order events with thread profiling
It could generate an end/start pair on a thread that is waiting due to other threads in that sync group submitting a PStats frame for the whole sync group, which would cause out-of-order events
2025-01-22 22:17:56 +01:00
rdb 5106fc879f Changes for compatibility with Python 3.13
Includes some preliminary work to make free-threading safe, see also #1683
2024-09-19 16:01:10 +02:00
rdb 73360393df Switch use of Py_INCREF to new Py_NewRef function
This is more idiomatic, simplifies the code, makes it easier to port to eg. HPy later on, and makes it easier to use the limited ABI (where it can be optimized to a tail call) later on

A polyfill is provided for compatibility with Python versions 3.8 and 3.9
2024-01-29 17:57:53 +01:00
Disyer f596666b84 panda: Install correct config headers for pstatclient and putil
Closes #1525
2023-08-05 14:51:31 +02:00
rdb f0a4e61fd9 Revert "general: Add headers explaining the renamed config_*.h"
This reverts commit 47f7d3f297.

These header files have been deprecated for years and can be safely removed now.
2023-07-26 20:02:49 +02:00
rdb c3e9f1738e Merge branch 'release/1.10.x' 2023-06-13 13:45:51 +02:00
rdb 94ebd7c953 pstats: Fix exception when `__module__` is a descriptor
This comes up when using metaclasses

Fixes #1505
2023-06-12 09:54:25 +02:00
rdb 2157f1162e pstats: Proper thread cleanup after a thread exits (PStats 3.2)
The thread will linger around in the server as long as there is data (so, it will be removed after `pstats-history` seconds)

Fixes #450
2023-01-10 14:37:39 +01:00
rdb 2aa2a35a9f pstats: Fix regression: crash when opening session file 2022-12-26 11:18:00 +01:00
rdb e1b4083d6d Merge branch 'release/1.10.x' 2022-12-12 17:19:10 +01:00
rdb fb14c29525 pstats: Server can handle new protocol version 2.3
It changes the following things:
* Changes the counts in the PStatFrameData from uint16 to uint32, since I was hitting the value limit in some heavy frames with Python profiling enabled - no good reason for this limitation, so this allows removing it later
* Adds a T_expire_thread message, which I can use later to fix #450

These features are not used on the client side, but will be used on master.  Adding these changes here now makes it possible to use a master client with a 1.10.13 version of the server (can be useful if you can't compile Panda on the host).
2022-12-10 19:45:29 +01:00
rdb 3254c6d329 pstats: Optimize PStatFrameData (de-)serialization
This can be slow (hundreds of us, up to multiple ms) with large amounts of data points, this makes it an order of magnitude more efficient
2022-12-10 19:45:29 +01:00
rdb d48e23f234 pstats: Indicate how to disable rate limit 2022-12-10 19:45:26 +01:00
rdb 9784d46e95 pstats: Fix off-by-one error in frame number counting
The frame number for CPU frames was one ahead of the real one, which did show up correctly for GPU frames
2022-12-07 14:42:29 +01:00
rdb 59eb1510b9 pstats: Fix compilation without HAVE_THREADS or with SIMPLE_THREADS 2022-12-04 19:26:22 +01:00
rdb 0866d485b1 pstats: Set default value for `pstats-max-queue-size` to 4
Otherwise any multithreaded application is dropping frames like mad, since the packets for different frames may be added to the same queue at roughly the same time.
2022-12-04 16:57:55 +01:00
rdb bb530435e8 pstats: Offload more work to separate PStats thread
This improves performance of PStats client when a lot of data is being sent per frame.

Also increase the value of pstats-max-queue-size, since otherwise we're constantly dropping frames when using multiple threads.
2022-12-03 22:27:46 +01:00
rdb 76677e5c00 pstats: Deprecate `PStatClient::resume_after_pause()`
It creates a clock skew in the PStats timing information that cannot be corrected for in the server.  If we want to bring this back, we should either have a global `pause()` and `resume()` (so we can properly pause collection in the meantime, and have a time to reset to, but we'd need to think about how to handle threading) or we should add a `drop_frame()` to drop the current frame.  If we must bring it back in its current form, then we need to communicate the clock reset to the server, so that it can properly take it into account.
2022-12-02 22:19:43 +01:00
rdb a5610f217e Merge branch 'release/1.10.x' into incoming 2022-11-29 20:58:51 +01:00
rdb 867f60dcca pstats: Rename "Show code" collector to "Tasks"
Also remove outdated definitions from pStatProperties.cxx
2022-11-29 20:50:18 +01:00
rdb adc324bbde pstats: Fix assorted compile issues in more esoteric configurations 2022-11-29 20:11:59 +01:00
rdb 50cfdebd9c pstats: Integrate Python profiler with PStats
Enabled with `pstats-python-profiler 1`, requires recent version of PStats server.

Currently, it is limited to the main thread only.  Support for other threads may be added at a later date.
2022-11-29 16:00:09 +01:00
rdb 7b9f2cd854 pstats: Support nested start/stop pairs in the server, accept 3.1
Currently, the client doesn't send nested start/stop pairs, but there is no good reason not to handle this case in the server, and in some cases it is useful to send them (I will soon make changes on master to take advantage of this).

Client version 3.1 indicates that the client may send nested start/stop pairs.
2022-11-29 15:48:02 +01:00
rdb bb6976d558 pstats: Third significant update to PStats server UI, including:
* Windows stay open after client disconnects, for further inspection
* Ability to save session results to a file, and reopening those files
* Ability to save the current graph window layout for new sessions
* Ability to change colors (by right-clicking on bar)
* SI prefixes for Hz units (kHz, MHz, etc.)
* Ability to export session to Chrome Tracing JSON format
* "Close All Graphs" menu option
* Graphs now properly show data when opened while Pause is on
* Some fixes for weird graph window minimize behavior on Windows
2022-10-05 18:58:36 +02:00
rdb a0be50c769 general: Fix assorted compiler warnings 2022-03-01 16:09:07 +01:00
rdb fd033e66f1 pstats: Add support for profiling thread context switches
Disabled by default, enable with `pstats-thread-profiling true` in Config.prc
2022-02-22 18:02:39 +01:00
rdb 759115fbc7 pstats: Fix crash when frame has only level data and no time data 2022-02-22 15:25:04 +01:00
rdb 0a3733ccb9 pstats: GPU timing improvements; use same frame numbering everywhere
Timer queries are significantly more efficient, are synchronized to CPU time, and the synchronized frame numbering makes it possible to correlate stuff in the Timeline view
2022-02-20 17:33:40 +01:00
rdb d7bbcfb0b7 pstats: Some collector reorganisation:
- "App:Show code:General" is gone, it was causing too much trouble
- Replace odd "Client::GuiObjects" with "Nodes:GUI"
- Regroup "Dirty PipelineCyclers" underneath "PipelineCyclers"
2022-02-17 12:48:36 +01:00
rdb 93b7ebffaa pstats: PStatClient.connect() should wait for UDP connection to be established
This makes the behavior of PStats more predictable, reducing missed frames at the beginning
2022-02-17 12:48:36 +01:00
rdb cf9574b412 pstats: Add convenience method for ticking current thread only 2022-02-17 12:48:36 +01:00
rdb 355cd5b4cd pstats: Remove unused field from PStatClient::InternalThread 2022-02-07 17:03:58 +01:00
rdb 77b0d2d6a7 pstats: Switch from AtomicAdjust to C++11-style atomics 2022-02-07 17:02:30 +01:00
rdb c66ca2ece1 pstats: Report PStats overhead more honestly
Half the overhead was being missed due to the unfortunate collector placement
2022-01-30 02:03:18 +01:00
rdb c7c1c683da pstats: Disable "App:Show code:General" collector for now
It is generating negative values, needs further investigation - maybe we need to restructure the whole hierarchy
2022-01-30 02:03:18 +01:00
rdb 36edb22fd1 pstats: Include client pid with hello message
Useful for uniquely identifying the process in a situation where multiple clients on the same host connect with the same server.

New version bump is not necessary, as old servers should just ignore the extra field in the datagram.
2022-01-30 02:03:18 +01:00
rdb e83657f70f pstatclient: Prevent crash when using uninitialized PStatCollector 2020-11-02 11:02:49 +01:00
rdb c59b91f503 Merge branch 'release/1.10.x' 2020-02-23 14:53:16 +01:00
kamgha c2866ea4ed Fix includes for Windows on case-sensitive filesystems
Closes #866
2020-02-22 12:55:45 +01:00
Leandro (Cerberus1746) Benedet Garcia 5f7809469c general: removed all WIN32, WIN32_VC and friends 2020-02-05 22:45:03 -07:00
Sam Edwards 9b7bcf2564 Merge branch 'master' into cmake 2019-11-07 21:21:04 -07:00
rdb dae762f52b pstatclient: fix compile error when compiling without DO_PSTATS 2019-10-25 10:24:30 +02:00
Sam Edwards 12c16eb9ff Merge branch 'master' into cmake 2019-10-15 23:43:25 -06:00
rdb 08572f3c38 general: Fix a variety of ABI incompatibility issues with opt4 builds 2019-10-08 19:44:29 +02:00
Sam Edwards 5961cc2ee0 Merge branch 'master' into cmake 2019-10-05 15:00:49 -06:00