New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8252645: Change time measurements in G1ServiceThread to only account remembered set work #1447
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -482,27 +482,6 @@ class G1RemSetScanState : public CHeapObj<mtGC> { | |
} | ||
}; | ||
|
||
G1RemSet::G1RemSet(G1CollectedHeap* g1h, | ||
G1CardTable* ct, | ||
G1HotCardCache* hot_card_cache) : | ||
_scan_state(new G1RemSetScanState()), | ||
_prev_period_summary(false), | ||
_g1h(g1h), | ||
_ct(ct), | ||
_g1p(_g1h->policy()), | ||
_hot_card_cache(hot_card_cache), | ||
_sampling_task(NULL) { | ||
} | ||
|
||
G1RemSet::~G1RemSet() { | ||
delete _scan_state; | ||
delete _sampling_task; | ||
} | ||
|
||
void G1RemSet::initialize(uint max_reserved_regions) { | ||
_scan_state->initialize(max_reserved_regions); | ||
} | ||
|
||
class G1YoungRemSetSamplingClosure : public HeapRegionClosure { | ||
SuspendibleThreadSetJoiner* _sts; | ||
size_t _regions_visited; | ||
|
@@ -537,6 +516,19 @@ class G1YoungRemSetSamplingClosure : public HeapRegionClosure { | |
|
||
// Task handling young gen remembered set sampling. | ||
class G1RemSetSamplingTask : public G1ServiceTask { | ||
// Helper to account virtual time. | ||
class VTimer { | ||
double _start; | ||
public: | ||
VTimer() : _start(os::elapsedVTime()) { } | ||
double duration() { return os::elapsedVTime() - _start; } | ||
}; | ||
|
||
double _vtime_accum; // Accumulated virtual time. | ||
void update_vtime_accum(double duration) { | ||
_vtime_accum += duration; | ||
} | ||
|
||
// Sample the current length of remembered sets for young. | ||
// | ||
// At the end of the GC G1 determines the length of the young gen based on | ||
|
@@ -551,6 +543,7 @@ class G1RemSetSamplingTask : public G1ServiceTask { | |
void sample_young_list_rs_length(SuspendibleThreadSetJoiner* sts){ | ||
G1CollectedHeap* g1h = G1CollectedHeap::heap(); | ||
G1Policy* policy = g1h->policy(); | ||
VTimer vtime; | ||
|
||
if (policy->use_adaptive_young_list_length()) { | ||
G1YoungRemSetSamplingClosure cl(sts); | ||
|
@@ -562,6 +555,7 @@ class G1RemSetSamplingTask : public G1ServiceTask { | |
policy->revise_young_list_target_length_if_necessary(cl.sampled_rs_length()); | ||
} | ||
} | ||
update_vtime_accum(vtime.duration()); | ||
} | ||
|
||
// To avoid extensive rescheduling if the task is executed a bit early. The task is | ||
|
@@ -596,14 +590,48 @@ class G1RemSetSamplingTask : public G1ServiceTask { | |
sample_young_list_rs_length(&sts); | ||
schedule(G1ConcRefinementServiceIntervalMillis); | ||
} | ||
|
||
double vtime_accum() { | ||
// Only report vtime if supported by the os. | ||
if (!os::supports_vtime()) { | ||
return 0.0; | ||
} | ||
return _vtime_accum; | ||
} | ||
}; | ||
|
||
G1RemSet::G1RemSet(G1CollectedHeap* g1h, | ||
G1CardTable* ct, | ||
G1HotCardCache* hot_card_cache) : | ||
_scan_state(new G1RemSetScanState()), | ||
_prev_period_summary(false), | ||
_g1h(g1h), | ||
_ct(ct), | ||
_g1p(_g1h->policy()), | ||
_hot_card_cache(hot_card_cache), | ||
_sampling_task(NULL) { | ||
} | ||
|
||
G1RemSet::~G1RemSet() { | ||
delete _scan_state; | ||
delete _sampling_task; | ||
} | ||
|
||
void G1RemSet::initialize(uint max_reserved_regions) { | ||
_scan_state->initialize(max_reserved_regions); | ||
} | ||
|
||
void G1RemSet::initialize_sampling_task(G1ServiceThread* thread) { | ||
assert(_sampling_task == NULL, "Sampling task already initialized"); | ||
_sampling_task = new G1RemSetSamplingTask("Remembered Set Sampling Task"); | ||
thread->register_task(_sampling_task); | ||
} | ||
|
||
double G1RemSet::sampling_task_vtime() { | ||
assert(_sampling_task != NULL, "Must have been initialized"); | ||
return _sampling_task->vtime_accum(); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra newline. |
||
// Helper class to scan and detect ranges of cards that need to be scanned on the | ||
// card table. | ||
class G1CardTableScanner : public StackObj { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not completely sure why this moved but not
G1RemSet::initialize()
below.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The destructor had to move to see the type and I obviously took the constructor but missed
initialize()
. Certainly makes sense to move that one too.