31 #include "runtime/os.hpp"
32
33 // Total virtual time so far.
34 inline double G1ConcurrentMarkThread::total_mark_cpu_time_s() {
35 return static_cast<double>(os::thread_cpu_time(this)) / NANOSECS_PER_SEC + worker_threads_cpu_time_s();
36 }
37
38 // Marking virtual time so far
39 inline double G1ConcurrentMarkThread::worker_threads_cpu_time_s() {
40 return _cm->worker_threads_cpu_time_s();
41 }
42
43 inline bool G1ConcurrentMarkThread::is_in_full_concurrent_cycle() const {
44 ServiceState st = state();
45 return (st == FullCycleMarking || st == FullCycleRebuildOrScrub || st == FullCycleResetForNextCycle);
46 }
47
48 inline void G1ConcurrentMarkThread::set_idle() {
49 // Concurrent cycle may be aborted any time.
50 assert(!is_idle(), "must not be idle");
51 _state.store_relaxed(Idle);
52 }
53
54 inline void G1ConcurrentMarkThread::start_full_cycle() {
55 assert(SafepointSynchronize::is_at_safepoint(), "must be");
56 assert(is_idle(), "cycle in progress");
57 _state.store_relaxed(FullCycleMarking);
58 }
59
60 inline void G1ConcurrentMarkThread::start_undo_cycle() {
61 assert(SafepointSynchronize::is_at_safepoint(), "must be");
62 assert(is_idle(), "cycle in progress");
63 _state.store_relaxed(UndoCycleResetForNextCycle);
64 }
65
66 inline void G1ConcurrentMarkThread::set_full_cycle_rebuild_and_scrub() {
67 assert(SafepointSynchronize::is_at_safepoint(), "must be");
68 assert(state() == FullCycleMarking, "must be");
69 _state.store_relaxed(FullCycleRebuildOrScrub);
70 }
71
72 inline void G1ConcurrentMarkThread::set_full_cycle_reset_for_next_cycle() {
73 assert(SafepointSynchronize::is_at_safepoint(), "must be");
74 assert(state() == FullCycleRebuildOrScrub, "must be");
75 _state.store_relaxed(FullCycleResetForNextCycle);
76 }
77
78 inline bool G1ConcurrentMarkThread::is_in_marking() const {
79 return state() == FullCycleMarking;
80 }
81
82 inline bool G1ConcurrentMarkThread::is_in_marking_or_rebuild() const {
83 ServiceState st = state();
84 return st == FullCycleMarking || st == FullCycleRebuildOrScrub;
85 }
86
87 inline bool G1ConcurrentMarkThread::is_in_reset_for_next_cycle() const {
88 ServiceState st = state();
89 return st == FullCycleResetForNextCycle || st == UndoCycleResetForNextCycle;
90 }
91
92 inline bool G1ConcurrentMarkThread::is_idle() const {
93 return state() == Idle;
94 }
95
|
31 #include "runtime/os.hpp"
32
33 // Total virtual time so far.
34 inline double G1ConcurrentMarkThread::total_mark_cpu_time_s() {
35 return static_cast<double>(os::thread_cpu_time(this)) / NANOSECS_PER_SEC + worker_threads_cpu_time_s();
36 }
37
38 // Marking virtual time so far
39 inline double G1ConcurrentMarkThread::worker_threads_cpu_time_s() {
40 return _cm->worker_threads_cpu_time_s();
41 }
42
43 inline bool G1ConcurrentMarkThread::is_in_full_concurrent_cycle() const {
44 ServiceState st = state();
45 return (st == FullCycleMarking || st == FullCycleRebuildOrScrub || st == FullCycleResetForNextCycle);
46 }
47
48 inline void G1ConcurrentMarkThread::set_idle() {
49 // Concurrent cycle may be aborted any time.
50 assert(!is_idle(), "must not be idle");
51 set_state(Idle);
52 }
53
54 inline void G1ConcurrentMarkThread::start_full_cycle() {
55 assert(SafepointSynchronize::is_at_safepoint(), "must be");
56 assert(is_idle(), "cycle in progress");
57 set_state(FullCycleMarking);
58 }
59
60 inline void G1ConcurrentMarkThread::start_undo_cycle() {
61 assert(SafepointSynchronize::is_at_safepoint(), "must be");
62 assert(is_idle(), "cycle in progress");
63 set_state(UndoCycleResetForNextCycle);
64 }
65
66 inline void G1ConcurrentMarkThread::set_full_cycle_rebuild_and_scrub() {
67 assert(SafepointSynchronize::is_at_safepoint(), "must be");
68 assert(state() == FullCycleMarking, "must be");
69 set_state(FullCycleRebuildOrScrub);
70 }
71
72 inline void G1ConcurrentMarkThread::set_full_cycle_reset_for_next_cycle() {
73 assert(SafepointSynchronize::is_at_safepoint(), "must be");
74 assert(state() == FullCycleRebuildOrScrub, "must be");
75 set_state(FullCycleResetForNextCycle);
76 }
77
78 inline bool G1ConcurrentMarkThread::is_in_marking() const {
79 return state() == FullCycleMarking;
80 }
81
82 inline bool G1ConcurrentMarkThread::is_in_marking_or_rebuild() const {
83 ServiceState st = state();
84 return st == FullCycleMarking || st == FullCycleRebuildOrScrub;
85 }
86
87 inline bool G1ConcurrentMarkThread::is_in_reset_for_next_cycle() const {
88 ServiceState st = state();
89 return st == FullCycleResetForNextCycle || st == UndoCycleResetForNextCycle;
90 }
91
92 inline bool G1ConcurrentMarkThread::is_idle() const {
93 return state() == Idle;
94 }
95
|