1 from asfframework import VppAsfTestCase, VppTestRunner
2 from vpp_qemu_utils import can_create_namespaces
3 from config import config
8 not can_create_namespaces("perfmon_chk"), "Test is not running with root privileges"
10 @unittest.skipIf("perfmon" in config.excluded_plugins, "Exclude Perfmon plugin tests")
11 class TestPerfmon(VppAsfTestCase):
12 """Simple perfmon test"""
16 super(TestPerfmon, cls).setUpClass()
19 def tearDownClass(cls):
20 super(TestPerfmon, cls).tearDownClass()
22 def test_perfmon(self):
23 reply = self.vapi.cli("show perfmon active-bundle")
24 self.assertNotIn("context-switches", reply)
26 reply = self.vapi.cli("show perfmon bundle")
27 self.assertIn("context-switches", reply)
29 self.vapi.cli("perfmon start bundle context-switches type thread")
30 reply = self.vapi.cli("show perfmon active-bundle")
31 self.assertIn("name: context-switches", reply)
33 reply = self.vapi.cli("show perfmon statistics")
34 self.assertIn("per-thread context switches", reply)
36 reply = self.vapi.cli("show perfmon source linux verbose")
37 self.assertIn("description: Linux kernel performance counters", reply)
38 self.vapi.cli("perfmon reset")
40 reply = self.vapi.cli("show perfmon active-bundle")
41 self.assertNotIn("context-switches", reply)
43 self.vapi.cli("perfmon start bundle context-switches type thread")
44 self.vapi.cli("perfmon stop")
47 if __name__ == "__main__":
48 unittest.main(testRunner=VppTestRunner)