code: def mock_train_loop(monitor):
      # simulate lit-gpt style loop
      total_lengths = 0
      total_t0 = 0.0  # fake times
      micro_batch_size = 3
      for iter_num in range(1, 6):
          # forward + backward + step + zero_grad ...
          t1 = iter_num + 0.5
          total_lengths += 3 * 2
          monitor.update(
              time=t1 - total_t0,
              batches=iter_num,
              samples=iter_num * micro_batch_size,
              lengths=total_lengths,
              flops=10,
          )
          monitor.compute_and_log()
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_throughput.py
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric import Fabric
  from lightning.fabric.plugins import Precision
  from lightning.fabric.utilities.throughput import Throughput, ThroughputMonitor, _MonotonicWindow, get_available_flops, measure_flops
  from tests_fabric.helpers.runif import RunIf
  from tests_fabric.test_fabric import BoringModel
label_desc: Use image node_id 5 for calling a global function with example usage: mock_train_loop(monitor) without return types