1 from asfframework import VppAsfTestCase, VppTestRunner
5 class TestPerfmon(VppAsfTestCase):
6 """Simple perfmon test"""
10 super(TestPerfmon, cls).setUpClass()
13 def tearDownClass(cls):
14 super(TestPerfmon, cls).tearDownClass()
16 def test_perfmon(self):
17 reply = self.vapi.cli("show perfmon active-bundle")
18 self.assertNotIn("context-switches", reply)
20 reply = self.vapi.cli("show perfmon bundle")
21 self.assertIn("context-switches", reply)
23 self.vapi.cli("perfmon start bundle context-switches type thread")
24 reply = self.vapi.cli("show perfmon active-bundle")
25 self.assertIn("name: context-switches", reply)
27 reply = self.vapi.cli("show perfmon statistics")
28 self.assertIn("per-thread context switches", reply)
30 reply = self.vapi.cli("show perfmon source linux verbose")
31 self.assertIn("description: Linux kernel performance counters", reply)
32 self.vapi.cli("perfmon reset")
34 reply = self.vapi.cli("show perfmon active-bundle")
35 self.assertNotIn("context-switches", reply)
37 self.vapi.cli("perfmon start bundle context-switches type thread")
38 self.vapi.cli("perfmon stop")
41 if __name__ == "__main__":
42 unittest.main(testRunner=VppTestRunner)