diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-03-02 01:15:40 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-03-02 01:15:40 -0800 |
commit | c47dc99a9402b57762073a786ac71027509a537b (patch) | |
tree | 75d4fcec2189de17af1ba72bc0961b8c969b386d /src/misc/util | |
parent | 4db9c63627301329530465ea459588a98411f79b (diff) | |
download | abc-c47dc99a9402b57762073a786ac71027509a537b.tar.gz abc-c47dc99a9402b57762073a786ac71027509a537b.tar.bz2 abc-c47dc99a9402b57762073a786ac71027509a537b.zip |
Redirecting printf messages.
Diffstat (limited to 'src/misc/util')
-rw-r--r-- | src/misc/util/abc_global.h | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index 318bc912..17b3e37c 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -200,12 +200,12 @@ typedef ABC_UINT64_T word; #define ABC_SWAP(Type, a, b) { Type t = a; a = b; b = t; } -#define ABC_PRT(a,t) (printf("%s = ", (a)), printf("%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))) -#define ABC_PRTr(a,t) (printf("%s = ", (a)), printf("%7.2f sec\r", (float)(t)/(float)(CLOCKS_PER_SEC))) -#define ABC_PRTn(a,t) (printf("%s = ", (a)), printf("%6.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC))) -#define ABC_PRTP(a,t,T) (printf("%s = ", (a)), printf("%7.2f sec (%6.2f %%)\n", (float)(t)/(float)(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0)) -#define ABC_PRM(a,f) (printf("%s = ", (a)), printf("%7.3f Mb ", 1.0*(f)/(1<<20))) -#define ABC_PRMP(a,f,F) (printf("%s = ", (a)), printf("%7.3f Mb (%6.2f %%) ", (1.0*(f)/(1<<20)), ((F)? 100.0*(f)/(F) : 0.0) ) ) +#define ABC_PRT(a,t) (Abc_Print(1, "%s = ", (a)), printf("%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))) +#define ABC_PRTr(a,t) (Abc_Print(1, "%s = ", (a)), printf("%7.2f sec\r", (float)(t)/(float)(CLOCKS_PER_SEC))) +#define ABC_PRTn(a,t) (Abc_Print(1, "%s = ", (a)), printf("%6.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC))) +#define ABC_PRTP(a,t,T) (Abc_Print(1, "%s = ", (a)), printf("%7.2f sec (%6.2f %%)\n", (float)(t)/(float)(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0)) +#define ABC_PRM(a,f) (Abc_Print(1, "%s = ", (a)), printf("%7.3f Mb ", 1.0*(f)/(1<<20))) +#define ABC_PRMP(a,f,F) (Abc_Print(1, "%s = ", (a)), printf("%7.3f Mb (%6.2f %%) ", (1.0*(f)/(1<<20)), ((F)? 100.0*(f)/(F) : 0.0) ) ) #define ABC_ALLOC(type, num) ((type *) malloc(sizeof(type) * (num))) #define ABC_CALLOC(type, num) ((type *) calloc((num), sizeof(type))) @@ -280,28 +280,16 @@ static inline void Abc_Print( int level, const char * format, ... ) static inline void Abc_PrintTime( int level, const char * pStr, int time ) { - if ( level == ABC_ERROR ) - printf( "Error: " ); - else if ( level == ABC_WARNING ) - printf( "Warning: " ); ABC_PRT( pStr, time ); } static inline void Abc_PrintTimeP( int level, const char * pStr, int time, int Time ) { - if ( level == ABC_ERROR ) - printf( "Error: " ); - else if ( level == ABC_WARNING ) - printf( "Warning: " ); ABC_PRTP( pStr, time, Time ); } static inline void Abc_PrintMemoryP( int level, const char * pStr, int time, int Time ) { - if ( level == ABC_ERROR ) - printf( "Error: " ); - else if ( level == ABC_WARNING ) - printf( "Warning: " ); ABC_PRMP( pStr, time, Time ); } |