code: def test_record_event_durations(self):
      durations = {}  # Map event names to frequency.
  
      def increment_event_duration(event, duration):
          if event not in durations:
              durations[event] = 0.0
          durations[event] += duration
  
      monitoring.register_event_duration_secs_listener(
          increment_event_duration
      )
  
      monitoring.record_event_duration_secs("test_short_event", 1)
      monitoring.record_event_duration_secs("test_short_event", 2)
      monitoring.record_event_duration_secs("test_long_event", 10)
  
      self.assertDictEqual(
          durations, {"test_short_event": 3, "test_long_event": 10}
      )
  
file_path: jax/tests/monitoring_test.py
imports: from absl.testing import absltest
  from jax import monitoring
  from jax._src import monitoring
label_desc: Use image node_id 3 for calling the MonitoringTest obj's underlying member method code with example usage: obj.test_record_event_durations() without return types