156 return _active_workers;
157 }
158
159 void set_active_workers(uint v) {
160 assert(v <= _total_workers,
161 "Trying to set more workers active than there are");
162 _active_workers = MIN2(v, _total_workers);
163 add_workers(false /* exit_on_failure */);
164 assert(v != 0, "Trying to set active workers to 0");
165 assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
166 "Unless dynamic should use total workers");
167 log_info(gc, task)("GC Workers: using %d out of %d", _active_workers, _total_workers);
168 }
169
170 // Add GC workers as needed.
171 void add_workers(bool initializing);
172
173 // Add GC workers as needed to reach the specified number of workers.
174 void add_workers(uint active_workers, bool initializing);
175
176 // Return the name of the thread in the work gang
177 char* worker_name(uint which);
178
179 // Return the Ith worker.
180 AbstractGangWorker* worker(uint i) const;
181
182 void threads_do(ThreadClosure* tc) const;
183
184 // Create a GC worker and install it into the work gang.
185 virtual AbstractGangWorker* install_worker(uint which);
186
187 // Debugging.
188 const char* name() const { return _name; }
189
190 // Printing
191 void print_worker_threads_on(outputStream *st) const;
192 void print_worker_threads() const {
193 print_worker_threads_on(tty);
194 }
195
196 protected:
197 virtual AbstractGangWorker* allocate_worker(uint which) = 0;
198 };
199
200 // An class representing a gang of workers.
|
156 return _active_workers;
157 }
158
159 void set_active_workers(uint v) {
160 assert(v <= _total_workers,
161 "Trying to set more workers active than there are");
162 _active_workers = MIN2(v, _total_workers);
163 add_workers(false /* exit_on_failure */);
164 assert(v != 0, "Trying to set active workers to 0");
165 assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
166 "Unless dynamic should use total workers");
167 log_info(gc, task)("GC Workers: using %d out of %d", _active_workers, _total_workers);
168 }
169
170 // Add GC workers as needed.
171 void add_workers(bool initializing);
172
173 // Add GC workers as needed to reach the specified number of workers.
174 void add_workers(uint active_workers, bool initializing);
175
176 // Return the Ith worker.
177 AbstractGangWorker* worker(uint i) const;
178
179 // Base name (without worker id #) of threads.
180 const char* group_name() { return name(); }
181
182 void threads_do(ThreadClosure* tc) const;
183
184 // Create a GC worker and install it into the work gang.
185 virtual AbstractGangWorker* install_worker(uint which);
186
187 // Debugging.
188 const char* name() const { return _name; }
189
190 // Printing
191 void print_worker_threads_on(outputStream *st) const;
192 void print_worker_threads() const {
193 print_worker_threads_on(tty);
194 }
195
196 protected:
197 virtual AbstractGangWorker* allocate_worker(uint which) = 0;
198 };
199
200 // An class representing a gang of workers.
|