MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / Timer

Class Timer

trinity/utils/timer.py:6–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class Timer:
7 def __init__(self, metrics_dict, key_name):
8 self.metrics = metrics_dict
9 self.key = key_name
10
11 def __enter__(self):
12 self.start_time = time.time()
13 return self
14
15 def __exit__(self, exc_type, exc_val, exc_tb):
16 end_time = time.time()
17 elapsed_time = end_time - self.start_time
18 self.metrics[self.key] = elapsed_time

Callers 13

_finish_explore_stepMethod · 0.90
_process_experiencesMethod · 0.90
sampleMethod · 0.90
sampleMethod · 0.90
sampleMethod · 0.90
train_stepMethod · 0.90
sync_weightMethod · 0.90
save_checkpointMethod · 0.90
train_stepMethod · 0.90
update_actorMethod · 0.85
update_criticMethod · 0.85
update_actorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected