#include <sys/time.h>
#include <sys/sysinfo.h>
#include "bench-timing.h"
+#include "bench-util.h"
#include "json-lib.h"
static bench_lock_t lock;
#define START_ITERS 1000
-#pragma GCC push_options
-#pragma GCC optimize(1)
-
-static int __attribute__ ((noinline)) fibonacci (int i)
+static int __attribute__ ((noinline)) attribute_optimize (1)
+fibonacci (int i)
{
asm("");
if (i > 2)
}
static void
+attribute_optimize (1)
do_filler (void)
{
char buf1[512], buf2[512];
}
static void
+attribute_optimize (1)
do_filler_shared (void)
{
static char buf1[512], buf2[512];
memcpy (buf1, buf2, f);
}
-#pragma GCC pop_options
-
#define UNIT_WORK_CRT do_filler_shared ()
#define UNIT_WORK_NON_CRT do_filler ()
#include <sys/time.h>
#include <math.h>
#include "bench-timing.h"
+#include "bench-util.h"
#include "json-lib.h"
/* The point of this benchmark is to measure the overhead of an empty
total time each test iteration takes, so as to not swamp the useful
timings. */
-#pragma GCC push_options
-#pragma GCC optimize(1)
-
-static int __attribute__((noinline))
+static int __attribute__((noinline)) attribute_optimize (1)
fibonacci (int i)
{
asm("");
return 10+i;
}
-static void
+static void attribute_optimize (1)
do_filler (void)
{
static char buf1[512], buf2[512];
memcpy (buf1, buf2, f);
}
-#pragma GCC pop_options
-
static timing_t
test_mutex (long iters, int filler)
{
__v; \
})
+#if __GNUC_PREREQ (4, 4) || __glibc_has_attribute (__optimize__)
+# define attribute_optimize(level) __attribute__ ((optimize (level)))
+#else
+# define attribute_optimize(level)
+#endif
+
#ifndef START_ITER
# define START_ITER (100000000)
#endif