Profilieren

From FreeCAD Documentation
Revision as of 21:06, 22 August 2020 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Beschreibung

Die Profilerstellung im Code von FreeCAD hilft, Flaschenhälse in den Algorithmen zu finden, die zur Erstellung oder Manipulation von Objekten verwendet werden.

Um Python Code zu profilieren, verwende das Standardmodul cProfile, um Start und Endpunkte des Profils im Code zu definieren.

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

Ressourcen