Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Open Source Software
Zipr Backend
Commits
da4d1ea3
Commit
da4d1ea3
authored
9 years ago
by
whh8b
Browse files
Options
Downloads
Patches
Plain Diff
Add GetFreeRanges() support.
parent
a219e09a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/zipr_mem_space.h
+2
-0
2 additions, 0 deletions
include/zipr_mem_space.h
src/memory_space.cpp
+20
-0
20 additions, 0 deletions
src/memory_space.cpp
with
22 additions
and
0 deletions
include/zipr_mem_space.h
+
2
−
0
View file @
da4d1ea3
...
@@ -51,6 +51,7 @@ class ZiprMemorySpace_t : public MemorySpace_t
...
@@ -51,6 +51,7 @@ class ZiprMemorySpace_t : public MemorySpace_t
void
MergeFreeRange
(
RangeAddress_t
addr
);
void
MergeFreeRange
(
RangeAddress_t
addr
);
RangeSet_t
::
iterator
FindFreeRange
(
RangeAddress_t
addr
);
RangeSet_t
::
iterator
FindFreeRange
(
RangeAddress_t
addr
);
Range_t
GetFreeRange
(
int
size
);
Range_t
GetFreeRange
(
int
size
);
std
::
list
<
Range_t
>
GetFreeRanges
(
size_t
size
=
0
);
std
::
pair
<
RangeSet_t
::
const_iterator
,
RangeSet_t
::
const_iterator
>
std
::
pair
<
RangeSet_t
::
const_iterator
,
RangeSet_t
::
const_iterator
>
GetNearbyFreeRanges
(
const
RangeAddress_t
hint
,
size_t
count
=
0
);
GetNearbyFreeRanges
(
const
RangeAddress_t
hint
,
size_t
count
=
0
);
void
AddFreeRange
(
Range_t
newRange
);
void
AddFreeRange
(
Range_t
newRange
);
...
@@ -105,6 +106,7 @@ class ZiprMemorySpace_t : public MemorySpace_t
...
@@ -105,6 +106,7 @@ class ZiprMemorySpace_t : public MemorySpace_t
RangeAddress_t
max_plopped
;
RangeAddress_t
max_plopped
;
RangeAddress_t
min_plopped
;
RangeAddress_t
min_plopped
;
ZiprBooleanOption_t
m_verbose
;
ZiprBooleanOption_t
m_verbose
;
static
bool
SortRangeBySize
(
const
Range_t
&
a
,
const
Range_t
&
b
);
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
src/memory_space.cpp
+
20
−
0
View file @
da4d1ea3
...
@@ -197,6 +197,26 @@ Range_t ZiprMemorySpace_t::GetLargeRange(void)
...
@@ -197,6 +197,26 @@ Range_t ZiprMemorySpace_t::GetLargeRange(void)
return
Range_t
(
0
,
0
);
return
Range_t
(
0
,
0
);
}
}
bool
ZiprMemorySpace_t
::
SortRangeBySize
(
const
Range_t
&
a
,
const
Range_t
&
b
)
{
return
(
a
.
GetEnd
()
-
a
.
GetStart
())
<=
(
b
.
GetEnd
()
-
b
.
GetStart
());
}
std
::
list
<
Range_t
>
ZiprMemorySpace_t
::
GetFreeRanges
(
size_t
size
)
{
list
<
Range_t
>
result
;
for
(
RangeSet_t
::
iterator
it
=
free_ranges
.
begin
();
it
!=
free_ranges
.
end
();
++
it
)
{
Range_t
r
=*
it
;
if
(
r
.
GetEnd
()
-
r
.
GetStart
()
>=
(
unsigned
)
size
)
result
.
push_back
(
r
);
}
result
.
sort
(
SortRangeBySize
);
return
result
;
}
Range_t
ZiprMemorySpace_t
::
GetFreeRange
(
int
size
)
Range_t
ZiprMemorySpace_t
::
GetFreeRange
(
int
size
)
{
{
vector
<
Range_t
>
v
;
vector
<
Range_t
>
v
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment