diff --git a/Makefile b/Makefile index 4db95f1d..e02fb3f7 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ LIBSOURCES = fft_fftw.c libcsdr_wrapper.c #SOURCES = csdr.c $(LIBSOURCES) -cpufeature = $(if $(findstring $(1),$(shell cat /proc/cpuinfo)),$(2)) +cpufeature = $(if $(findstring $(1),$(shell list_cpu_features)),$(2)) PARAMS_SSE = $(call cpufeature,sse,-msse) $(call cpufeature,sse2,-msse2) $(call cpufeature,sse3,-msse3) $(call cpufeature,sse4a,-msse4a) $(call cpufeature,sse4_1,-msse4.1) $(call cpufeature,sse4_2,-msse4.2 -msse4) -mfpmath=sse PARAMS_NEON = -mfloat-abi=hard -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad -funsafe-math-optimizations -Wformat=0 -DNEON_OPTS #tnx Jan Szumiec for the Raspberry Pi support diff --git a/csdr.c b/csdr.c index 27dbf6dc..99bc0e8a 100755 --- a/csdr.c +++ b/csdr.c @@ -188,7 +188,11 @@ char usage[]= int env_csdr_fixed_bufsize = 1024; int env_csdr_fixed_big_bufsize = 1024*16; +#if !__linux__ +int env_csdr_dynamic_bufsize_on = 1; +#else int env_csdr_dynamic_bufsize_on = 0; +#endif int env_csdr_print_bufsizes = 0; int bigbufs = 0; @@ -366,11 +370,15 @@ int initialize_buffers() buffer_u8 = (unsigned char*)malloc(the_bufsize*sizeof(unsigned char)); buffer_i16 = (short*) malloc(the_bufsize*sizeof(short)); temp_f = (float*) malloc(the_bufsize*sizeof(float) * 4); + if(the_bufsize<=4096) //this is hacky, should be done correctly { +#if __linux__ fcntl(STDIN_FILENO, F_SETPIPE_SZ, 4096); fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 4096); +#endif } + return the_bufsize; } @@ -378,7 +386,9 @@ int sendbufsize(int size) { if(size<=4096) { +#if __linux__ fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 4096); +#endif } //The first word is a preamble, "csdr". //If the next csdr process detects it, sets the buffer size according to the second word @@ -424,8 +434,10 @@ int main(int argc, char *argv[]) if(argc<=1) return badsyntax(0); if(!strcmp(argv[1],"--help")) return badsyntax(0); +#if __linux__ fcntl(STDIN_FILENO, F_SETPIPE_SZ, 65536*32); fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 65536*32); +#endif //fprintf(stderr, "csdr: F_SETPIPE_SZ\n"); if(!strcmp(argv[1],"setbuf")) @@ -1793,15 +1805,31 @@ int main(int argc, char *argv[]) //initialize FFT library, and measure time errhead(); fprintf(stderr,"initializing... "); struct timespec start_time, end_time; +#if __FreeBSD__ + clock_gettime(CLOCK_MONOTONIC_FAST, &start_time); +#else clock_gettime(CLOCK_MONOTONIC_RAW, &start_time); +#endif FFT_PLAN_T* plan=make_fft_c2c(fft_size,input,output,1,benchmark); +#if __FreeBSD__ + clock_gettime(CLOCK_MONOTONIC_FAST, &end_time); +#else clock_gettime(CLOCK_MONOTONIC_RAW, &end_time); +#endif fprintf(stderr,"done in %g seconds.\n",TIME_TAKEN(start_time,end_time)); //do the actual measurement about the FFT +#if __FreeBSD__ + clock_gettime(CLOCK_MONOTONIC_FAST, &start_time); +#else clock_gettime(CLOCK_MONOTONIC_RAW, &start_time); +#endif for(int i=0;i