From a38a1f8913d9b2dc2e2a1b0a76673960fb362d65 Mon Sep 17 00:00:00 2001 From: ishachirimar Date: Mon, 15 Apr 2024 11:33:14 -0400 Subject: [PATCH] add start epoch time to TorchXEvent Differential Revision: D56037935 Pull Request resolved: https://github.com/pytorch/torchx/pull/882 --- torchx/runner/events/__init__.py | 2 ++ torchx/runner/events/api.py | 1 + 2 files changed, 3 insertions(+) diff --git a/torchx/runner/events/__init__.py b/torchx/runner/events/__init__.py index 2ebc0dc9f..d3af0b7c4 100644 --- a/torchx/runner/events/__init__.py +++ b/torchx/runner/events/__init__.py @@ -91,10 +91,12 @@ def __init__( ) self._start_cpu_time_ns = 0 self._start_wall_time_ns = 0 + self._start_epoch_time_usec = 0 def __enter__(self) -> "log_event": self._start_cpu_time_ns = time.process_time_ns() self._start_wall_time_ns = time.perf_counter_ns() + self._start_epoch_time_usec = int(time.time() * 1000) return self def __exit__( diff --git a/torchx/runner/events/api.py b/torchx/runner/events/api.py index db76f3f3d..70e8f2791 100644 --- a/torchx/runner/events/api.py +++ b/torchx/runner/events/api.py @@ -46,6 +46,7 @@ class TorchxEvent: source: SourceType = SourceType.UNKNOWN cpu_time_usec: Optional[int] = None wall_time_usec: Optional[int] = None + start_epoch_time_usec: Optional[int] = None def __str__(self) -> str: return self.serialize()