src/hotspot/share/classfile/compactHashtable.cpp
changeset 48962 88ad6c676c87
parent 47765 b7c7428eaab9
child 49592 77fb0be7d19f
equal deleted inserted replaced
48961:120b61d50f85 48962:88ad6c676c87
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   144   int table_bytes = _stats->bucket_bytes + _stats->hashentry_bytes;
   144   int table_bytes = _stats->bucket_bytes + _stats->hashentry_bytes;
   145   address base_address = address(MetaspaceShared::shared_rs()->base());
   145   address base_address = address(MetaspaceShared::shared_rs()->base());
   146   cht->init(base_address,  _num_entries, _num_buckets,
   146   cht->init(base_address,  _num_entries, _num_buckets,
   147             _compact_buckets->data(), _compact_entries->data());
   147             _compact_buckets->data(), _compact_entries->data());
   148 
   148 
   149   if (log_is_enabled(Info, cds, hashtables)) {
   149   LogMessage(cds, hashtables) msg;
   150     ResourceMark rm;
   150   if (msg.is_info()) {
   151     LogMessage(cds, hashtables) msg;
       
   152     stringStream info_stream;
       
   153 
       
   154     double avg_cost = 0.0;
   151     double avg_cost = 0.0;
   155     if (_num_entries > 0) {
   152     if (_num_entries > 0) {
   156       avg_cost = double(table_bytes)/double(_num_entries);
   153       avg_cost = double(table_bytes)/double(_num_entries);
   157     }
   154     }
   158     info_stream.print_cr("Shared %s table stats -------- base: " PTR_FORMAT,
   155     msg.info("Shared %s table stats -------- base: " PTR_FORMAT,
   159                          table_name, (intptr_t)base_address);
   156                          table_name, (intptr_t)base_address);
   160     info_stream.print_cr("Number of entries       : %9d", _num_entries);
   157     msg.info("Number of entries       : %9d", _num_entries);
   161     info_stream.print_cr("Total bytes used        : %9d", table_bytes);
   158     msg.info("Total bytes used        : %9d", table_bytes);
   162     info_stream.print_cr("Average bytes per entry : %9.3f", avg_cost);
   159     msg.info("Average bytes per entry : %9.3f", avg_cost);
   163     info_stream.print_cr("Average bucket size     : %9.3f", summary.avg());
   160     msg.info("Average bucket size     : %9.3f", summary.avg());
   164     info_stream.print_cr("Variance of bucket size : %9.3f", summary.variance());
   161     msg.info("Variance of bucket size : %9.3f", summary.variance());
   165     info_stream.print_cr("Std. dev. of bucket size: %9.3f", summary.sd());
   162     msg.info("Std. dev. of bucket size: %9.3f", summary.sd());
   166     info_stream.print_cr("Empty buckets           : %9d", _num_empty_buckets);
   163     msg.info("Empty buckets           : %9d", _num_empty_buckets);
   167     info_stream.print_cr("Value_Only buckets      : %9d", _num_value_only_buckets);
   164     msg.info("Value_Only buckets      : %9d", _num_value_only_buckets);
   168     info_stream.print_cr("Other buckets           : %9d", _num_other_buckets);
   165     msg.info("Other buckets           : %9d", _num_other_buckets);
   169     msg.info("%s", info_stream.as_string());
       
   170   }
   166   }
   171 }
   167 }
   172 
   168 
   173 /////////////////////////////////////////////////////////////
   169 /////////////////////////////////////////////////////////////
   174 //
   170 //