Profilage

From FreeCAD Documentation
Revision as of 20:16, 12 August 2020 by David69 (talk | contribs) (Created page with "Le profilage du code de FreeCAD permet de trouver des goulots d'étranglement dans les algorithmes utilisés pour créer ou manipuler des objets.")
Other languages:

Description

Le profilage du code de FreeCAD permet de trouver des goulots d'étranglement dans les algorithmes utilisés pour créer ou manipuler des objets.

To profile Python code use the standard cProfile module to define start and end points to profile in the code.

import cProfile
pr = cProfile.Profile()
pr.enable()

# --------------------------------------
# Lines of code that you want to profile
# --------------------------------------

pr.disable()
pr.dump_stats("/tmp/profile.cprof")

Then install and use pyprof2calltree to convert the profile output into cachegrind input.

pyprof2calltree -i /tmp/profile.cprof -o /tmp/callgrind.out

Then visualize this information with kcachegrind for Linux or qcachegrind for Windows.

kcachegrind /tmp/callgrind.out

Resources