My goal is to profile just some functions in a while loop, into ONE output. For convenience let's say these functions are in one class.
Say I have the following code, just two separate classes accessed in a while loop:
class MyClass1:
def func1(self):
#stuff
class MyClass2:
def func1(self):
#stuff
count = 0
while count < 100
count += 1
c1 = MyClass1()
c1.func1()
c2 = Myclass2()
c2.func1()
Obviously these are just examples. In real life each class will have hundreds of methods, there will be many more classes created in the while loop, and count could be up to one million.
I want to profile the functions/methods of class2, not class1, in one nice, readable output (whether file or console). Other Stack Overflow answers do not do this.
Doing profiling a method of a class in Python using cProfile? and How can you profile a script? will print 100+ separate outputs.
how can I profile class methods of my python app? seems to ask the same question but the answer is incomplete.
PyCharm's profile will profile everything, drowning the output I want, and saying the functions I want to profile take 0.000 seconds
Any help is appreciated.