prof_repeat
#include <flint/profiler.h>void prof_repeat(double * min, double * max, profile_target_t target, void * arg)sourceMeasures the time of one run of target: calls target(arg, count) repeatedly, adjusting count so that each call takes about DURATION_TARGET microseconds of clock 0, until five calls have taken more than DURATION_THRESHOLD microseconds. Sets *min and *max to the smallest and largest time per run, in microseconds, of these five calls. Either pointer may be NULL.
The number of runs per call starts at 4 and changes by at most 25% from one call to the next. A typical target function is:
typedef struct { ulong a, b; } myfunc_t;
void sample_myfunc(void * arg, ulong count)
{
myfunc_t * params = (myfunc_t *) arg;
ulong i;
prof_start();
for (i = 0; i < count; i++)
myfunc(params->a, params->b);
prof_stop();
}
which is then measured with prof_repeat(&min, &max, sample_myfunc, ¶ms). As the times are derived from clock 0, the remarks above about FLINT_CLOCKSPEED apply.
The FLINT team, “prof_repeat (profiler.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/profiler/prof_repeat.html (generated 2026-10-20).
@misc{flint-doc-profiler-prof-repeat,
author = {{The FLINT team}},
title = {{prof\_repeat (profiler.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/profiler/prof_repeat.html},
note = {Generated 2026-10-20}
}