Fix: check for current_task_start_ts, not last_sched_ts, in cputop
[deliverable/lttng-analyses.git] / tests / test_cputop.py
CommitLineData
c163ba2e
AB
1# The MIT License (MIT)
2#
3# Copyright (C) 2016 - Julien Desfossez <jdesfossez@efficios.com>
4# Antoine Busque <abusque@efficios.com>
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22# SOFTWARE.
23
24from .analysis_test import AnalysisTest
25
26
27class CpuTest(AnalysisTest):
89086b3e
JD
28 def write_trace(self):
29 # runs the whole time: 100%
c163ba2e
AB
30 self.trace_writer.write_sched_switch(1000, 5, 'swapper/5',
31 0, 'prog100pc-cpu5', 42)
89086b3e 32 # runs for 2s alternating with swapper out every 100ms
c163ba2e
AB
33 self.trace_writer.sched_switch_50pc(1100, 5000, 0, 100, 'swapper/0',
34 0, 'prog20pc-cpu0', 30664)
89086b3e 35 # runs for 2.5s alternating with swapper out every 100ms
c163ba2e
AB
36 self.trace_writer.sched_switch_50pc(5100, 10000, 1, 100, 'swapper/1',
37 0, 'prog25pc-cpu1', 30665)
89086b3e 38 # switch out prog100pc-cpu5
c163ba2e
AB
39 self.trace_writer.write_sched_switch(11000, 5, 'prog100pc-cpu5',
40 42, 'swapper/5', 0)
41 self.trace_writer.flush()
89086b3e 42
c163ba2e
AB
43 def test_cputop(self):
44 expected = self.get_expected_output('cputop.txt')
45 result = self.get_cmd_output('lttng-cputop')
89086b3e 46
c163ba2e 47 self.assertMultiLineEqual(result, expected)
This page took 0.028594 seconds and 5 git commands to generate.