|
@@ -30,6 +30,8 @@
|
|
|
|
|
|
import modelverse_jit.source_map as source_map
|
|
|
|
|
|
+PROFILING = True
|
|
|
+
|
|
|
NOP_LITERAL = None
|
|
|
"""A literal that results in a nop during which execution may be interrupted
|
|
|
when yielded."""
|
|
@@ -455,6 +457,8 @@ class ReturnInstruction(VoidInstruction):
|
|
|
"""Generates Python code for this instruction."""
|
|
|
if self.value.has_definition():
|
|
|
self.value.generate_python_def(code_generator)
|
|
|
+ if PROFILING:
|
|
|
+ code_generator.append_line("print('%s : %s' % (___profiling[1], time.time() - ___profiling[0]))")
|
|
|
code_generator.append_line(
|
|
|
'raise PrimitiveFinished(' +
|
|
|
self.value.generate_python_use(code_generator) +
|
|
@@ -1238,6 +1242,9 @@ class DefineFunctionInstruction(VariableInstruction):
|
|
|
code_generator.append_line('def %s(%s):' % (
|
|
|
code_generator.get_result_name(self), ', '.join(self.parameter_list)))
|
|
|
code_generator.increase_indentation()
|
|
|
+ if PROFILING:
|
|
|
+ code_generator.append_line("import time")
|
|
|
+ code_generator.append_line("___profiling = (time.time(), '%s')" % self.name)
|
|
|
self.body.generate_python_def(code_generator)
|
|
|
code_generator.decrease_indentation()
|
|
|
|