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] ) ), \ 79 PROFILE_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__ ) unsigned long profile_mean(struct profiler *profiler)
Get mean sample value.
unsigned int count
Number of samples.
const unsigned long * samples
Sample values.
Self-test infrastructure.
const char * name
Test set name.
A data structure for storing profiling information.
unsigned long profile_stddev(struct profiler *profiler)
Get sample standard deviation.
static void profile_test_exec(void)
Perform profiling self-tests.
#define okx(success, file, line)
Report test result.
unsigned long stddev
Expected standard deviation.
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
static void profile_okx(struct profile_test *test, const char *file, unsigned int line)
Report a profiling test result.
unsigned long mean
Expected mean sample value.
struct self_test profile_test __self_test
Profiling self-test.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define PROFILE_TEST(name, MEAN, STDDEV, SAMPLES)
Define a profiling test.
void profile_update(struct profiler *profiler, unsigned long sample)
Update profiler with a new sample.
#define DATA(...)
Define inline data.
unsigned long mean
Mean sample value (scaled)
void * memset(void *dest, int character, size_t len) __nonnull