avec python cprofile, comment obtenir un arbre d'exécution ?
Private research annotation
Sign in to add a private research label or note.
- User
avec python cprofile, comment obtenir un arbre d'exécution ?
- Assistant
cProfilene génère pas directement un arbre d’exécution lisible (call tree), mais tu peux en obtenir un avec des outils complémentaires.Voici les options les plus courantes :
- Avec
pstats(basique, pas vraiment un arbre)
pythonimport cProfile import pstats cProfile.run("mon_script()", "out.prof") stats = pstats.Stats("out.prof") stats.sort_stats("cumulative").print_stats(20)→ Ça donne une vue plate, pas un vrai arbre.
- Avec
gprof2dot(recommandé pour un arbre visuel)
Installer :
bashpip install gprof2dotUtilisation :
bash - Avec
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.