@@ -57,6 +57,8 @@ std::stringstream strout;
57
57
parse_options popts;
58
58
bool with_file_io = false ;
59
59
60
+ char const * external_command = nullptr ;
61
+
60
62
#if defined(__clang__)
61
63
string_view toolset = " clang" ;
62
64
#elif defined(__GNUC__)
@@ -173,6 +175,22 @@ print_prefix(
173
175
arch << " ," << impl.name ();
174
176
}
175
177
178
+ void
179
+ run_external (char const * op, file_item const & f)
180
+ {
181
+ if ( !external_command )
182
+ return ;
183
+
184
+ std::string command = external_command;
185
+ command += ' ' ;
186
+ command += op;
187
+ command += ' ' ;
188
+ command += toolset;
189
+ command += ' ' ;
190
+ command += f.name ;
191
+ (void )std::system ( command.c_str () );
192
+ }
193
+
176
194
void
177
195
bench (
178
196
string_view verb,
@@ -203,7 +221,10 @@ bench(
203
221
repeat = 1000 ;
204
222
for (unsigned k = 0 ; k < Trials; ++k)
205
223
{
224
+ run_external (" start" , vf[i]);
206
225
auto result = run_for (std::chrono::seconds (5 ), f);
226
+ run_external (" finish" , vf[i]);
227
+
207
228
result.calls *= repeat;
208
229
result.mbs = megabytes_per_second (
209
230
vf[i], result.calls , result.millis );
@@ -1159,6 +1180,8 @@ main(
1159
1180
return 4 ;
1160
1181
}
1161
1182
1183
+ external_command = std::getenv (" BOOST_JSON_BENCH_EXTERNAL_COMMAND" );
1184
+
1162
1185
file_list vf;
1163
1186
1164
1187
for ( int i = 1 ; i < argc; ++i )
0 commit comments