class_docstr: Defines a Timer Protocol with `time` and `reset` methods and an attribute `recorded_durations` for storing timings.
docstr: A context manager for timing a code block.
  
  Args:
      action_name: the name under which to store the timing of what is enclosed in the context manager.
docstr_tok: ["A","context","manager","for","timing","a","code","block",".","Args",":","action_name",":","the","name","under","which","to","store","the","timing","of","what","is","enclosed","in","the","context","manager","."]
code: def time(self, action_name: str) -> Generator[None, None, None]:
      """
      A context manager for timing a code block.
  
      Args:
          action_name: the name under which to store the timing of what is enclosed in the context manager.
      """
      ...
  
imports: import datetime
  import logging
  import os
  from collections import defaultdict
  from contextlib import contextmanager
  from time import perf_counter
  from typing import Any, Dict, Generator, List, Optional, Protocol, runtime_checkable, Sequence, Tuple, TypeVar
  import numpy
  import torch
  import torch.distributed
  from tabulate import tabulate
  from torchtnt.utils.distributed import PGWrapper
label_desc: Use image node_id 1 for calling the TimerProtocol obj's underlying member method code with example usage: obj.time(action_name) without return types