blob: 448a6012c20fb2a5a8e7ab51948c11a50ddd9423 [file] [log] [blame]
adrianvilline59761f2023-11-07 10:18:24 +01001from asfframework import VppAsfTestCase, VppTestRunner
2import unittest
3
4
5class TestPerfmon(VppAsfTestCase):
6 """Simple perfmon test"""
7
8 @classmethod
9 def setUpClass(cls):
10 super(TestPerfmon, cls).setUpClass()
11
12 @classmethod
13 def tearDownClass(cls):
14 super(TestPerfmon, cls).tearDownClass()
15
16 def test_perfmon(self):
17 reply = self.vapi.cli("show perfmon active-bundle")
18 self.assertNotIn("context-switches", reply)
19
20 reply = self.vapi.cli("show perfmon bundle")
21 self.assertIn("context-switches", reply)
22
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)
26
27 reply = self.vapi.cli("show perfmon statistics")
28 self.assertIn("per-thread context switches", reply)
29
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")
33
34 reply = self.vapi.cli("show perfmon active-bundle")
35 self.assertNotIn("context-switches", reply)
36
37 self.vapi.cli("perfmon start bundle context-switches type thread")
38 self.vapi.cli("perfmon stop")
39
40
41if __name__ == "__main__":
42 unittest.main(testRunner=VppTestRunner)