I know Odoo from version 15 has implemented profiling from the UI. is there any way to use profiling on the functions with @profile decorator?
To pytanie dostało ostrzeżenie
1
Odpowiedz
1047
Widoki
Hi,
You can use `import cProfile` to import cProfile tool and then
def you_func(self):
pr = cProfile.Profile()
pr.enable()
# you logic
pr.disable()
pr.print_stats(sort='ncalls')
Now in your Run window you can see the stats and profile your function. You can use the `sort` parameter to sort your result.
Hope it helps
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się