Profiling/pl: Difference between revisions

From FreeCAD Documentation
(Created page with "Profilowanie kodu FreeCAD pomaga znaleźć wąskie gardła w algorytmach używanych do tworzenia lub manipulowania obiektami.")
(Created page with "Do profilowania kodu Python należy użyć standardowego modułu {{incode|cProfile}}, aby zdefiniować punkty początkowe i końcowe do profilowania w kodzie.")
Line 6: Line 6:
Profilowanie kodu FreeCAD pomaga znaleźć wąskie gardła w algorytmach używanych do tworzenia lub manipulowania obiektami.
Profilowanie kodu FreeCAD pomaga znaleźć wąskie gardła w algorytmach używanych do tworzenia lub manipulowania obiektami.


To profile [[Python|Python]] code use the standard {{incode|cProfile}} module to define start and end points to profile in the code.
Do profilowania kodu [[Python/pl|Python]] należy użyć standardowego modułu {{incode|cProfile}}, aby zdefiniować punkty początkowe i końcowe do profilowania w kodzie.
{{Code|code=
{{Code|code=
import cProfile
import cProfile

Revision as of 18:37, 31 January 2024

Opis

Profilowanie kodu FreeCAD pomaga znaleźć wąskie gardła w algorytmach używanych do tworzenia lub manipulowania obiektami.

Do profilowania kodu Python należy użyć standardowego modułu cProfile, aby zdefiniować punkty początkowe i końcowe do profilowania w kodzie.

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