win32pdhquery.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:purelove 作者: hucmosin 项目源码 文件源码
def collectdatawhile(self, period=1):
        '''
        Threaded collection of performance data:
        This method sets up a simple semaphor system for signalling 
        when you would like to start and stop a threaded data collection
        method.  The collection runs every period seconds until the
        semaphor attribute is set to a non-true value (which normally
        should be done by calling query.collectdatawhile_stop() .)
        e.g.:
            query.collectdatawhile(2)
            # starts the query running, returns control to the caller immediately
            # is collecting data every two seconds.
            # do whatever you want to do while the thread runs, then call:
            query.collectdatawhile_stop()
            # when you want to deal with the data.  It is generally a good idea
            # to sleep for period seconds yourself, since the query will not copy
            # the required data until the next iteration:
            time.sleep(2)
            # now you can access the data from the attributes of the query
            query.curresults
            query.curpaths
        '''
        self.collectdatawhile_active = 1
        thread.start_new_thread(self.collectdatawhile_slave,(period,))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号