Beispiel #1
0
    def test_profile(self):
        prof = Profiler()
        prof.start()
        try:
            Tester1().t1()
        finally:
            prof.done()

        self.assertNotEqual(os.path.getsize('python-profiler-result.jandy'), 0)
        with open("python-profiler-result.jandy", "r") as file:
            trans = TFileObjectTransport(file)
            context = ProfilingContext()
            context.read(TJSONProtocol(trans))

        print(context)
        self.assertIsNotNone(context.root)
Beispiel #2
0
def profilingContext(roots):
    context = ProfilingContext()
    context.nodes = nodes
    context.methods = methods.values()
    context.classes = classes.values()
    context.exceptions = exceptions

    context.root = TreeNode(id=str(uuid.uuid4()), childrenIds=[])

    for n in roots:
        if n.childrenIds is not None and len(n.childrenIds) > 0:
            context.root.childrenIds.append(n.childrenIds[0])
    return context
Beispiel #3
0
def profilingContext(roots):
    context = ProfilingContext()
    context.nodes = nodes
    context.methods = methods.values()
    context.classes = classes.values()
    context.exceptions = exceptions

    context.root = TreeNode(id=str(uuid.uuid4()), childrenIds=[])

    for n in roots:
        if n.childrenIds is not None and len(n.childrenIds) > 0:
            context.root.childrenIds.append(n.childrenIds[0])
    return context