win32pdhquery.py 文件源码

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

项目:purelove 作者: hucmosin 项目源码 文件源码
def open(self,*args,**namedargs):
        '''
        Explicitly open a query:
        When you are needing to make multiple calls to the same query,
        it is most efficient to open the query, run all of the calls,
        then close the query, instead of having the collectdata method
        automatically open and close the query each time it runs.
        There are currently no arguments to open.
        '''
        # do all the normal opening stuff, self._base is now the query object
        BaseQuery.open(*(self,)+args, **namedargs)
        # should rewrite getinstpaths to take a single tuple
        paths = []
        for tup in self.volatilecounters:
            paths[len(paths):] = self.getinstpaths(*tup)
        for path in paths:
            try:
                self.counters.append(win32pdh.AddCounter(self._base, path))
                self.curpaths.append(path) # if we fail on the line above, this path won't be in the table or the counters
            except win32api.error:
                pass # again, what to do with a malformed path???
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号