File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,17 +76,21 @@ func (m *MockRecorder) RecordedTokenUsages() []*recorder.TokenUsageRecord {
7676
7777// TotalInputTokens returns the sum of input tokens across all recorded token usages.
7878func (m * MockRecorder ) TotalInputTokens () int64 {
79+ m .mu .Lock ()
80+ defer m .mu .Unlock ()
7981 var total int64
80- for _ , el := range m .RecordedTokenUsages () {
82+ for _ , el := range m .tokenUsages {
8183 total += el .Input
8284 }
8385 return total
8486}
8587
8688// TotalOutputTokens returns the sum of output tokens across all recorded token usages.
8789func (m * MockRecorder ) TotalOutputTokens () int64 {
90+ m .mu .Lock ()
91+ defer m .mu .Unlock ()
8892 var total int64
89- for _ , el := range m .RecordedTokenUsages () {
93+ for _ , el := range m .tokenUsages {
9094 total += el .Output
9195 }
9296 return total
You can’t perform that action at this time.
0 commit comments