1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
9 class GroupByProcessAndThreadIdTestBasic(unittest
.TestCase
):
11 # (sec, usec, 'pid:tid', function address).
13 (100, 10, '2000:2001', 0x5),
14 (100, 11, '2000:2001', 0x3),
15 (100, 13, '2000:1999', 0x8),
16 (100, 14, '2000:2000', 0x7),
17 (120, 13, '2001:2003', 0x9),
18 (150, 12, '2001:2004', 0x6),
19 (180, 11, '2000:2000', 0x1),
22 # Functions should be grouped by thread-id and PIDs should not be
25 (100, 10, '2000:2001', 0x5),
26 (100, 11, '2000:2001', 0x3),
27 (100, 13, '2000:1999', 0x8),
28 (100, 14, '2000:2000', 0x7),
29 (180, 11, '2000:2000', 0x1),
30 (120, 13, '2001:2003', 0x9),
31 (150, 12, '2001:2004', 0x6),
34 grouped_trace
= mergetraces
.GroupByProcessAndThreadId(input_trace
)
36 self
.assertEqual(grouped_trace
, expected_trace
)
38 class GroupByProcessAndThreadIdFailsWithNonUniqueTIDs(unittest
.TestCase
):
40 # (sec, usec, 'pid:tid', function address).
42 (100, 10, '1999:2001', 0x5),
43 (100, 10, '1988:2001', 0x5),
47 mergetraces
.GroupByProcessAndThreadId(input_trace
)
51 self
.fail('Multiple processes should not have a same thread-ID.')