X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=debug%2Fsorter%2Fretros.c;h=073cd8b078e32c94174494ccada181af56d97671;hb=b5b7b2641b00a18b53c48a1335846133f1d53168;hp=52d4690b2e5ee772746c1b6c7313acf12c1dccca;hpb=bed5fbc254249bffa909516d82091ff68b1a5b63;p=libucw.git diff --git a/debug/sorter/retros.c b/debug/sorter/retros.c index 52d4690b..073cd8b0 100644 --- a/debug/sorter/retros.c +++ b/debug/sorter/retros.c @@ -1,10 +1,12 @@ /* - * An experiment with sorting algorithms + * Experiments with various sorting algorithms + * + * (c) 2007 Martin Mares */ #include "sherlock/sherlock.h" -#include "lib/getopt.h" -#include "lib/md5.h" +#include "ucw/getopt.h" +#include "ucw/md5.h" #include #include @@ -48,13 +50,13 @@ static int comp_ind(const void *x, const void *y) #define ASORT_ELT(i) a[i].key #define ASORT_SWAP(i,j) do { struct elt t=a[i]; a[i]=a[j]; a[j]=t; } while (0) #define ASORT_EXTRA_ARGS , struct elt *a -#include "lib/arraysort.h" +#include "ucw/arraysort.h" #define ASORT_PREFIX(x) asi_##x #define ASORT_KEY_TYPE u32 #define ASORT_ELT(i) ind[i]->key #define ASORT_SWAP(i,j) do { struct elt *t=ind[i]; ind[i]=ind[j]; ind[j]=t; } while (0) -#include "lib/arraysort.h" +#include "ucw/arraysort.h" static void r1_sort(void) { @@ -185,8 +187,8 @@ static void r1c_sse_sort(void) struct elt *ptrs[256], *x, *lim; ASSERT(sizeof(struct elt) == 16); - ASSERT(!((addr_int_t)alt & 15)); - ASSERT(!((addr_int_t)ary & 15)); + ASSERT(!((uintptr_t)alt & 15)); + ASSERT(!((uintptr_t)ary & 15)); x = ary; lim = ary + n; bzero(cnt, sizeof(cnt)); @@ -695,7 +697,8 @@ int main(int argc, char **argv) array0[i] = array1[i] = (struct elt) { 0 }; mk_ary(); - init_timer(); + timestamp_t timer; + init_timer(&timer); for (uns i=0; i<5; i++) { #if 1 @@ -708,9 +711,9 @@ int main(int argc, char **argv) ary[j] = alt[j]; #endif } - log(L_DEBUG, "memcpy: %d", get_timer()/10); + log(L_DEBUG, "memcpy: %d", get_timer(&timer)/10); -#define BENCH(type, name, func) mk_##type(); init_timer(); func; log(L_DEBUG, name ": %d", get_timer()); chk_##type() +#define BENCH(type, name, func) mk_##type(); init_timer(&timer); func; log(L_DEBUG, name ": %d", get_timer(&timer)); chk_##type() //BENCH(ary, "qsort", qsort(ary, n, sizeof(struct elt), comp)); //BENCH(ary, "arraysort", as_sort(n, ary));