you need to pass the locals / globals dict and pass the first argument that you usually type for example.
cProfile.runctx("self.profileCommand(100)", globals(),locals())
use something like this
class A(object):
def performProfile(self):
import cProfile
cProfile.runctx("self.profileCommand(100)", globals(),locals())
def profileCommand(self, a):
for i in xrange(a):
pass
print "end."
A().performProfile()
and do not call the entire user interface in the profile, the profile of a particular function or calculation
source
share