开发者

How to tell thread stack usage from Python?

I'd like to log the stack usage of a long-running thread (that is, one that is active during the whole life of the application), how can I do it? Something like "xxxxKB used" would be enough.

(Pytho开发者_如何学Gon 2.6.6, FreeBSD 8.2-RC3)


Since you specified FreeBSD, the resource module that comes with Python (but only works for Unix-y environments) might be helpful. Specifically, resource.getrusage(resource.RUSAGE_BOTH) provides will give you the resource usage of that process and all child processes.

It would look like you'd be interested in the following:

    ru_maxrss   maximum resident set size
    ru_ixrss    shared memory size
    ru_idrss    unshared memory size
    ru_isrss    unshared stack size
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜