Пример #1
0
def browse(callback=BrowseCallBackDemo,
           title="Python Browser",
           level=win32pdh.PERF_DETAIL_WIZARD):
    win32pdh.BrowseCounters(None,
                            0,
                            callback,
                            level,
                            title,
                            ReturnMultiple=True)
Пример #2
0
	def addcounterbybrowsing(self, flags = win32pdh.PERF_DETAIL_WIZARD, windowtitle="Python Browser"):
		'''
		Adds possibly multiple paths to the paths attribute of the query,
		does this by calling the standard counter browsing dialogue.  Within
		this dialogue, find the counter you want to log, and click: Add,
		repeat for every path you want to log, then click on close.  The
		paths are appended to the non-volatile paths list for this class,
		subclasses may create a function which parses the paths and decides
		(via heuristics) whether to add the path to the volatile or non-volatile
		path list.
		e.g.:
			query.addcounter()
		'''
		win32pdh.BrowseCounters(None,0, self.paths.append, flags, windowtitle)
Пример #3
0
    for arg in sys.argv[1:]:
        if ((arg[:2] == "--" or arg[:1] == "/")
                and arg.lstrip("-/") in ("disk", "load", "proc", "service",
                                         "end", "run", "status", "history")):
            mode = arg.lstrip("-/")
        elif ((arg[:2] == "--" or arg[:1] == "/") and "=" in arg and
              arg.lstrip("-/").split("=", 1)[0] in ("count", "old", "port")):
            parts = arg.lstrip("-/").split("=", 1)
            opts[parts[0]] = int(parts[1])
        elif arg in ("--browse", "/browse"):

            def print_counter(counter):
                print counter

            win32pdh.BrowseCounters(None, 0, print_counter,
                                    win32pdh.PERF_DETAIL_WIZARD,
                                    "Counter List")
        elif arg in ("-q", "/q", "--quiet", "/quiet"):
            verbose -= 1
        elif arg in ("-v", "/v", "--verbose", "/verbose"):
            verbose += 1
        elif arg in ('install', 'remove', 'start', 'stop'):
            windowsService = True
        elif not frequency and arg.isdigit():
            frequency = int(arg)
        elif arg in ("-h", "/h", "/?", "--help", "/help"):
            help = "help"
        else:
            help = True
    if (help and not windowsService) or help == "help":
        print """Run or query a loadavg service on windows.