[Stackless] profile error, again

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Jan 30 15:13:18 CET 2008


Hm, is there still no one taking the bait?

I've made the repro case simpler still.  Try this on for size:

import stackless
import sys

def profile(*args): pass
def tasklet(): sys.setprofile(profile)
t = stackless.tasklet(tasklet)
t()
t.run()

From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Kristján Valur Jónsson
Sent: Monday, January 28, 2008 10:27
To: Stackless mailing list
Subject: [Stackless] profile error, again

Okay, I've managed to simplify this a bit.

Run the attached program and watch stackless get confused.

The point is that I am fiddling with sys.setprofile() in the context switch callback.
I do this for a reason:  I assume that this is a global state, and I want to temporarily turn off profiling in this function because I am doing task switch bookkeeping for the profiler.

Let me repeat the issues that need solving:

1)      stackless shouldn't freak out at this.  Some frames are obviously being rescheduled or something.

2)      I need to be able to turn on profiling for all tasklets, as a global state, to snapshot a running program.

3)      the sys.setprofile() and stackless. set_schedule_callback do not return the previous value so it is impossible to temporarily set/unset them and then restore them.

For 2), I am thinking about adding a flag to stackless, stackless.tracing or something, to enable the old (thread) global behaviour.
For 3) I think the change should be straightforward.  I don't understand why sys.setprofile() isnt't this way already.

K

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20080130/8211e1c4/attachment.htm>


More information about the Stackless mailing list