optimum_benchmark/trackers/latency.py [338:355]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def elapsed(self):
        assert self.start_time is not None, "This method can only be called inside of a '.session()' context"

        return time.time() - self.start_time

    @contextmanager
    def track(self):
        if self.is_pytorch_cuda:
            start_event = torch.cuda.Event(enable_timing=True)
            end_event = torch.cuda.Event(enable_timing=True)

            start_event.record()
            yield
            end_event.record()
        else:
            start_event = time.perf_counter()
            yield
            end_event = time.perf_counter()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



optimum_benchmark/trackers/latency.py [515:532]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def elapsed(self):
        assert self.start_time is not None, "This method can only be called inside of a '.session()' context"

        return time.time() - self.start_time

    @contextmanager
    def track(self):
        if self.is_pytorch_cuda:
            start_event = torch.cuda.Event(enable_timing=True)
            end_event = torch.cuda.Event(enable_timing=True)

            start_event.record()
            yield
            end_event.record()
        else:
            start_event = time.perf_counter()
            yield
            end_event = time.perf_counter()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



