Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
dalvik
Commits
ecda5d85
Commit
ecda5d85
authored
12 years ago
by
Ian Rogers
Committed by
android code review
12 years ago
Browse files
Options
Download
Plain Diff
Merge "Fix for 6994917 GC is slower since JOO33B per FrameworkPerf test"
parents
b48569ac
33c8ae5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
vm/Misc.cpp
vm/Misc.cpp
+6
-1
vm/alloc/Heap.cpp
vm/alloc/Heap.cpp
+9
-11
vm/alloc/Heap.h
vm/alloc/Heap.h
+1
-1
No files found.
vm/Misc.cpp
View file @
ecda5d85
...
...
@@ -512,7 +512,12 @@ u8 dvmGetOtherThreadCpuTimeNsec(pthread_t thread)
*/
bool
dvmIterativeSleep
(
int
iteration
,
int
maxTotalSleep
,
u8
relStartTime
)
{
const
int
minSleep
=
10000
;
/*
* Minimum sleep is one millisecond, it is important to keep this value
* low to ensure short GC pauses since dvmSuspendAllThreads() uses this
* function.
*/
const
int
minSleep
=
1000
;
u8
curTime
;
int
curDelay
;
...
...
This diff is collapsed.
Click to expand it.
vm/alloc/Heap.cpp
View file @
ecda5d85
...
...
@@ -204,17 +204,13 @@ static void *tryMalloc(size_t size)
* lock, wait for the GC to complete, and retrying allocating.
*/
dvmWaitForConcurrentGcToComplete
();
ptr
=
dvmHeapSourceAlloc
(
size
);
if
(
ptr
!=
NULL
)
{
return
ptr
;
}
}
else
{
/*
* Try a foreground GC since a concurrent GC is not currently running.
*/
gcForMalloc
(
false
);
}
/*
* Another failure. Our thread was starved or there may be too
* many live objects. Try a foreground GC. This will have no
* effect if the concurrent GC is already running.
*/
gcForMalloc
(
false
);
ptr
=
dvmHeapSourceAlloc
(
size
);
if
(
ptr
!=
NULL
)
{
return
ptr
;
...
...
@@ -701,8 +697,9 @@ void dvmCollectGarbageInternal(const GcSpec* spec)
* suspend when the GC thread calls dvmUnlockHeap before dvmResumeAllThreads,
* but there's no risk of deadlock.)
*/
void
dvmWaitForConcurrentGcToComplete
()
bool
dvmWaitForConcurrentGcToComplete
()
{
bool
waited
=
gDvm
.
gcHeap
->
gcRunning
;
Thread
*
self
=
dvmThreadSelf
();
assert
(
self
!=
NULL
);
u4
start
=
dvmGetRelativeTimeMsec
();
...
...
@@ -715,4 +712,5 @@ void dvmWaitForConcurrentGcToComplete()
if
(
end
-
start
>
0
)
{
ALOGD
(
"WAIT_FOR_CONCURRENT_GC blocked %ums"
,
end
-
start
);
}
return
waited
;
}
This diff is collapsed.
Click to expand it.
vm/alloc/Heap.h
View file @
ecda5d85
...
...
@@ -92,7 +92,7 @@ void dvmCollectGarbageInternal(const GcSpec *spec);
* re-acquires the heap lock. After returning, no garbage collection
* will be in progress and the heap lock will be held by the caller.
*/
void
dvmWaitForConcurrentGcToComplete
(
void
);
bool
dvmWaitForConcurrentGcToComplete
(
void
);
/*
* Returns true iff <obj> points to a valid allocated object.
...
...
This diff is collapsed.
Click to expand it.
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