diff options
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/util/abc_global.h | 14 | ||||
-rw-r--r-- | src/misc/vec/vecBit.h | 16 | ||||
-rw-r--r-- | src/misc/vec/vecFlt.h | 16 | ||||
-rw-r--r-- | src/misc/vec/vecPtr.h | 16 | ||||
-rw-r--r-- | src/misc/vec/vecSet.h | 4 | ||||
-rw-r--r-- | src/misc/vec/vecStr.h | 16 | ||||
-rw-r--r-- | src/misc/vec/vecVec.h | 47 | ||||
-rw-r--r-- | src/misc/vec/vecWrd.h | 16 |
8 files changed, 137 insertions, 8 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index 5f0e1232..9524c505 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -205,12 +205,14 @@ typedef ABC_UINT64_T word; #define ABC_SWAP(Type, a, b) { Type t = a; a = b; b = t; } -#define ABC_PRT(a,t) (Abc_Print(1, "%s = ", (a)), Abc_Print(1, "%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))) -#define ABC_PRTr(a,t) (Abc_Print(1, "%s = ", (a)), Abc_Print(1, "%7.2f sec\r", (float)(t)/(float)(CLOCKS_PER_SEC))) -#define ABC_PRTn(a,t) (Abc_Print(1, "%s = ", (a)), Abc_Print(1, "%6.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC))) -#define ABC_PRTP(a,t,T) (Abc_Print(1, "%s = ", (a)), Abc_Print(1, "%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)), Abc_Print(1, "%7.3f Mb ", 1.0*(f)/(1<<20))) -#define ABC_PRMP(a,f,F) (Abc_Print(1, "%s = ", (a)), Abc_Print(1, "%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)), Abc_Print(1, "%9.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC))) +#define ABC_PRTr(a,t) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec\r", (float)(t)/(float)(CLOCKS_PER_SEC))) +#define ABC_PRTn(a,t) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC))) +#define ABC_PRTP(a,t,T) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.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)), Abc_Print(1, "%10.3f Mb\n", 1.0*(f)/(1<<20))) +#define ABC_PRMr(a,f) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f Mb\r", 1.0*(f)/(1<<20))) +#define ABC_PRMn(a,f) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f Mb ", 1.0*(f)/(1<<20))) +#define ABC_PRMP(a,f,F) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f Mb (%6.2f %%)\n", (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))) diff --git a/src/misc/vec/vecBit.h b/src/misc/vec/vecBit.h index 7f0d7409..4024d0ee 100644 --- a/src/misc/vec/vecBit.h +++ b/src/misc/vec/vecBit.h @@ -252,6 +252,22 @@ static inline int Vec_BitSize( Vec_Bit_t * p ) SeeAlso [] ***********************************************************************/ +static inline int Vec_BitCap( Vec_Bit_t * p ) +{ + return p->nCap; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline int Vec_BitEntry( Vec_Bit_t * p, int i ) { assert( i >= 0 && i < p->nSize ); diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h index 0ad6da27..19423ae0 100644 --- a/src/misc/vec/vecFlt.h +++ b/src/misc/vec/vecFlt.h @@ -295,6 +295,22 @@ static inline int Vec_FltSize( Vec_Flt_t * p ) SeeAlso [] ***********************************************************************/ +static inline int Vec_FltCap( Vec_Flt_t * p ) +{ + return p->nCap; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline float Vec_FltEntry( Vec_Flt_t * p, int i ) { assert( i >= 0 && i < p->nSize ); diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index afad09d1..1d60ec50 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -298,6 +298,22 @@ static inline int Vec_PtrSize( Vec_Ptr_t * p ) SeeAlso [] ***********************************************************************/ +static inline int Vec_PtrCap( Vec_Ptr_t * p ) +{ + return p->nCap; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline int Vec_PtrCountZero( Vec_Ptr_t * p ) { int i, Counter = 0; diff --git a/src/misc/vec/vecSet.h b/src/misc/vec/vecSet.h index df2a9a68..72358ea1 100644 --- a/src/misc/vec/vecSet.h +++ b/src/misc/vec/vecSet.h @@ -189,9 +189,9 @@ static inline void Vec_SetFree( Vec_Set_t * p ) SeeAlso [] ***********************************************************************/ -static inline int Vec_ReportMemory( Vec_Set_t * p ) +static inline double Vec_ReportMemory( Vec_Set_t * p ) { - int Mem = sizeof(Vec_Set_t); + double Mem = sizeof(Vec_Set_t); Mem += p->nPagesAlloc * sizeof(void *); Mem += sizeof(word) * (1 << p->nPageSize) * (1 + p->iPage); return Mem; diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index c794dc2f..cefa0ea9 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -289,6 +289,22 @@ static inline int Vec_StrSize( Vec_Str_t * p ) SeeAlso [] ***********************************************************************/ +static inline int Vec_StrCap( Vec_Str_t * p ) +{ + return p->nCap; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline char Vec_StrEntry( Vec_Str_t * p, int i ) { assert( i >= 0 && i < p->nSize ); diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h index 8bed4574..6d309dc4 100644 --- a/src/misc/vec/vecVec.h +++ b/src/misc/vec/vecVec.h @@ -247,6 +247,22 @@ static inline int Vec_VecSize( Vec_Vec_t * p ) SeeAlso [] ***********************************************************************/ +static inline int Vec_VecCap( Vec_Vec_t * p ) +{ + return p->nCap; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline int Vec_VecLevelSize( Vec_Vec_t * p, int i ) { return Vec_PtrSize( (Vec_Ptr_t *)p->pArray[i] ); @@ -673,6 +689,37 @@ static inline void Vec_VecPrintInt( Vec_Vec_t * p, int fSkipSingles ) } } +/**Function************************************************************* + + Synopsis [Returns memory, in bytes, used by the vector.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline double Vec_VecMemory( Vec_Vec_t * p ) +{ + int i; + Vec_Ptr_t * vVec; + double Mem = sizeof(Vec_Vec_t); + Mem += Vec_VecCap(p) * sizeof(void *); + Vec_VecForEachLevel( p, vVec, i ) + Mem += sizeof(Vec_Ptr_t) + Vec_PtrCap(vVec) * sizeof(void *); + return Mem; +} +static inline double Vec_VecMemoryInt( Vec_Vec_t * p ) +{ + int i; + Vec_Int_t * vVec; + double Mem = sizeof(Vec_Vec_t); + Mem += Vec_VecCap(p) * sizeof(void *); + Vec_VecForEachLevelInt( p, vVec, i ) + Mem += sizeof(Vec_Int_t) + Vec_IntCap(vVec) * sizeof(int); + return Mem; +} ABC_NAMESPACE_HEADER_END diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h index 11414ff7..97296401 100644 --- a/src/misc/vec/vecWrd.h +++ b/src/misc/vec/vecWrd.h @@ -345,6 +345,22 @@ static inline int Vec_WrdSize( Vec_Wrd_t * p ) SeeAlso [] ***********************************************************************/ +static inline int Vec_WrdCap( Vec_Wrd_t * p ) +{ + return p->nCap; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline word Vec_WrdEntry( Vec_Wrd_t * p, int i ) { assert( i >= 0 && i < p->nSize ); |