Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 import mergetraces | 7 import mergetraces |
| 8 | 8 |
| 9 class GroupByProcessAndThreadIdTest(unittest.TestCase): | 9 class GroupByProcessAndThreadIdTest(unittest.TestCase): |
| 10 def runTest(self): | 10 def runTest(self): |
| 11 # (sec, usec, 'pid:tid', function address). | 11 # (sec, usec, 'pid:tid', function address). |
| 12 input_trace = [ | 12 input_trace = [ |
| 13 (100, 10, '2000:2001', 0x5), | 13 (100, 10, '2000:2001', 0x5), |
| 14 (100, 11, '2000:2001', 0x3), | 14 (100, 11, '2000:2001', 0x3), |
| 15 (100, 11, '2000:2000', 0x1), | |
| 16 (100, 12, '2001:2001', 0x6), | |
| 17 (100, 13, '2000:2002', 0x8), | 15 (100, 13, '2000:2002', 0x8), |
| 18 (100, 13, '2001:2002', 0x9), | 16 (100, 14, '2000:2000', 0x7), |
| 19 (100, 14, '2000:2000', 0x7) | 17 (120, 13, '2001:2002', 0x9), |
| 18 (150, 12, '2001:2001', 0x6), | |
| 19 (180, 11, '2000:2000', 0x1), | |
| 20 ] | 20 ] |
| 21 | 21 |
| 22 # Functions should be grouped by thread-id and PIDs should not be | 22 # Functions should be grouped by thread-id and PIDs should not be |
| 23 # interleaved. | 23 # interleaved. |
| 24 expected_trace = [ | 24 expected_trace = [ |
| 25 (100, 10, '2000:2001', 0x5), | 25 (100, 10, '2000:2001', 0x5), |
| 26 (100, 11, '2000:2001', 0x3), | 26 (100, 11, '2000:2001', 0x3), |
| 27 (100, 11, '2000:2000', 0x1), | 27 (100, 13, '2000:2002', 0x8), |
| 28 (100, 14, '2000:2000', 0x7), | 28 (100, 14, '2000:2000', 0x7), |
| 29 (100, 13, '2000:2002', 0x8), | 29 (180, 11, '2000:2000', 0x1), |
| 30 (100, 12, '2001:2001', 0x6), | 30 (150, 12, '2001:2001', 0x6), |
|
pasko
2014/06/06 09:14:15
please make sure each tid uniquely identifies the
Philippe
2014/06/06 09:30:48
Done.
| |
| 31 (100, 13, '2001:2002', 0x9) | 31 (120, 13, '2001:2002', 0x9), |
| 32 ] | 32 ] |
| 33 | 33 |
| 34 grouped_trace = mergetraces.GroupByProcessAndThreadId(input_trace) | 34 grouped_trace = mergetraces.GroupByProcessAndThreadId(input_trace) |
| 35 | 35 |
| 36 self.assertEqual(grouped_trace, expected_trace) | 36 self.assertEqual(grouped_trace, expected_trace) |
| OLD | NEW |