This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ysj.ray
Recipients ajaksu2, dbrueck, georg.brandl, nedbat, tim.peters, ysj.ray
Date 2010-07-29.03:55:17
SpamBayes Score 0.021798259
Marked as misclassified No
Message-id <1280375721.53.0.521181741583.issue231540@psf.upfronthosting.co.za>
In-reply-to
Content
I don't think this problem still exists now. In the current implementation, there is no "sys_tracefunc" and "sys_profilefunc" in PyThreadState, but "c_profilefunc", "c_profileobj", "c_tracefunc", "c_traceobj" instead. When creating a new thread, the "c_profilefunc" and "c_tracefunc" are inherited from main thread, and the profile function is thread specific, it only collect profile statistic of the executing functions in its own thread, that is, each thread can profile its own executing.


I'd change the example as follows:



def child():
    def yo():
        for j in range(5):
            print(j)
    profile.runctx('yo()', globals(), locals())


def go():
    threading.Thread(target=child).start()
    time.sleep(1)

profile.runctx('go()', globals(), locals())



This will output two profile statistics, one is for main thread, another is for child thread: child(). So if you want to profile a child thread, just call profile.run() in child thread. 

So I don't think this is a problem.
History
Date User Action Args
2010-07-29 03:55:21ysj.raysetrecipients: + ysj.ray, tim.peters, georg.brandl, dbrueck, ajaksu2, nedbat
2010-07-29 03:55:21ysj.raysetmessageid: <1280375721.53.0.521181741583.issue231540@psf.upfronthosting.co.za>
2010-07-29 03:55:19ysj.raylinkissue231540 messages
2010-07-29 03:55:17ysj.raycreate