Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
8a2d237f
Commit
8a2d237f
authored
Jul 29, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding memory reporting to vectors.
parent
e8d690f2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
118 deletions
+120
-118
src/misc/vec/vecBit.h
+16
-0
src/misc/vec/vecFlt.h
+16
-0
src/misc/vec/vecInt.h
+16
-0
src/misc/vec/vecPtr.h
+16
-0
src/misc/vec/vecStr.h
+16
-0
src/misc/vec/vecVec.h
+24
-118
src/misc/vec/vecWrd.h
+16
-0
No files found.
src/misc/vec/vecBit.h
View file @
8a2d237f
...
...
@@ -268,6 +268,22 @@ static inline int Vec_BitCap( Vec_Bit_t * p )
SeeAlso []
***********************************************************************/
static
inline
double
Vec_BitMemory
(
Vec_Bit_t
*
p
)
{
return
!
p
?
0
.
0
:
1
.
0
*
sizeof
(
int
)
*
p
->
nCap
+
sizeof
(
Vec_Bit_t
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Vec_BitEntry
(
Vec_Bit_t
*
p
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
...
...
src/misc/vec/vecFlt.h
View file @
8a2d237f
...
...
@@ -311,6 +311,22 @@ static inline int Vec_FltCap( Vec_Flt_t * p )
SeeAlso []
***********************************************************************/
static
inline
double
Vec_FltMemory
(
Vec_Flt_t
*
p
)
{
return
!
p
?
0
.
0
:
1
.
0
*
sizeof
(
float
)
*
p
->
nCap
+
sizeof
(
Vec_Flt_t
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
float
Vec_FltEntry
(
Vec_Flt_t
*
p
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
...
...
src/misc/vec/vecInt.h
View file @
8a2d237f
...
...
@@ -383,6 +383,22 @@ static inline int Vec_IntCap( Vec_Int_t * p )
SeeAlso []
***********************************************************************/
static
inline
double
Vec_IntMemory
(
Vec_Int_t
*
p
)
{
return
!
p
?
0
.
0
:
1
.
0
*
sizeof
(
int
)
*
p
->
nCap
+
sizeof
(
Vec_Int_t
)
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Vec_IntEntry
(
Vec_Int_t
*
p
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
...
...
src/misc/vec/vecPtr.h
View file @
8a2d237f
...
...
@@ -314,6 +314,22 @@ static inline int Vec_PtrCap( Vec_Ptr_t * p )
SeeAlso []
***********************************************************************/
static
inline
double
Vec_PtrMemory
(
Vec_Ptr_t
*
p
)
{
return
!
p
?
0
.
0
:
1
.
0
*
sizeof
(
void
*
)
*
p
->
nCap
+
sizeof
(
Vec_Ptr_t
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Vec_PtrCountZero
(
Vec_Ptr_t
*
p
)
{
int
i
,
Counter
=
0
;
...
...
src/misc/vec/vecStr.h
View file @
8a2d237f
...
...
@@ -305,6 +305,22 @@ static inline int Vec_StrCap( Vec_Str_t * p )
SeeAlso []
***********************************************************************/
static
inline
double
Vec_StrMemory
(
Vec_Str_t
*
p
)
{
return
!
p
?
0
.
0
:
1
.
0
*
sizeof
(
char
)
*
p
->
nCap
+
sizeof
(
Vec_Str_t
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
char
Vec_StrEntry
(
Vec_Str_t
*
p
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
...
...
src/misc/vec/vecVec.h
View file @
8a2d237f
...
...
@@ -197,18 +197,6 @@ static inline void Vec_VecExpand( Vec_Vec_t * p, int Level )
p
->
pArray
[
i
]
=
Vec_PtrAlloc
(
0
);
p
->
nSize
=
Level
+
1
;
}
/**Function*************************************************************
Synopsis [Allocates a vector with the given capacity.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
void
Vec_VecExpandInt
(
Vec_Vec_t
*
p
,
int
Level
)
{
int
i
;
...
...
@@ -284,18 +272,6 @@ static inline Vec_Ptr_t * Vec_VecEntry( Vec_Vec_t * p, int i )
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
return
(
Vec_Ptr_t
*
)
p
->
pArray
[
i
];
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
Vec_Int_t
*
Vec_VecEntryInt
(
Vec_Vec_t
*
p
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
...
...
@@ -313,9 +289,27 @@ static inline Vec_Int_t * Vec_VecEntryInt( Vec_Vec_t * p, int i )
SeeAlso []
***********************************************************************/
static
inline
void
*
Vec_VecEntryEntry
(
Vec_Vec_t
*
p
,
int
i
,
int
k
)
static
inline
double
Vec_VecMemory
(
Vec_Vec_t
*
p
)
{
return
Vec_PtrEntry
(
Vec_VecEntry
(
p
,
i
),
k
);
int
i
;
double
Mem
;
if
(
p
==
NULL
)
return
0
.
0
;
Mem
=
Vec_PtrMemory
(
(
Vec_Ptr_t
*
)
p
);
for
(
i
=
0
;
i
<
p
->
nSize
;
i
++
)
if
(
Vec_VecEntry
(
p
,
i
)
)
Mem
+=
Vec_PtrMemory
(
Vec_VecEntry
(
p
,
i
)
);
return
Mem
;
}
static
inline
double
Vec_VecMemoryInt
(
Vec_Vec_t
*
p
)
{
int
i
;
double
Mem
;
if
(
p
==
NULL
)
return
0
.
0
;
Mem
=
Vec_PtrMemory
(
(
Vec_Ptr_t
*
)
p
);
for
(
i
=
0
;
i
<
p
->
nSize
;
i
++
)
if
(
Vec_VecEntry
(
p
,
i
)
)
Mem
+=
Vec_IntMemory
(
Vec_VecEntryInt
(
p
,
i
)
);
return
Mem
;
}
/**Function*************************************************************
...
...
@@ -329,6 +323,10 @@ static inline void * Vec_VecEntryEntry( Vec_Vec_t * p, int i, int k )
SeeAlso []
***********************************************************************/
static
inline
void
*
Vec_VecEntryEntry
(
Vec_Vec_t
*
p
,
int
i
,
int
k
)
{
return
Vec_PtrEntry
(
Vec_VecEntry
(
p
,
i
),
k
);
}
static
inline
int
Vec_VecEntryEntryInt
(
Vec_Vec_t
*
p
,
int
i
,
int
k
)
{
return
Vec_IntEntry
(
Vec_VecEntryInt
(
p
,
i
),
k
);
...
...
@@ -393,18 +391,6 @@ static inline Vec_Vec_t * Vec_VecDup( Vec_Vec_t * p )
Vec_PtrPush
(
vNew
,
Vec_PtrDup
(
vVec
)
);
return
(
Vec_Vec_t
*
)
vNew
;
}
/**Function*************************************************************
Synopsis [Frees the vector.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
Vec_Vec_t
*
Vec_VecDupInt
(
Vec_Vec_t
*
p
)
{
Vec_Ptr_t
*
vNew
;
...
...
@@ -478,18 +464,6 @@ static inline void Vec_VecPush( Vec_Vec_t * p, int Level, void * Entry )
}
Vec_PtrPush
(
Vec_VecEntry
(
p
,
Level
),
Entry
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
void
Vec_VecPushInt
(
Vec_Vec_t
*
p
,
int
Level
,
int
Entry
)
{
if
(
p
->
nSize
<
Level
+
1
)
...
...
@@ -521,18 +495,6 @@ static inline void Vec_VecPushUnique( Vec_Vec_t * p, int Level, void * Entry )
else
Vec_PtrPushUnique
(
Vec_VecEntry
(
p
,
Level
),
Entry
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
void
Vec_VecPushUniqueInt
(
Vec_Vec_t
*
p
,
int
Level
,
int
Entry
)
{
if
(
p
->
nSize
<
Level
+
1
)
...
...
@@ -560,18 +522,6 @@ static int Vec_VecSortCompare1( Vec_Ptr_t ** pp1, Vec_Ptr_t ** pp2 )
return
1
;
return
0
;
}
/**Function*************************************************************
Synopsis [Comparison procedure for two integers.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
int
Vec_VecSortCompare2
(
Vec_Ptr_t
**
pp1
,
Vec_Ptr_t
**
pp2
)
{
if
(
Vec_PtrSize
(
*
pp1
)
>
Vec_PtrSize
(
*
pp2
)
)
...
...
@@ -621,18 +571,6 @@ static int Vec_VecSortCompare3( Vec_Int_t ** pp1, Vec_Int_t ** pp2 )
return
1
;
return
0
;
}
/**Function*************************************************************
Synopsis [Comparison procedure for two integers.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
int
Vec_VecSortCompare4
(
Vec_Int_t
**
pp1
,
Vec_Int_t
**
pp2
)
{
if
(
Vec_IntEntry
(
*
pp1
,
0
)
>
Vec_IntEntry
(
*
pp2
,
0
)
)
...
...
@@ -689,38 +627,6 @@ 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
#endif
...
...
src/misc/vec/vecWrd.h
View file @
8a2d237f
...
...
@@ -361,6 +361,22 @@ static inline int Vec_WrdCap( Vec_Wrd_t * p )
SeeAlso []
***********************************************************************/
static
inline
double
Vec_WrdMemory
(
Vec_Wrd_t
*
p
)
{
return
!
p
?
0
.
0
:
1
.
0
*
sizeof
(
word
)
*
p
->
nCap
+
sizeof
(
Vec_Wrd_t
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
word
Vec_WrdEntry
(
Vec_Wrd_t
*
p
,
int
i
)
{
assert
(
i
>=
0
&&
i
<
p
->
nSize
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment