Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: tools/memory_inspector/memory_inspector/data/file_storage.py

Issue 850033002: Remove dependency on dateutil in memory_inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reuse Archive._TIME_FMT Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/memory_inspector/memory_inspector/frontends/www_server.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/memory_inspector/memory_inspector/data/file_storage.py
diff --git a/tools/memory_inspector/memory_inspector/data/file_storage.py b/tools/memory_inspector/memory_inspector/data/file_storage.py
index 55656f5f4155df9bdfcda83513a6093529458ac0..71ccd230088c327fba5267f26447e81b4b469686 100644
--- a/tools/memory_inspector/memory_inspector/data/file_storage.py
+++ b/tools/memory_inspector/memory_inspector/data/file_storage.py
@@ -108,7 +108,7 @@ class Archive(object):
def StartNewSnapshot(self):
"""Creates a 2014-01-01_02:03:04.snapshot marker (an empty file)."""
- self._cur_snapshot = Archive._TimestampToStr(datetime.datetime.now())
+ self._cur_snapshot = Archive.TimestampToStr(datetime.datetime.now())
file_path = os.path.join(self._path,
self._cur_snapshot + Archive._SNAP_EXT)
assert(not os.path.exists(file_path))
@@ -136,7 +136,7 @@ class Archive(object):
def LoadMemMaps(self, timestamp):
assert(self.HasMemMaps(timestamp))
- snapshot_name = Archive._TimestampToStr(timestamp)
+ snapshot_name = Archive.TimestampToStr(timestamp)
file_path = os.path.join(self._path, snapshot_name + Archive._MMAP_EXT)
with open(file_path) as f:
return json.load(f, cls=serialization.MmapDecoder)
@@ -154,15 +154,19 @@ class Archive(object):
def LoadNativeHeap(self, timestamp):
assert(self.HasNativeHeap(timestamp))
- snapshot_name = Archive._TimestampToStr(timestamp)
+ snapshot_name = Archive.TimestampToStr(timestamp)
file_path = os.path.join(self._path, snapshot_name + Archive._NHEAP_EXT)
with open(file_path) as f:
return json.load(f, cls=serialization.NativeHeapDecoder)
def _HasSnapshotFile(self, timestamp, ext):
- name = Archive._TimestampToStr(timestamp)
+ name = Archive.TimestampToStr(timestamp)
return os.path.exists(os.path.join(self._path, name + ext))
@staticmethod
- def _TimestampToStr(timestamp):
- return timestamp.strftime(Archive._TIME_FMT)
+ def TimestampToStr(timestamp):
+ return timestamp.strftime(Archive._TIME_FMT)
+
+ @staticmethod
+ def StrToTimestamp(timestr):
+ return datetime.datetime.strptime(timestr, Archive._TIME_FMT)
« no previous file with comments | « no previous file | tools/memory_inspector/memory_inspector/frontends/www_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698