1 # The MIT License (MIT)
3 # Copyright (C) 2016 - Julien Desfossez <jdesfossez@efficios.com>
4 # Antoine Busque <abusque@efficios.com>
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:
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
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
24 from .analysis_test
import AnalysisTest
27 class IoTest(AnalysisTest
):
28 def write_trace(self
):
29 # app (99) is known at statedump
30 self
.trace_writer
.write_lttng_statedump_process_state(
31 1000, 0, 99, 99, 99, 99, 98, 98, 'app', 0, 5, 0, 5, 0)
32 # app2 (100) unknown at statedump has testfile, FD 3 defined at
34 self
.trace_writer
.write_lttng_statedump_file_descriptor(
35 1001, 0, 100, 3, 0, 0, 'testfile')
36 # app write 10 bytes to FD 4
37 self
.trace_writer
.write_sched_switch(1002, 0, 'swapper/0', 0, 'app', 99)
38 self
.trace_writer
.write_syscall_write(1004, 0, 1, 4, 0xabcd, 10, 10)
39 # app2 reads 100 bytes in FD 3
40 self
.trace_writer
.write_sched_switch(1006, 0, 'app', 99, 'app2', 100)
41 self
.trace_writer
.write_syscall_read(1008, 0, 1, 3, 0xcafe, 100, 100)
42 # app3 and its FD 3 are completely unknown at statedump, tries to read 100
43 # bytes from FD 3 but only gets 42
44 self
.trace_writer
.write_sched_switch(1010, 0, 'app2', 100, 'app3', 101)
45 self
.trace_writer
.write_syscall_read(1012, 0, 1, 3, 0xcafe, 100, 42)
47 self
.trace_writer
.write_block_rq_issue(1015, 0, 264241152, 33, 10, 40, 99, 0, 0, '', 'app')
48 self
.trace_writer
.write_block_rq_complete(1016, 0, 264241152, 33, 10, 0, 0, 0, '')
50 self
.trace_writer
.write_block_rq_issue(1017, 0, 8388608, 33, 20, 90, 101, 1, 0, '', 'app3')
51 self
.trace_writer
.write_block_rq_complete(1018, 0, 8388608, 33, 20, 0, 1, 0, '')
53 self
.trace_writer
.write_net_dev_xmit(1020, 2, 0xff, 32, 100, 'wlan0')
55 self
.trace_writer
.write_netif_receive_skb(1021, 1, 0xff, 100, 'wlan1')
56 self
.trace_writer
.write_netif_receive_skb(1022, 1, 0xff, 200, 'wlan0')
58 self
.trace_writer
.write_syscall_open(1023, 0, 1, 'test/open/file', 0, 0, 42)
59 self
.trace_writer
.flush()
61 def test_iousagetop(self
):
62 expected
= self
.get_expected_output('iousagetop.txt')
63 result
= self
.get_cmd_output('lttng-iousagetop')
65 self
.assertMultiLineEqual(result
, expected
)
67 def test_iolatencytop(self
):
68 expected
= self
.get_expected_output('iolatencytop.txt')
69 result
= self
.get_cmd_output('lttng-iolatencytop')
71 self
.assertMultiLineEqual(result
, expected
)
This page took 0.041903 seconds and 5 git commands to generate.