]> granicus.if.org Git - python/commit
bpo-34060: Report system load when running test suite for Windows (GH-8357)
authorAmmar Askar <ammar_askar@hotmail.com>
Tue, 9 Apr 2019 12:20:41 +0000 (08:20 -0400)
committerCheryl Sabella <cheryl.sabella@gmail.com>
Tue, 9 Apr 2019 12:20:41 +0000 (08:20 -0400)
commite16467af0bfcc9f399df251495ff2d2ad20a1669
treeee3c0cbd23c0e5a04fd8de12368a47bfcb184e09
parentc324c748871804f31f56b3bd02a8650b3bf1bae7
bpo-34060: Report system load when running test suite for Windows (GH-8357)

While Windows exposes the system processor queue length, the raw value
used for load calculations on Unix systems, it does not provide an API
to access the averaged value. Hence to calculate the load we must track
and average it ourselves. We can't use multiprocessing or a thread to
read it in the background while the tests run since using those would
conflict with test_multiprocessing and test_xxsubprocess.

Thus, we use Window's asynchronous IO API to run the tracker in the
background with it sampling at the correct rate. When we wish to access
the load we check to see if there's new data on the stream, if there is,
we update our load values.
Lib/test/libregrtest/main.py
Lib/test/libregrtest/win_utils.py [new file with mode: 0644]
Misc/NEWS.d/next/Windows/2018-07-20-13-09-19.bpo-34060.v-z87j.rst [new file with mode: 0644]