author | stefank |
Thu, 22 Feb 2018 18:36:32 +0100 | |
changeset 49048 | 4e8c86b75428 |
parent 47216 | 71c04702a3d5 |
child 52897 | 495c05ee2a9a |
permissions | -rw-r--r-- |
46795
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
1 |
/* |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
4 |
* |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
8 |
* |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
13 |
* accompanied this code). |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
14 |
* |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
18 |
* |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
21 |
* questions. |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
22 |
* |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
23 |
*/ |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
24 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_SHARED_WORKERDATAARRAY_HPP |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
26 |
#define SHARE_VM_GC_SHARED_WORKERDATAARRAY_HPP |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
27 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
28 |
#include "memory/allocation.hpp" |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
29 |
#include "utilities/debug.hpp" |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
30 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
31 |
class outputStream; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
32 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
33 |
template <class T> |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
34 |
class WorkerDataArray : public CHeapObj<mtGC> { |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
35 |
friend class WDAPrinter; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
36 |
public: |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
37 |
static const uint MaxThreadWorkItems = 3; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
38 |
private: |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
39 |
T* _data; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
40 |
uint _length; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
41 |
const char* _title; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
42 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
43 |
WorkerDataArray<size_t>* _thread_work_items[MaxThreadWorkItems]; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
44 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
45 |
public: |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
46 |
WorkerDataArray(uint length, const char* title); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
47 |
~WorkerDataArray(); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
48 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
49 |
void link_thread_work_items(WorkerDataArray<size_t>* thread_work_items, uint index = 0); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
50 |
void set_thread_work_item(uint worker_i, size_t value, uint index = 0); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
51 |
void add_thread_work_item(uint worker_i, size_t value, uint index = 0); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
52 |
WorkerDataArray<size_t>* thread_work_items(uint index = 0) const { |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
53 |
assert(index < MaxThreadWorkItems, "Tried to access thread work item %u max %u", index, MaxThreadWorkItems); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
54 |
return _thread_work_items[index]; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
55 |
} |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
56 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
57 |
static T uninitialized(); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
58 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
59 |
void set(uint worker_i, T value); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
60 |
T get(uint worker_i) const; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
61 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
62 |
void add(uint worker_i, T value); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
63 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
64 |
// The sum() and average() methods below consider uninitialized slots to be 0. |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
65 |
double average() const; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
66 |
T sum() const; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
67 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
68 |
const char* title() const { |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
69 |
return _title; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
70 |
} |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
71 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
72 |
void reset(); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
73 |
void set_all(T value); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
74 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
75 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
76 |
private: |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
77 |
class WDAPrinter { |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
78 |
public: |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
79 |
static void summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
80 |
static void summary(outputStream* out, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
81 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
82 |
static void details(const WorkerDataArray<double>* phase, outputStream* out); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
83 |
static void details(const WorkerDataArray<size_t>* phase, outputStream* out); |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
84 |
}; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
85 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
86 |
public: |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
87 |
void print_summary_on(outputStream* out, bool print_sum = true) const; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
88 |
void print_details_on(outputStream* out) const; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
89 |
}; |
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
90 |
|
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
diff
changeset
|
91 |
#endif // SHARE_VM_GC_SHARED_WORKERDATAARRAY_HPP |