bgdev.tools.performance¶
Evaluation Toolkit.
- created
03/06/2019
- author
Benoit GIELLY <benoit.gielly@gmail.com>
-
class
Profiler
(timer=True, stats=True, sort='tottime', depth=8)[source]¶ Bases:
object
Create a python profiler to check for code usage.
Example
from bgdev.tools.performance import Profiler() # use as an instanciated object profiler = Profiler() profiler.start() >>> run python code profiler.stop() # use as a context manager with Profiler(sort="tottime", depth=10) as profiler: >>> run code # print stats profiler.stats("cumulative", depth=10)
-
__init__
(timer=True, stats=True, sort='tottime', depth=8)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
-
frames_per_second
(iterations=3, start=1001, frames=100, viewports='viewport2', meshes_only=True, outfile=None)[source]¶ Evaluate the framePerSecond in the current scene.
- Parameters
iterations (int) – Amount of time the timeline should run.
start (int) – Start frame.
frames (int) – The amount of frames to run.
viewports (list) – Select the viewports you want to evaluate on. Possible values are “legacy” and “viewport2”.
meshes_only (bool) – Hides everything but meshes in the viewport.
outfile (bool or str) – Save the output fps in the given txt file. If True is passed, query the current scene path and save the log next to it (Useful when benchmarking multiple scenes in a loop).
- Returns
The evaluated frame per seconds as a float number.
- Return type
float