FLINT3.7.0-dev

prof_repeat

Synopsis#include <flint/profiler.h>
void prof_repeat(double * min, double * max, profile_target_t target, void * arg)source

Measures 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, &params). As the times are derived from clock 0, the remarks above about FLINT_CLOCKSPEED apply.

Cite this page

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).