Skip to content

Instantly share code, notes, and snippets.

@Morendil
Created May 20, 2019 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Morendil/134544a4e11a06f345aa780649c03e7b to your computer and use it in GitHub Desktop.
Save Morendil/134544a4e11a06f345aa780649c03e7b to your computer and use it in GitHub Desktop.
class Frame:
def __init__(self, tracer):
self.tracer = tracer
def __enter__(self):
set things up
return thing
def __exit__(self, type, value, traceback):
self.tracer.pop()
class StackTracer
def frame():
return Frame(self):
def record_value(array):
pass
def record_start(time):
pass
def pop():
self.stack.pop()
class FullTracer
def __init__()
self.current_frame = None
def frame():
new_child = Frame(self)
return new_child:
def record_value(array):
self.current_frame.value = array
def record_start(time):
self.current_frame['start'] = time
def pop():
????
self.children.add()
FullTracer:
{
name:"salaire_imposable",
period:"2017",
start:200,
end:250,
free_memory_start:???,
free_memory_end:???,
status:'calc','cache','input',
children:[
{
name:"salaire_net",
period:"2017",
start:201,
end:250,
},
{
name:"param.toto",
period:"2017",
start:201,
end:250,
},
{
name:"csg",
etc.
}
]
}
=>
{
name:"salaire_imposable",
period:"2017",
value:50 (timing)
children:[
{
name:"salaire_net",
etc.
},
{
name:"csg",
etc.
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment