bgdev.tools.performance

Evaluation Toolkit.

created

03/06/2019

author

Benoit GIELLY <benoit.gielly@gmail.com>

class Profiler[source]

Bases: object

Create a python profiler to check for code usage.

Example

import bgdev.tools.performance
profiler = bgdev.tools.performance.Profiler()
profiler.start()
# run python code
profiler.stop()
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

start()[source]

Enable the profiler.

stats(sort='tottime')[source]

Print the profiler stats.

Parameters

sort (str) – Sort the stats with given value.

stop(sort='time')[source]

Stop the profiler and print restult.

Parameters

sort (str) – Sort the stats with given value.

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