X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_looplen.c;fp=tests%2Ftest_looplen.c;h=0000000000000000000000000000000000000000;hp=16674e76ac442343b77ea27d1994a5920cd6c9e7;hb=f5ab766ee2c8300cb00ca5878b1cb464f960a66d;hpb=a5bae03d59c22e57263b8610b9fed99738303cf0 diff --git a/tests/test_looplen.c b/tests/test_looplen.c deleted file mode 100644 index 16674e7..0000000 --- a/tests/test_looplen.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * test_looplen.c - * - * Userspace RCU library - test program - * - * Copyright February 2009 - Mathieu Desnoyers - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifndef DYNAMIC_LINK_TEST -#define _LGPL_SOURCE -#else -#define debug_yield_read() -#endif -#include - -static inline void loop_sleep(unsigned long loops) -{ - while (loops-- != 0) - caa_cpu_relax(); -} - -#define LOOPS 1048576 -#define TESTS 10 - -int main(int argc, char **argv) -{ - unsigned long i; - cycles_t time1, time2; - cycles_t time_tot = 0; - double cpl; - - for (i = 0; i < TESTS; i++) { - time1 = caa_get_cycles(); - loop_sleep(LOOPS); - time2 = caa_get_cycles(); - time_tot += time2 - time1; - } - cpl = ((double)time_tot) / (double)TESTS / (double)LOOPS; - - printf("CALIBRATION : %g cycles per loop\n", cpl); - printf("time_tot = %llu, LOOPS = %d, TESTS = %d\n", - time_tot, LOOPS, TESTS); - - return 0; -}