[speed-ext.c for tune/speed-ext peter@cordes.ca**20080325024627 Your darcs repo should be gmp-.../tune instead of tests/devel. Hardlinks should do the trick. Use the patch for Makefile.in. See the suggested command line in speed-ext.c ] { addfile ./Makefile.in.diff hunk ./Makefile.in.diff 1 +--- Makefile.in~ 2008-03-23 01:20:18.576446999 -0300 ++++ Makefile.in 2008-03-23 01:52:46.846474317 -0300 +@@ -106,7 +106,7 @@ + speed_dynamic_OBJECTS = $(am_speed_dynamic_OBJECTS) + speed_dynamic_LDADD = $(LDADD) + speed_dynamic_DEPENDENCIES = $(am__DEPENDENCIES_3) +-am_speed_ext_OBJECTS = speed-ext$U.$(OBJEXT) ++am_speed_ext_OBJECTS = speed-ext$U.$(OBJEXT) rshift.o + speed_ext_OBJECTS = $(am_speed_ext_OBJECTS) + speed_ext_LDADD = $(LDADD) + speed_ext_DEPENDENCIES = $(am__DEPENDENCIES_3) addfile ./speed-ext.c hunk ./speed-ext.c 1 +/* Speed-measuring for rshift functions + +Copyright 2008 Peter Cordes . License=GPL version >= 3. Share and enjoy. + +This file has the same name as the example speed-ext.c +so I don't have to change the Makefile(.in) so much to build it + +If you have more than 1 CPU core, you can dedicate core #2 to the benchmark like so: +make speed-ext; timeout -15 5 taskset 2 burnK7; time sudo nice --7 taskset 2 chrt -r 1 timeout -15 20 ./speed-ext -p 1000000 -c -s 1-30 rshift.8 + +burnK7 generates load to shift your CPU to full speed before the benchmark starts. +timeout sends a signal after the configured time. This is important to prevent a runaway realtime process, in case your system is handling kbd interrupts with that core or something. (it's cpu #1 on my system). +taskset pins the task to one CPU (also the load generator, so the right core clocks up.) +chrt is like nice but for realtime scheduling + +You should be able to get very reproducible cycle-accurate results this way. + +*/ + +#define SPEED_EXTRA_PROTOS \ +double speed_rshift_sse2_aligned (struct speed_params *s); \ +double speed_rshift_sse2 (struct speed_params *s); \ +double speed_rshift_core2 (struct speed_params *s); + +#define SPEED_EXTRA_ROUTINES \ + { "rshift", speed_rshift_core2, FLAG_R }, \ + { "rshift_sse2", speed_rshift_sse2, FLAG_R }, \ + { "rshift_sse2_aligned", speed_rshift_sse2_aligned, FLAG_R }, + + +#include "speed.c" + +mp_limb_t mpn_rshift_sse2_aligned(mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n, unsigned int count ); +mp_limb_t mpn_rshift_sse2(mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n, unsigned int count ); +mp_limb_t mpn_rshift_core2(mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n, unsigned int count ); + +double speed_rshift_sse2_aligned (struct speed_params *s){ + SPEED_ROUTINE_MPN_UNARY_1 (mpn_rshift_sse2_aligned); } +double speed_rshift_sse2 (struct speed_params *s){ + SPEED_ROUTINE_MPN_UNARY_1 (mpn_rshift_sse2); } +double speed_rshift_core2 (struct speed_params *s){ + SPEED_ROUTINE_MPN_UNARY_1 (mpn_rshift_core2); } }