| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/utils.html"> | 8 <link rel="import" href="/tracing/base/utils.html"> |
| 9 <link rel="import" href="/tracing/core/test_utils.html"> | 9 <link rel="import" href="/tracing/core/test_utils.html"> |
| 10 <link rel="import" href="/tracing/model/heap_dump.html"> | 10 <link rel="import" href="/tracing/model/heap_dump.html"> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 const EXPECTED_COLUMNS = [ | 66 const EXPECTED_COLUMNS = [ |
| 67 { title: 'Process', type: ProcessNameColumn, noAggregation: true }, | 67 { title: 'Process', type: ProcessNameColumn, noAggregation: true }, |
| 68 { title: spanMatcher('Total resident'), type: UsedMemoryColumn }, | 68 { title: spanMatcher('Total resident'), type: UsedMemoryColumn }, |
| 69 { title: spanMatcher('Peak total resident'), type: PeakMemoryColumn }, | 69 { title: spanMatcher('Peak total resident'), type: PeakMemoryColumn }, |
| 70 { title: spanMatcher('PSS'), type: ByteStatColumn }, | 70 { title: spanMatcher('PSS'), type: ByteStatColumn }, |
| 71 { title: spanMatcher('Private dirty'), type: ByteStatColumn }, | 71 { title: spanMatcher('Private dirty'), type: ByteStatColumn }, |
| 72 { title: spanMatcher('Swapped'), type: ByteStatColumn }, | 72 { title: spanMatcher('Swapped'), type: ByteStatColumn }, |
| 73 { title: spanMatcher('Private'), type: UsedMemoryColumn }, | 73 { title: spanMatcher('Private'), type: UsedMemoryColumn }, |
| 74 { title: spanMatcher('Private footprint'), type: UsedMemoryColumn }, |
| 74 { title: colorLegendMatcher('blink'), type: AllocatorColumn }, | 75 { title: colorLegendMatcher('blink'), type: AllocatorColumn }, |
| 75 { title: colorLegendMatcher('gpu'), type: AllocatorColumn }, | 76 { title: colorLegendMatcher('gpu'), type: AllocatorColumn }, |
| 76 { title: colorLegendMatcher('malloc'), type: AllocatorColumn }, | 77 { title: colorLegendMatcher('malloc'), type: AllocatorColumn }, |
| 77 { title: colorLegendMatcher('oilpan'), type: AllocatorColumn }, | 78 { title: colorLegendMatcher('oilpan'), type: AllocatorColumn }, |
| 78 { title: colorLegendMatcher('v8'), type: AllocatorColumn }, | 79 { title: colorLegendMatcher('v8'), type: AllocatorColumn }, |
| 79 { title: spanMatcher('tracing'), type: TracingColumn } | 80 { title: spanMatcher('tracing'), type: TracingColumn } |
| 80 ]; | 81 ]; |
| 81 | 82 |
| 82 function checkRow(columns, row, expectedTitle, expectedSizes, | 83 function checkRow(columns, row, expectedTitle, expectedSizes, |
| 83 expectedContexts) { | 84 expectedContexts) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 212 |
| 212 test('instantiate_singleGlobalMemoryDump', function() { | 213 test('instantiate_singleGlobalMemoryDump', function() { |
| 213 const processMemoryDumps = convertToProcessMemoryDumps( | 214 const processMemoryDumps = convertToProcessMemoryDumps( |
| 214 [tr.ui.analysis.createSingleTestGlobalMemoryDump()]); | 215 [tr.ui.analysis.createSingleTestGlobalMemoryDump()]); |
| 215 createAndCheckMemoryDumpOverviewPane(this, | 216 createAndCheckMemoryDumpOverviewPane(this, |
| 216 processMemoryDumps, | 217 processMemoryDumps, |
| 217 [ // Table rows. | 218 [ // Table rows. |
| 218 { | 219 { |
| 219 title: colorLegendMatcher('Process 1'), | 220 title: colorLegendMatcher('Process 1'), |
| 220 sizes: [[29884416], undefined, [9437184], [5767168], undefined, | 221 sizes: [[29884416], undefined, [9437184], [5767168], undefined, |
| 221 undefined, undefined, undefined, [7340032], undefined, | 222 undefined, undefined, undefined, undefined, [7340032], undefined, |
| 222 undefined, [2097152]], | 223 undefined, [2097152]], |
| 223 contexts: extractProcessMemoryDumps(processMemoryDumps, 1) | 224 contexts: extractProcessMemoryDumps(processMemoryDumps, 1) |
| 224 }, | 225 }, |
| 225 { | 226 { |
| 226 title: colorLegendMatcher('Process 2'), | 227 title: colorLegendMatcher('Process 2'), |
| 227 sizes: [[17825792], [39845888], [18350080], [0], [32], [8912896], | 228 sizes: [[17825792], [39845888], [18350080], [0], [32], [8912896], |
| 228 [7340032], [0], [1048576], [1], [5242880], [1572864]], | 229 [15728640], [7340032], [0], [1048576], [1], [5242880], |
| 230 [1572864]], |
| 229 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) | 231 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) |
| 230 }, | 232 }, |
| 231 { | 233 { |
| 232 title: colorLegendMatcher('Process 4'), | 234 title: colorLegendMatcher('Process 4'), |
| 233 sizes: [undefined, [17825792], undefined, undefined, undefined, | 235 sizes: [undefined, [17825792], undefined, undefined, undefined, |
| 234 undefined, undefined, undefined, undefined, undefined, | 236 undefined, undefined, undefined, undefined, undefined, |
| 235 undefined, undefined], | 237 undefined, undefined, undefined], |
| 236 contexts: extractProcessMemoryDumps(processMemoryDumps, 4) | 238 contexts: extractProcessMemoryDumps(processMemoryDumps, 4) |
| 237 } | 239 } |
| 238 ], | 240 ], |
| 239 [ // Footer rows. | 241 [ // Footer rows. |
| 240 { | 242 { |
| 241 title: 'Total', | 243 title: 'Total', |
| 242 sizes: [[47710208], [57671680], [27787264], [5767168], [32], | 244 sizes: [[47710208], [57671680], [27787264], [5767168], [32], |
| 243 [8912896], [7340032], [0], [8388608], [1], [5242880], | 245 [8912896], [15728640], [7340032], [0], [8388608], [1], |
| 244 [3670016]], | 246 [5242880], [3670016]], |
| 245 contexts: undefined | 247 contexts: undefined |
| 246 } | 248 } |
| 247 ], | 249 ], |
| 248 undefined /* no aggregation */); | 250 undefined /* no aggregation */); |
| 249 }); | 251 }); |
| 250 | 252 |
| 251 test('instantiate_multipleGlobalMemoryDumps', function() { | 253 test('instantiate_multipleGlobalMemoryDumps', function() { |
| 252 const processMemoryDumps = convertToProcessMemoryDumps( | 254 const processMemoryDumps = convertToProcessMemoryDumps( |
| 253 tr.ui.analysis.createMultipleTestGlobalMemoryDumps()); | 255 tr.ui.analysis.createMultipleTestGlobalMemoryDumps()); |
| 254 createAndCheckMemoryDumpOverviewPane(this, | 256 createAndCheckMemoryDumpOverviewPane(this, |
| 255 processMemoryDumps, | 257 processMemoryDumps, |
| 256 [ // Table rows. | 258 [ // Table rows. |
| 257 { | 259 { |
| 258 title: colorLegendMatcher('Process 1'), | 260 title: colorLegendMatcher('Process 1'), |
| 259 sizes: [[31457280, 29884416, undefined], undefined, | 261 sizes: [[31457280, 29884416, undefined], undefined, |
| 260 [10485760, 9437184, undefined], [8388608, 5767168, undefined], | 262 [10485760, 9437184, undefined], [8388608, 5767168, undefined], |
| 261 undefined, undefined, undefined, undefined, | 263 undefined, undefined, undefined, undefined, undefined, |
| 262 [undefined, 7340032, undefined], undefined, undefined, | 264 [undefined, 7340032, undefined], undefined, undefined, |
| 263 [undefined, 2097152, undefined]], | 265 [undefined, 2097152, undefined]], |
| 264 contexts: extractProcessMemoryDumps(processMemoryDumps, 1) | 266 contexts: extractProcessMemoryDumps(processMemoryDumps, 1) |
| 265 }, | 267 }, |
| 266 { | 268 { |
| 267 title: colorLegendMatcher('Process 2'), | 269 title: colorLegendMatcher('Process 2'), |
| 268 sizes: [[19398656, 17825792, 15728640], | 270 sizes: [[19398656, 17825792, 15728640], |
| 269 [40370176, 39845888, 40894464], [18350080, 18350080, 18350080], | 271 [40370176, 39845888, 40894464], [18350080, 18350080, 18350080], |
| 270 [0, 0, -2621440], [32, 32, 64], [10485760, 8912896, 7340032], | 272 [0, 0, -2621440], [32, 32, 64], [10485760, 8912896, 7340032], |
| 271 [undefined, 7340032, 6291456], [undefined, 0, 1048576], | 273 [15728640, 15728640, 15728640], [undefined, 7340032, 6291456], |
| 272 [2097152, 1048576, 786432], [undefined, 1, undefined], | 274 [undefined, 0, 1048576], [2097152, 1048576, 786432], |
| 273 [5242880, 5242880, 5767168], [1048576, 1572864, 2097152]], | 275 [undefined, 1, undefined], [5242880, 5242880, 5767168], |
| 276 [1048576, 1572864, 2097152]], |
| 274 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) | 277 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) |
| 275 }, | 278 }, |
| 276 { | 279 { |
| 277 title: colorLegendMatcher('Process 3'), | 280 title: colorLegendMatcher('Process 3'), |
| 278 sizes: [undefined, undefined, undefined, undefined, undefined, | 281 sizes: [undefined, undefined, undefined, undefined, undefined, |
| 279 undefined, undefined, undefined, undefined, | 282 undefined, undefined, undefined, undefined, undefined, |
| 280 [2147483648, undefined, 1073741824], | 283 [2147483648, undefined, 1073741824], |
| 281 [1073741824, undefined, 2147483648], undefined], | 284 [1073741824, undefined, 2147483648], undefined], |
| 282 contexts: extractProcessMemoryDumps(processMemoryDumps, 3) | 285 contexts: extractProcessMemoryDumps(processMemoryDumps, 3) |
| 283 }, | 286 }, |
| 284 { | 287 { |
| 285 title: colorLegendMatcher('Process 4'), | 288 title: colorLegendMatcher('Process 4'), |
| 286 sizes: [undefined, [undefined, 17825792, 17825792], undefined, | 289 sizes: [undefined, [undefined, 17825792, 17825792], undefined, |
| 287 undefined, undefined, undefined, undefined, undefined, | 290 undefined, undefined, undefined, undefined, undefined, |
| 288 undefined, undefined, undefined, undefined], | 291 undefined, undefined, undefined, undefined, undefined], |
| 289 contexts: extractProcessMemoryDumps(processMemoryDumps, 4) | 292 contexts: extractProcessMemoryDumps(processMemoryDumps, 4) |
| 290 } | 293 } |
| 291 ], | 294 ], |
| 292 [ // Footer rows. | 295 [ // Footer rows. |
| 293 { | 296 { |
| 294 title: 'Total', | 297 title: 'Total', |
| 295 sizes: [[50855936, 47710208, 15728640], | 298 sizes: [[50855936, 47710208, 15728640], |
| 296 [40370176, 57671680, 58720256], [28835840, 27787264, 18350080], | 299 [40370176, 57671680, 58720256], [28835840, 27787264, 18350080], |
| 297 [8388608, 5767168, -2621440], [32, 32, 64], | 300 [8388608, 5767168, -2621440], [32, 32, 64], |
| 298 [10485760, 8912896, 7340032], [undefined, 7340032, 6291456], | 301 [10485760, 8912896, 7340032], [15728640, 15728640, 15728640], |
| 299 [undefined, 0, 1048576], [2097152, 8388608, 786432], | 302 [undefined, 7340032, 6291456], [undefined, 0, 1048576], |
| 300 [2147483648, 1, 1073741824], [1078984704, 5242880, 2153250816], | 303 [2097152, 8388608, 786432], [2147483648, 1, 1073741824], |
| 304 [1078984704, 5242880, 2153250816], |
| 301 [1048576, 3670016, 2097152]], | 305 [1048576, 3670016, 2097152]], |
| 302 contexts: undefined | 306 contexts: undefined |
| 303 } | 307 } |
| 304 ], | 308 ], |
| 305 AggregationMode.DIFF); | 309 AggregationMode.DIFF); |
| 306 }); | 310 }); |
| 307 | 311 |
| 308 test('instantiate_singleProcessMemoryDump', function() { | 312 test('instantiate_singleProcessMemoryDump', function() { |
| 309 const processMemoryDumps = convertToProcessMemoryDumps( | 313 const processMemoryDumps = convertToProcessMemoryDumps( |
| 310 [tr.ui.analysis.createSingleTestProcessMemoryDump()]); | 314 [tr.ui.analysis.createSingleTestProcessMemoryDump()]); |
| 311 createAndCheckMemoryDumpOverviewPane(this, | 315 createAndCheckMemoryDumpOverviewPane(this, |
| 312 processMemoryDumps, | 316 processMemoryDumps, |
| 313 [ // Table rows. | 317 [ // Table rows. |
| 314 { | 318 { |
| 315 title: colorLegendMatcher('Process 2'), | 319 title: colorLegendMatcher('Process 2'), |
| 316 sizes: [[17825792], [39845888], [18350080], [0], [32], [8912896], | 320 sizes: [[17825792], [39845888], [18350080], [0], [32], [8912896], |
| 317 [7340032], [0], [1048576], [1], [5242880], [1572864]], | 321 [15728640], [7340032], [0], [1048576], [1], [5242880], |
| 322 [1572864]], |
| 318 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) | 323 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) |
| 319 } | 324 } |
| 320 ], | 325 ], |
| 321 [] /* footer rows */, | 326 [] /* footer rows */, |
| 322 undefined /* no aggregation */); | 327 undefined /* no aggregation */); |
| 323 }); | 328 }); |
| 324 | 329 |
| 325 test('instantiate_multipleProcessMemoryDumps', function() { | 330 test('instantiate_multipleProcessMemoryDumps', function() { |
| 326 const processMemoryDumps = convertToProcessMemoryDumps( | 331 const processMemoryDumps = convertToProcessMemoryDumps( |
| 327 tr.ui.analysis.createMultipleTestProcessMemoryDumps()); | 332 tr.ui.analysis.createMultipleTestProcessMemoryDumps()); |
| 328 createAndCheckMemoryDumpOverviewPane(this, | 333 createAndCheckMemoryDumpOverviewPane(this, |
| 329 processMemoryDumps, | 334 processMemoryDumps, |
| 330 [ // Table rows. | 335 [ // Table rows. |
| 331 { | 336 { |
| 332 title: colorLegendMatcher('Process 2'), | 337 title: colorLegendMatcher('Process 2'), |
| 333 sizes: [[19398656, 17825792, 15728640], | 338 sizes: [[19398656, 17825792, 15728640], |
| 334 [40370176, 39845888, 40894464], [18350080, 18350080, 18350080], | 339 [40370176, 39845888, 40894464], [18350080, 18350080, 18350080], |
| 335 [0, 0, -2621440], [32, 32, 64], [10485760, 8912896, 7340032], | 340 [0, 0, -2621440], [32, 32, 64], [10485760, 8912896, 7340032], |
| 336 [undefined, 7340032, 6291456], [undefined, 0, 1048576], | 341 [15728640, 15728640, 15728640], [undefined, 7340032, 6291456], |
| 337 [2097152, 1048576, 786432], [undefined, 1, undefined], | 342 [undefined, 0, 1048576], [2097152, 1048576, 786432], |
| 338 [5242880, 5242880, 5767168], [1048576, 1572864, 2097152]], | 343 [undefined, 1, undefined], [5242880, 5242880, 5767168], |
| 344 [1048576, 1572864, 2097152]], |
| 339 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) | 345 contexts: extractProcessMemoryDumps(processMemoryDumps, 2) |
| 340 } | 346 } |
| 341 ], | 347 ], |
| 342 [] /* footer rows */, | 348 [] /* footer rows */, |
| 343 AggregationMode.MAX); | 349 AggregationMode.MAX); |
| 344 }); | 350 }); |
| 345 | 351 |
| 346 test('selection', function() { | 352 test('selection', function() { |
| 347 const processMemoryDumps = convertToProcessMemoryDumps( | 353 const processMemoryDumps = convertToProcessMemoryDumps( |
| 348 tr.ui.analysis.createMultipleTestGlobalMemoryDumps()); | 354 tr.ui.analysis.createMultipleTestGlobalMemoryDumps()); |
| 349 | 355 |
| 350 const viewEl = | 356 const viewEl = |
| 351 tr.ui.analysis.createTestPane('tr-ui-a-memory-dump-overview-pane'); | 357 tr.ui.analysis.createTestPane('tr-ui-a-memory-dump-overview-pane'); |
| 352 viewEl.processMemoryDumps = processMemoryDumps; | 358 viewEl.processMemoryDumps = processMemoryDumps; |
| 353 viewEl.aggregationMode = AggregationMode.DIFF; | 359 viewEl.aggregationMode = AggregationMode.DIFF; |
| 354 viewEl.rebuild(); | 360 viewEl.rebuild(); |
| 355 this.addHTMLOutput(viewEl); | 361 this.addHTMLOutput(viewEl); |
| 356 | 362 |
| 357 const table = viewEl.$.table; | 363 const table = viewEl.$.table; |
| 358 | 364 |
| 359 // Simulate clicking on the 'malloc' cell of the second process. | 365 // Simulate clicking on the 'malloc' cell of the second process. |
| 360 table.selectedTableRow = table.tableRows[1]; | 366 table.selectedTableRow = table.tableRows[1]; |
| 361 table.selectedColumnIndex = 9; | 367 table.selectedColumnIndex = 10; |
| 362 assert.lengthOf(viewEl.requestedChildPanes, 2); | 368 assert.lengthOf(viewEl.requestedChildPanes, 2); |
| 363 let lastChildPane = viewEl.requestedChildPanes[1]; | 369 let lastChildPane = viewEl.requestedChildPanes[1]; |
| 364 assert.strictEqual( | 370 assert.strictEqual( |
| 365 lastChildPane.tagName, 'TR-UI-A-MEMORY-DUMP-ALLOCATOR-DETAILS-PANE'); | 371 lastChildPane.tagName, 'TR-UI-A-MEMORY-DUMP-ALLOCATOR-DETAILS-PANE'); |
| 366 assert.strictEqual(lastChildPane.aggregationMode, AggregationMode.DIFF); | 372 assert.strictEqual(lastChildPane.aggregationMode, AggregationMode.DIFF); |
| 367 assert.deepEqual(lastChildPane.memoryAllocatorDumps, | 373 assert.deepEqual(lastChildPane.memoryAllocatorDumps, |
| 368 extractMemoryAllocatorDumps(processMemoryDumps, 2, 'malloc')); | 374 extractMemoryAllocatorDumps(processMemoryDumps, 2, 'malloc')); |
| 369 | 375 |
| 370 // Simulate clicking on the 'Oilpan' cell of the second process. | 376 // Simulate clicking on the 'Oilpan' cell of the second process. |
| 371 table.selectedColumnIndex = 10; | 377 table.selectedColumnIndex = 10; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 function(view, table) { | 468 function(view, table) { |
| 463 const childPane = view.createChildPane(); | 469 const childPane = view.createChildPane(); |
| 464 assert.strictEqual( | 470 assert.strictEqual( |
| 465 childPane.tagName, 'TR-UI-A-MEMORY-DUMP-VM-REGIONS-DETAILS-PANE'); | 471 childPane.tagName, 'TR-UI-A-MEMORY-DUMP-VM-REGIONS-DETAILS-PANE'); |
| 466 assert.deepEqual(Array.from(childPane.vmRegions), | 472 assert.deepEqual(Array.from(childPane.vmRegions), |
| 467 extractVmRegions(processMemoryDumps, 2)); | 473 extractVmRegions(processMemoryDumps, 2)); |
| 468 assert.strictEqual(childPane.aggregationMode, AggregationMode.DIFF); | 474 assert.strictEqual(childPane.aggregationMode, AggregationMode.DIFF); |
| 469 | 475 |
| 470 // Select the 'v8' column of the first process (empty cell). | 476 // Select the 'v8' column of the first process (empty cell). |
| 471 table.selectedTableRow = table.tableRows[0]; | 477 table.selectedTableRow = table.tableRows[0]; |
| 472 table.selectedColumnIndex = 10; | 478 table.selectedColumnIndex = 11; |
| 473 }); | 479 }); |
| 474 | 480 |
| 475 simulateView( | 481 simulateView( |
| 476 [1], | 482 [1], |
| 477 undefined, /* No aggregation */ | 483 undefined, /* No aggregation */ |
| 478 undefined, undefined, undefined, // No cell should selected. | 484 undefined, undefined, undefined, // No cell should selected. |
| 479 function(view, table) { | 485 function(view, table) { |
| 480 assert.isUndefined(view.createChildPane()); | 486 assert.isUndefined(view.createChildPane()); |
| 481 | 487 |
| 482 // Select 'Total resident' column of the first process. | 488 // Select 'Total resident' column of the first process. |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 test('tracingColumn', function() { | 831 test('tracingColumn', function() { |
| 826 const c = new TracingColumn('Tracing', 'bytes', (x => x), | 832 const c = new TracingColumn('Tracing', 'bytes', (x => x), |
| 827 AggregationMode.DIFF); | 833 AggregationMode.DIFF); |
| 828 checkSpanWithColor(c.title, 'Tracing', | 834 checkSpanWithColor(c.title, 'Tracing', |
| 829 TracingColumn.COLOR /* expected column title gray color */); | 835 TracingColumn.COLOR /* expected column title gray color */); |
| 830 checkColor(c.color(undefined /* contexts */), | 836 checkColor(c.color(undefined /* contexts */), |
| 831 TracingColumn.COLOR /* expected column cells gray color */); | 837 TracingColumn.COLOR /* expected column cells gray color */); |
| 832 }); | 838 }); |
| 833 }); | 839 }); |
| 834 </script> | 840 </script> |
| OLD | NEW |