Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 copy | 5 import copy |
| 6 import datetime | 6 import datetime |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import time | 10 import time |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 """ | 400 """ |
| 401 words = stacktrace_line.split() | 401 words = stacktrace_line.split() |
| 402 if len(words) < BUCKET_ID + 1: | 402 if len(words) < BUCKET_ID + 1: |
| 403 return False | 403 return False |
| 404 if words[BUCKET_ID - 1] != '@': | 404 if words[BUCKET_ID - 1] != '@': |
| 405 return False | 405 return False |
| 406 return True | 406 return True |
| 407 | 407 |
| 408 | 408 |
| 409 class DumpList(object): | 409 class DumpList(object): |
| 410 """Represents a sequence of heap profile dumps.""" | 410 """Represents a sequence of heap profile dumps.""" |
|
Dai Mikurube (NOT FULLTIME)
2014/02/03 07:00:24
Could you add some comments that describes
* It lo
Jens Widell
2014/02/03 07:29:58
Some notes to that effect added.
| |
| 411 | 411 |
| 412 def __init__(self, dump_list): | 412 def __init__(self, dump_path_list): |
| 413 self._dump_list = dump_list | 413 self._dump_path_list = dump_path_list |
| 414 | 414 |
| 415 @staticmethod | 415 @staticmethod |
| 416 def load(path_list): | 416 def load(path_list): |
| 417 LOGGER.info('Loading heap dump profiles.') | 417 return DumpList(path_list) |
| 418 dump_list = [] | |
| 419 for path in path_list: | |
| 420 dump_list.append(Dump.load(path, ' ')) | |
| 421 return DumpList(dump_list) | |
| 422 | 418 |
| 423 def __len__(self): | 419 def __len__(self): |
| 424 return len(self._dump_list) | 420 return len(self._dump_path_list) |
| 425 | 421 |
| 426 def __iter__(self): | 422 def __iter__(self): |
| 427 for dump in self._dump_list: | 423 for dump in self._dump_path_list: |
| 428 yield dump | 424 yield Dump.load(dump) |
| 429 | 425 |
| 430 def __getitem__(self, index): | 426 def __getitem__(self, index): |
| 431 return self._dump_list[index] | 427 return Dump.load(self._dump_path_list[index]) |
| 432 | 428 |
| 433 | 429 |
| 434 class ProcMapsEntryAttribute(ExclusiveRangeDict.RangeAttribute): | 430 class ProcMapsEntryAttribute(ExclusiveRangeDict.RangeAttribute): |
| 435 """Represents an entry of /proc/maps in range_dict.ExclusiveRangeDict.""" | 431 """Represents an entry of /proc/maps in range_dict.ExclusiveRangeDict.""" |
| 436 _DUMMY_ENTRY = procfs.ProcMapsEntry( | 432 _DUMMY_ENTRY = procfs.ProcMapsEntry( |
| 437 0, # begin | 433 0, # begin |
| 438 0, # end | 434 0, # end |
| 439 '-', # readable | 435 '-', # readable |
| 440 '-', # writable | 436 '-', # writable |
| 441 '-', # executable | 437 '-', # executable |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 Returns: | 474 Returns: |
| 479 A pair of an integer indicating a line number after skipped, and a | 475 A pair of an integer indicating a line number after skipped, and a |
| 480 boolean value which is True if found a line which skipping_condition | 476 boolean value which is True if found a line which skipping_condition |
| 481 is False for. | 477 is False for. |
| 482 """ | 478 """ |
| 483 while skipping_condition(index): | 479 while skipping_condition(index): |
| 484 index += 1 | 480 index += 1 |
| 485 if index >= max_index: | 481 if index >= max_index: |
| 486 return index, False | 482 return index, False |
| 487 return index, True | 483 return index, True |
| OLD | NEW |