MCPcopy Create free account
hub / github.com/git/git / ut_100timer

Function ut_100timer

t/helper/test-trace2.c:244–267  ·  view source on GitHub ↗

* Single-threaded timer test. Create several intervals using the * TEST1 timer. The test script can verify that an aggregate Trace2 * "timer" event is emitted indicating that we started+stopped the * timer the requested number of times. */

Source from the content-addressed store, hash-verified

242 * timer the requested number of times.
243 */
244static int ut_100timer(int argc, const char **argv)
245{
246 const char *usage_error =
247 "expect <count> <ms_delay>";
248
249 int count = 0;
250 int delay = 0;
251 int k;
252
253 if (argc != 2)
254 die("%s", usage_error);
255 if (get_i(&count, argv[0]))
256 die("%s", usage_error);
257 if (get_i(&delay, argv[1]))
258 die("%s", usage_error);
259
260 for (k = 0; k < count; k++) {
261 trace2_timer_start(TRACE2_TIMER_ID_TEST1);
262 sleep_millisec(delay);
263 trace2_timer_stop(TRACE2_TIMER_ID_TEST1);
264 }
265
266 return 0;
267}
268
269struct ut_101_data {
270 int count;

Callers

nothing calls this directly

Calls 5

trace2_timer_startFunction · 0.85
sleep_millisecFunction · 0.85
trace2_timer_stopFunction · 0.85
get_iFunction · 0.70
dieFunction · 0.50

Tested by

no test coverage detected