double longrunning_rotation() { // We're going to be doing a bunch of rotations; we probably shouldn't // let the user see all the verbose output. test_verbose = false; // There's probably some great reason why this exact size was chosen for // the test bit array; however, if there is, it's been lost to // history. // const size_t bit_sz = 10000 * 1024 * 8 + 471; const size_t bit_sz = 12 * 1024 * 8 + 471; testutil_newrand(bit_sz, 0); const clockmark_t start_time = ktiming_getmark(); testutil_rotate(0, bit_sz, -bit_sz / 4); testutil_rotate(0, bit_sz, bit_sz / 4); testutil_rotate(0, bit_sz, bit_sz / 2); const clockmark_t end_time = ktiming_getmark(); // Arguably, we should set test_verbose back to whatever it was before // we started. However, since we're never going to be running more than // one performance test at a time (or performance tests at the same time // as functional tests), we can just let it be. return ktiming_diff_usec(&start_time, &end_time) / 1000000000.0; }
/* A sample long-running set of flip count operations. */ double longrunning_flipcount(void) { test_verbose = false; size_t bit_sz = 128 * 1024 * 1024 * 8 + 531; testutil_newrand(bit_sz, 0); clockmark_t time1 = ktiming_getmark(); for (int i = 0; i < 20; i++) bitarray_count_flips(test_ba, 0, bit_sz); clockmark_t time2 = ktiming_getmark(); return ktiming_diff_usec(&time1, &time2) / 1000000000.0; }
/* A sample long-running set of rotation operations. */ double longrunning_rotation(void) { test_verbose = false; size_t bit_sz = 12 * 1024 * 8 + 471; testutil_newrand(bit_sz, 0); clockmark_t time1 = ktiming_getmark(); testutil_rotate(0, bit_sz, (ssize_t) -bit_sz / 4); testutil_rotate(0, bit_sz, bit_sz / 4); testutil_rotate(0, bit_sz, bit_sz / 2); clockmark_t time2 = ktiming_getmark(); return ktiming_diff_usec(&time1, &time2) / 1000000000.0; }