简体   繁体   中英

Stackless Python - profile single tasklet execution time

In my server written in Stackless Python, I occasionally am getting large spikes in CPU usage for 5-10 seconds durations. This happens sporadically so I'm having trouble tracking it down.

I've used cProfile to try and determine where these spikes are coming from but cProfile gives an overall picture of where time is being spent per function. What I would really like to know is whether the CPU spikes are due to some processing occurring in a single tasklet (and stalling other tasklets) or if there are multiple tasklets doing a lot of processing (ie. as each becomes active, each is doing a lot of work).

Is there a convenient way to hook into the scheduler in Stackless Python so that I can add some timing code? In other words, is there a function that is invoked when a tasklet becomes active and when it becomes inactive that I can hook into?

我还没有找到当Tasklet阻止/恢复时要挂接的显式函数,但是由于Channel.receive()通常是在发生阻止/恢复时挂接的,所以我就钩住了每次发生的情况。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM