mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-10 12:37:09 +00:00
8385991: Use StringTable's statistics method in Dictionary
Reviewed-by: jsikstro, coleenp
This commit is contained in:
parent
a1ff7b16d4
commit
2e364c3a06
@ -31,7 +31,10 @@
|
||||
#include "memory/metaspaceClosure.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "runtime/interfaceSupport.inline.hpp"
|
||||
#include "runtime/timerTrace.hpp"
|
||||
#include "utilities/concurrentHashTable.inline.hpp"
|
||||
#include "utilities/concurrentHashTableTasks.inline.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#include "utilities/tableStatistics.hpp"
|
||||
|
||||
@ -239,10 +242,24 @@ void Dictionary::verify() {
|
||||
}
|
||||
|
||||
void Dictionary::print_table_statistics(outputStream* st, const char* table_name) {
|
||||
static TableStatistics ts;
|
||||
TableStatistics stats;
|
||||
auto sz = [&] (InstanceKlass** val) {
|
||||
return sizeof(**val);
|
||||
};
|
||||
ts = _table->statistics_get(Thread::current(), sz, ts);
|
||||
ts.print(st, table_name);
|
||||
Thread* thread = Thread::current();
|
||||
ConcurrentTable::StatisticsTask sts(_table);
|
||||
if (!sts.prepare(thread)) {
|
||||
st->print_cr("Failed to take statistics");
|
||||
return;
|
||||
}
|
||||
TraceTime timer("GetStatistics", TRACETIME_LOG(Debug, perf));
|
||||
while (sts.do_task(thread, sz)) {
|
||||
sts.pause(thread);
|
||||
if (thread->is_Java_thread()) {
|
||||
ThreadBlockInVM tbivm(JavaThread::cast(thread));
|
||||
}
|
||||
sts.cont(thread);
|
||||
}
|
||||
stats = sts.done(thread);
|
||||
stats.print(st, table_name);
|
||||
}
|
||||
|
||||
@ -654,17 +654,20 @@ public:
|
||||
// VM.systemdictionary -verbose: for dumping the system dictionary table
|
||||
//
|
||||
class VM_DumpHashtable : public VM_Operation {
|
||||
public:
|
||||
enum DumpKind {
|
||||
DumpSymbols,
|
||||
DumpStrings,
|
||||
DumpSysDict
|
||||
};
|
||||
|
||||
private:
|
||||
outputStream* _out;
|
||||
int _which;
|
||||
DumpKind _which;
|
||||
bool _verbose;
|
||||
|
||||
public:
|
||||
enum {
|
||||
DumpSymbols = 1 << 0,
|
||||
DumpStrings = 1 << 1,
|
||||
DumpSysDict = 1 << 2 // not implemented yet
|
||||
};
|
||||
VM_DumpHashtable(outputStream* out, int which, bool verbose) {
|
||||
VM_DumpHashtable(outputStream* out, DumpKind which, bool verbose) {
|
||||
_out = out;
|
||||
_which = which;
|
||||
_verbose = verbose;
|
||||
|
||||
@ -534,11 +534,6 @@ class ConcurrentHashTable : public CHeapObj<MT> {
|
||||
template <typename EVALUATE_FUNC, typename DELETE_FUNC>
|
||||
void bulk_delete(Thread* thread, EVALUATE_FUNC& eval_f, DELETE_FUNC& del_f);
|
||||
|
||||
// Gets statistics if available, if not return old one. Item sizes are calculated with
|
||||
// VALUE_SIZE_FUNC.
|
||||
template <typename VALUE_SIZE_FUNC>
|
||||
TableStatistics statistics_get(Thread* thread, VALUE_SIZE_FUNC& vs_f, TableStatistics old);
|
||||
|
||||
// Moves all nodes from this table to to_cht with new hash code.
|
||||
// Must be done at a safepoint.
|
||||
void rehash_nodes_to(Thread* thread, ConcurrentHashTable<CONFIG, MT>* to_cht);
|
||||
|
||||
@ -1266,22 +1266,6 @@ inline TableStatistics ConcurrentHashTable<CONFIG, MT>::
|
||||
}
|
||||
}
|
||||
|
||||
template <typename CONFIG, MemTag MT>
|
||||
template <typename VALUE_SIZE_FUNC>
|
||||
inline TableStatistics ConcurrentHashTable<CONFIG, MT>::
|
||||
statistics_get(Thread* thread, VALUE_SIZE_FUNC& vs_f, TableStatistics old)
|
||||
{
|
||||
if (!try_resize_lock(thread)) {
|
||||
return old;
|
||||
}
|
||||
InternalTable* table = get_table();
|
||||
NumberSeq summary;
|
||||
size_t literal_bytes = 0;
|
||||
|
||||
internal_statistics_range(thread, 0, table->_size, vs_f, summary, literal_bytes);
|
||||
return internal_statistics_epilog(thread, summary, literal_bytes);
|
||||
}
|
||||
|
||||
template <typename CONFIG, MemTag MT>
|
||||
inline void ConcurrentHashTable<CONFIG, MT>::
|
||||
rehash_nodes_to(Thread* thread, ConcurrentHashTable<CONFIG, MT>* to_cht)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user