< prev index next >
src/hotspot/share/gc/shared/workerManager.hpp
Print this page
rev 52689 : 8213224: Move code related to GC threads calculation out of AdaptiveSizePolicy
Summary: Consolidate code related to GC threads calculation into a single class
*** 1,7 ****
/*
! * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 23,33 ****
*/
#ifndef SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
#define SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
! #include "gc/shared/adaptiveSizePolicy.hpp"
class WorkerManager : public AllStatic {
public:
// Create additional workers as needed.
// active_workers - number of workers being requested for an upcoming
--- 23,37 ----
*/
#ifndef SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
#define SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
! #include "logging/log.hpp"
! #include "memory/allocation.hpp"
! #include "runtime/os.inline.hpp"
! #include "runtime/thread.inline.hpp"
! #include "utilities/globalDefinitions.hpp"
class WorkerManager : public AllStatic {
public:
// Create additional workers as needed.
// active_workers - number of workers being requested for an upcoming
*** 49,58 ****
--- 53,79 ----
static uint add_workers (WorkerType* holder,
uint active_workers,
uint total_workers,
uint created_workers,
os::ThreadType worker_type,
+ bool initializing);
+
+ // Log (at trace level) a change in the number of created workers.
+ template <class WorkerType>
+ static void log_worker_creation(WorkerType* holder,
+ uint previous_created_workers,
+ uint active_workers,
+ uint created_workers,
+ bool initializing);
+ };
+
+ template <class WorkerType>
+ uint WorkerManager::add_workers(WorkerType* holder,
+ uint active_workers,
+ uint total_workers,
+ uint created_workers,
+ os::ThreadType worker_type,
bool initializing) {
uint start = created_workers;
uint end = MIN2(active_workers, total_workers);
for (uint worker_id = start; worker_id < end; worker_id += 1) {
WorkerThread* new_worker = NULL;
*** 77,98 ****
log_trace(gc, task)("WorkerManager::add_workers() : "
"created_workers: %u", created_workers);
return created_workers;
! }
! // Log (at trace level) a change in the number of created workers.
! template <class WorkerType>
! static void log_worker_creation(WorkerType* holder,
uint previous_created_workers,
uint active_workers,
uint created_workers,
bool initializing) {
if (previous_created_workers < created_workers) {
const char* initializing_msg = initializing ? "Adding initial" : "Creating additional";
log_trace(gc, task)("%s %s(s) previously created workers %u active workers %u total created workers %u",
initializing_msg, holder->group_name(), previous_created_workers, active_workers, created_workers);
}
! }
! };
#endif // SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
--- 98,118 ----
log_trace(gc, task)("WorkerManager::add_workers() : "
"created_workers: %u", created_workers);
return created_workers;
! }
! template <class WorkerType>
! void WorkerManager::log_worker_creation(WorkerType* holder,
uint previous_created_workers,
uint active_workers,
uint created_workers,
bool initializing) {
if (previous_created_workers < created_workers) {
const char* initializing_msg = initializing ? "Adding initial" : "Creating additional";
log_trace(gc, task)("%s %s(s) previously created workers %u active workers %u total created workers %u",
initializing_msg, holder->group_name(), previous_created_workers, active_workers, created_workers);
}
! }
!
#endif // SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
< prev index next >