Skip to content

Commit

Permalink
add start epoch time to TorchXEvent
Browse files Browse the repository at this point in the history
Differential Revision: D56037935

Pull Request resolved: #882
  • Loading branch information
ishachirimar authored Apr 15, 2024
1 parent 8a18b70 commit a38a1f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchx/runner/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
1 change: 1 addition & 0 deletions torchx/runner/events/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a38a1f8

Please sign in to comment.