From 39ce6f02a656928dfc7b68f768b97c39a06a37e5 Mon Sep 17 00:00:00 2001 From: Gorash Date: Thu, 9 Dec 2021 10:39:17 +0000 Subject: [PATCH] [IMP] Profiler: more QWeb directive informations in speedscope graph Part-of: odoo/odoo#81024 --- odoo/tools/profiler.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/odoo/tools/profiler.py b/odoo/tools/profiler.py index 838e813e634..988d8a34091 100644 --- a/odoo/tools/profiler.py +++ b/odoo/tools/profiler.py @@ -335,7 +335,21 @@ class QwebTracker(): def enter_directive(self, directive, attrib, xpath): execution_context = None if self.execution_context_enabled: - execution_context = tools.profiler.ExecutionContext(directive=directive, xpath=xpath) + directive_info = {} + if directive and ('t-' + directive) in attrib: + directive_info['t-' + directive] = repr(attrib['t-' + directive]) + if directive == 'set': + if 't-value' in attrib: + directive_info['t-value'] = repr(attrib['t-value']) + if 't-valuef' in attrib: + directive_info['t-valuef'] = repr(attrib['t-valuef']) + elif directive == 'foreach': + directive_info['t-as'] = repr(attrib['t-as']) + elif directive == 'options': + for key in list(attrib): + if key.startswith('t-options-'): + directive_info[key] = repr(attrib[key]) + execution_context = tools.profiler.ExecutionContext(**directive_info, xpath=xpath) execution_context.__enter__() self.context_stack.append(execution_context)