示例#1
0
    def test_build_counter_list(self):
        counter_list = [
            ("Memory", None, "Available Bytes"),
            ("Paging File", "*", "% Usage"),
            ("Processor", "*", "% Processor Time"),
            ("Server", None, "Work Item Shortages"),
            ("Server Work Queues", "*", "Queue Length"),
            ("System", None, "Context Switches/sec"),
        ]
        resulting_list = win_pdh.build_counter_list(counter_list)
        for counter in resulting_list:
            self.assertTrue(isinstance(counter, win_pdh.Counter))

        resulting_paths = []
        for counter in resulting_list:
            resulting_paths.append(counter.path)

        expected_paths = [
            "\\Memory\\Available Bytes",
            "\\Paging File(*)\\% Usage",
            "\\Processor(*)\\% Processor Time",
            "\\Server\\Work Item Shortages",
            "\\Server Work Queues(*)\\Queue Length",
            "\\System\\Context Switches/sec",
        ]
        self.assertEqual(resulting_paths, expected_paths)
示例#2
0
    def test_build_counter_list(self):
        counter_list = [
            ('Memory', None, 'Available Bytes'),
            ('Paging File', '*', '% Usage'),
            ('Processor', '*', '% Processor Time'),
            ('Server', None, 'Work Item Shortages'),
            ('Server Work Queues', '*', 'Queue Length'),
            ('System', None, 'Context Switches/sec'),
        ]
        resulting_list = win_pdh.build_counter_list(counter_list)
        for counter in resulting_list:
            self.assertTrue(isinstance(counter, win_pdh.Counter))

        resulting_paths = []
        for counter in resulting_list:
            resulting_paths.append(counter.path)

        expected_paths = [
            '\\Memory\\Available Bytes', '\\Paging File(*)\\% Usage',
            '\\Processor(*)\\% Processor Time',
            '\\Server\\Work Item Shortages',
            '\\Server Work Queues(*)\\Queue Length',
            '\\System\\Context Switches/sec'
        ]
        self.assertEqual(resulting_paths, expected_paths)