53#define DATA(...) { __VA_ARGS__ }
56#define PROFILE_TEST( name, MEAN, STDDEV, SAMPLES ) \
57 static const unsigned long name ## _samples[] = SAMPLES; \
58 static struct profile_test name = { \
59 .samples = name ## _samples, \
60 .count = ( sizeof ( name ## _samples ) / \
61 sizeof ( name ## _samples [0] ) ), \
79PROFILE_TEST ( small, 5, 2,
DATA ( 3, 5, 9, 4, 3, 2, 5, 7 ) );
83 DATA ( 69772, 70068, 70769, 69653, 70663, 71078, 70101, 70341,
84 70215, 69600, 70020, 70456, 70421, 69972, 70267, 69999,
89 DATA ( 93510333UL, 93561169UL, 93492361UL, 93528647UL,
90 93557566UL, 93503465UL, 93540126UL, 93549020UL,
91 93502307UL, 93527320UL, 93537152UL, 93540125UL,
92 93550773UL, 93586731UL, 93521312UL ) );
102 unsigned int line ) {
105 unsigned long stddev;
112 for ( i = 0 ; i <
test->count ; i++ )
118 DBGC (
test,
"PROFILE calculated mean %ld stddev %ld\n",
mean, stddev );
120 okx ( stddev ==
test->stddev, file, line );
122#define profile_ok( test ) profile_okx ( test, __FILE__, __LINE__ )
#define DATA(...)
Define inline data.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
void * memset(void *dest, int character, size_t len) __nonnull
unsigned long profile_mean(struct profiler *profiler)
Get mean sample value.
unsigned long profile_stddev(struct profiler *profiler)
Get sample standard deviation.
void profile_update(struct profiler *profiler, unsigned long sample)
Update profiler with a new sample.
static void profile_okx(struct profile_test *test, const char *file, unsigned int line)
Report a profiling test result.
#define PROFILE_TEST(name, MEAN, STDDEV, SAMPLES)
Define a profiling test.
#define DATA(...)
Define inline data.
static void profile_test_exec(void)
Perform profiling self-tests.
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
unsigned long stddev
Expected standard deviation.
const unsigned long * samples
Sample values.
unsigned long mean
Expected mean sample value.
unsigned int count
Number of samples.
A data structure for storing profiling information.
unsigned long mean
Mean sample value (scaled)
Self-test infrastructure.
#define okx(success, file, line)
Report test result.
#define __self_test
Declare a self-test.