Skip to content

Commit d3a2df0

Browse files
committed
Add the ability to append to the result json file for wallclock benchmarks (AI Generated)
1 parent e4b4542 commit d3a2df0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

core/src/walltime.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,25 @@ static void append_codspeed_benchmarks_to_json(
184184
continue;
185185
}
186186

187+
// State 0: Find the outer root object closure '}'
187188
if (state == 0 && ch == '}') {
188189
state = 1;
189190
continue;
190191
}
191192

193+
// State 1: Find the array list closure ']'
192194
if (state == 1 && ch == ']') {
193195
state = 2;
196+
// Truncate right here! This preserves whatever character came right before the array bracket ']'
197+
truncation_pos = pos;
194198
continue;
195199
}
196200

201+
// State 2: Check what the last character inside the array was
197202
if (state == 2) {
198203
if (ch == '[') {
199204
array_was_empty = true;
200205
}
201-
truncation_pos = pos + std::streamoff(1);
202206
break;
203207
}
204208
}

0 commit comments

Comments
 (0)