File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,17 @@ not mean you need to abandon Python and rewrite all your code in C++ for that
2020single bottleneck. Only that single function or class can be ported to C++ and
2121called from your Python code.
2222
23+ To determine whether it is the Python code that is slowing down an application,
24+ you should :ref: `use PStats <measuring-performance-with-pstats >`. As of Panda3D
25+ version 1.10.13, you can set the ``pstats-python-profiler `` Config.prc variable
26+ to get a detailed view of how much time each Python module, class and function
27+ is taking up. To access this view, in the Frame strip chart, double-click the
28+ App collector on the left side, then double-click the Python collector. Then,
29+ you can drill down further into the packages, modules, classes and functions.
30+
31+ .. image :: pstats-python-time.png
32+ :width: 1005
33+
2334Before considering writing any C++ code, consider other options:
2435
2536- See if you can optimize your code. The Python website has a
Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ the profiling machine:
7575
7676 .. only :: python
7777
78+ Profiling Python Code
79+ ~~~~~~~~~~~~~~~~~~~~~
80+
7881 If you are developing Python code, you may be interested in reporting the
7982 relative time spent within each Python task (by subdividing the total time
8083 spent in Python, as reported under "Show Code"). To do this, add the
@@ -94,8 +97,12 @@ the profiling machine:
9497
9598 pstats-python-profiler 1
9699
97- Caveats
98- ~~~~~~~
100+ To access this view, in the Frame strip chart, double-click the App collector
101+ on the left side, then double-click the Python collector. Then, you can drill
102+ down further into the packages, modules, classes and functions.
103+
104+ Profiling GPU Time
105+ ~~~~~~~~~~~~~~~~~~
99106
100107OpenGL is asynchronous, which means that function calls aren't guaranteed to
101108execute right away. This can make performance analysis of OpenGL operations
You can’t perform that action at this time.
0 commit comments