How to determine the use of a thread stack from Python?

I would like to register the use of a long thread stack (that is, which is active for the entire life of the application), how can I do this? Something like "xxxxKB used" will suffice.

(Python 2.6.6, FreeBSD 8.2-RC3)

+3
source share
1 answer

Since you pointed out FreeBSD, the module resourcethat ships with Python (but only works for Unix-y environments) may be useful . In particular, it resource.getrusage(resource.RUSAGE_BOTH)provides you with the use of the resources of this process and all child processes.

It would seem that you would 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
source

Source: https://habr.com/ru/post/1790826/


All Articles