Skip to content
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

8256814: WeakProcessorPhases may be redundant #1862

Closed
wants to merge 6 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1FullGCAdjustTask.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1RootProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/oopStorageSet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/oopStorageSet.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/oopStorageSetParState.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/weakProcessor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
21 changes: 11 additions & 10 deletions src/hotspot/share/gc/shared/weakProcessorTimes.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@@ -50,7 +50,7 @@ WeakProcessorTimes::WeakProcessorTimes(uint max_threads) :
assert(_max_threads > 0, "max_threads must not be zero");

WorkerDataArray<double>** wpt = _worker_data;
for (auto id : EnumRange<WeakId>()) {
for (auto id : EnumRange<OopStorageSet::WeakId>()) {
assert(size_t(wpt - _worker_data) < ARRAY_SIZE(_worker_data), "invariant");
const char* description = OopStorageSet::storage(id)->name();
*wpt = new WorkerDataArray<double>(NULL, description, _max_threads);
@@ -99,26 +99,27 @@ void WeakProcessorTimes::record_total_time_sec(double time_sec) {
_total_time_sec = time_sec;
}

WorkerDataArray<double>* WeakProcessorTimes::worker_data(WeakId id) const {
size_t index = EnumRange<WeakId>().index(id);
WorkerDataArray<double>* WeakProcessorTimes::worker_data(OopStorageSet::WeakId id) const {
size_t index = EnumRange<OopStorageSet::WeakId>().index(id);
assert(index < ARRAY_SIZE(_worker_data), "invalid phase");
return _worker_data[index];
}

double WeakProcessorTimes::worker_time_sec(uint worker_id, WeakId id) const {
double WeakProcessorTimes::worker_time_sec(uint worker_id,
OopStorageSet::WeakId id) const {
assert(worker_id < active_workers(),
"invalid worker id %u for %u", worker_id, active_workers());
return worker_data(id)->get(worker_id);
}

void WeakProcessorTimes::record_worker_time_sec(uint worker_id,
WeakId id,
OopStorageSet::WeakId id,
double time_sec) {
worker_data(id)->set(worker_id, time_sec);
}

void WeakProcessorTimes::record_worker_items(uint worker_id,
WeakId id,
OopStorageSet::WeakId id,
size_t num_dead,
size_t num_total) {
WorkerDataArray<double>* data = worker_data(id);
@@ -143,7 +144,7 @@ WeakProcessorTimeTracker::~WeakProcessorTimeTracker() {
}

WeakProcessorParTimeTracker::WeakProcessorParTimeTracker(WeakProcessorTimes* times,
WeakId storage_id,
OopStorageSet::WeakId storage_id,
uint worker_id) :
_times(times),
_storage_id(storage_id),
@@ -174,7 +175,7 @@ static const char* indent_str(size_t i) {

#define TIME_FORMAT "%.1lfms"

void WeakProcessorTimes::log_summary(WeakId id, uint indent) const {
void WeakProcessorTimes::log_summary(OopStorageSet::WeakId id, uint indent) const {
LogTarget(Debug, gc, phases) lt;
LogStream ls(lt);
ls.print("%s", indents[indent]);
@@ -203,7 +204,7 @@ void WeakProcessorTimes::log_details(WorkerDataArray<T>* data, uint indent) cons

void WeakProcessorTimes::log_subtotals(uint indent) const {
if (log_is_enabled(Debug, gc, phases)) {
for (auto id : EnumRange<WeakId>()) {
for (auto id : EnumRange<OopStorageSet::WeakId>()) {
log_summary(id, indent);
}
}
31 changes: 14 additions & 17 deletions src/hotspot/share/gc/shared/weakProcessorTimes.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@@ -33,10 +33,6 @@
template<typename T> class WorkerDataArray;

class WeakProcessorTimes {
public:
using WeakId = OopStorageSet::WeakId;

private:
enum {
DeadItems,
TotalItems
@@ -48,10 +44,10 @@ class WeakProcessorTimes {
double _total_time_sec;

// Per-worker times and linked items.
WorkerDataArray<double>* _worker_data[EnumRange<WeakId>().size()];
WorkerDataArray<double>* worker_data(WeakId id) const;
WorkerDataArray<double>* _worker_data[EnumRange<OopStorageSet::WeakId>().size()];
WorkerDataArray<double>* worker_data(OopStorageSet::WeakId id) const;

void log_summary(WeakId id, uint indent) const;
void log_summary(OopStorageSet::WeakId id, uint indent) const;
template <typename T>
void log_details(WorkerDataArray<T>* data, uint indent) const;

@@ -64,11 +60,16 @@ class WeakProcessorTimes {
void set_active_workers(uint n);

double total_time_sec() const;
double worker_time_sec(uint worker_id, WeakId id) const;
double worker_time_sec(uint worker_id, OopStorageSet::WeakId id) const;

void record_total_time_sec(double time_sec);
void record_worker_time_sec(uint worker_id, WeakId id, double time_sec);
void record_worker_items(uint worker_id, WeakId id, size_t num_dead, size_t num_total);
void record_worker_time_sec(uint worker_id,
OopStorageSet::WeakId id,
double time_sec);
void record_worker_items(uint worker_id,
OopStorageSet::WeakId id,
size_t num_dead,
size_t num_total);

void reset();

@@ -90,12 +91,8 @@ class WeakProcessorTimeTracker : StackObj {
// Record time contribution for the current thread.
// Does nothing if times is NULL.
class WeakProcessorParTimeTracker : StackObj {
public:
using WeakId = OopStorageSet::WeakId;

private:
WeakProcessorTimes* _times;
WeakId _storage_id;
OopStorageSet::WeakId _storage_id;
uint _worker_id;
Ticks _start_time;

@@ -104,7 +101,7 @@ class WeakProcessorParTimeTracker : StackObj {
// only one thread).
// Precondition: worker_id < times->max_threads().
WeakProcessorParTimeTracker(WeakProcessorTimes* times,
WeakId storage_id,
OopStorageSet::WeakId storage_id,
uint worker_id);

~WeakProcessorParTimeTracker();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
* Copyright (c) 2019, 2021, Red Hat, Inc. 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
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
* Copyright (c) 2019, 2021, Red Hat, Inc. 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/jfr/leakprofiler/utilities/rootType.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/serviceThread.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
2 changes: 1 addition & 1 deletion test/hotspot/gtest/gc/shared/test_oopStorageSet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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