Profiling/pl: Difference between revisions

From FreeCAD Documentation
(Created page with "Następnie zainstaluj i użyj {{incode|pyprof2calltree}}, aby przekonwertować dane wyjściowe profilu na dane wejściowe cachegrind.")
(Created page with "* [https://docs.python.org/3/library/profile.html Profilery Python], {{incode|cProfile}} i {{incode|python}}. * [https://pypi.org/project/pyprof2calltree/ pyprof2calltree] w PyPI; [https://github.com/pwaller/pyprof2calltree/ pyprof2calltree] repozytorium. * [https://forum.freecadweb.org/viewtopic.php?f=10&t=44785 Poradnik profilowania FreeCAD w Python].")
 
(2 intermediate revisions by the same user not shown)
Line 25: Line 25:
}}
}}


Then visualize this information with {{incode|kcachegrind}} for Linux or {{incode|qcachegrind}} for Windows.
Następnie zwizualizuj te informacje za pomocą {{incode|kcachegrind}} dla systemu Linux lub {{incode|qcachegrind}} dla systemu Windows.
{{Code|code=
{{Code|code=
kcachegrind /tmp/callgrind.out
kcachegrind /tmp/callgrind.out
}}
}}


== Resources ==
<span id="Resources"></span>
==Zasoby==


* [https://docs.python.org/3/library/profile.html The Python profilers], {{incode|cProfile}} and {{incode|python}}.
* [https://docs.python.org/3/library/profile.html Profilery Python], {{incode|cProfile}} i {{incode|python}}.
* [https://pypi.org/project/pyprof2calltree/ pyprof2calltree] at PyPI; [https://github.com/pwaller/pyprof2calltree/ pyprof2calltree] repository.
* [https://pypi.org/project/pyprof2calltree/ pyprof2calltree] w PyPI; [https://github.com/pwaller/pyprof2calltree/ pyprof2calltree] repozytorium.
* [https://forum.freecadweb.org/viewtopic.php?f=10&t=44785 FreeCAD's Python profiling tutorial].
* [https://forum.freecadweb.org/viewtopic.php?f=10&t=44785 Poradnik profilowania FreeCAD w Python].


{{Powerdocnavi{{#translation:}}}}
{{Powerdocnavi{{#translation:}}}}

Latest revision as of 18:39, 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")

Następnie zainstaluj i użyj pyprof2calltree, aby przekonwertować dane wyjściowe profilu na dane wejściowe cachegrind.

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

Następnie zwizualizuj te informacje za pomocą kcachegrind dla systemu Linux lub qcachegrind dla systemu Windows.

kcachegrind /tmp/callgrind.out

Zasoby