< prev index next >

src/hotspot/share/cds/dumpAllocStats.cpp

Print this page

  1 /*
  2  * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  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
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"


 26 #include "cds/dumpAllocStats.hpp"
 27 #include "logging/log.hpp"
 28 #include "logging/logMessage.hpp"
 29 
 30 void DumpAllocStats::print_stats(int ro_all, int rw_all) {
 31   // symbols
 32   _counts[RO][SymbolHashentryType] = _symbol_stats.hashentry_count;
 33   _bytes [RO][SymbolHashentryType] = _symbol_stats.hashentry_bytes;
 34 
 35   _counts[RO][SymbolBucketType] = _symbol_stats.bucket_count;
 36   _bytes [RO][SymbolBucketType] = _symbol_stats.bucket_bytes;
 37 
 38   // strings
 39   _counts[RO][StringHashentryType] = _string_stats.hashentry_count;
 40   _bytes [RO][StringHashentryType] = _string_stats.hashentry_bytes;
 41 
 42   _counts[RO][StringBucketType] = _string_stats.bucket_count;
 43   _bytes [RO][StringBucketType] = _string_stats.bucket_bytes;
 44 
 45   int all_ro_count = 0;

 85   int all_bytes = all_ro_bytes + all_rw_bytes;
 86 
 87   double all_ro_perc = percent_of(all_ro_bytes, ro_all);
 88   double all_rw_perc = percent_of(all_rw_bytes, rw_all);
 89   double all_perc    = percent_of(all_bytes, ro_all + rw_all);
 90 
 91   msg.debug("%s", sep);
 92   msg.debug(fmt_stats, "Total",
 93                        all_ro_count, all_ro_bytes, all_ro_perc,
 94                        all_rw_count, all_rw_bytes, all_rw_perc,
 95                        all_count, all_bytes, all_perc);
 96 
 97   msg.flush();
 98 
 99   assert(all_ro_bytes == ro_all && all_rw_bytes == rw_all,
100          "everything should have been counted (used/counted: ro %d/%d, rw %d/%d",
101          ro_all, all_ro_bytes, rw_all, all_rw_bytes);
102 
103 #undef fmt_stats
104 
105   msg.debug("Class CP entries = %d, archived = %d (%3.1f%%)",
106             _num_klass_cp_entries, _num_klass_cp_entries_archived,
107             percent_of(_num_klass_cp_entries_archived, _num_klass_cp_entries));
108 
















109 }

  1 /*
  2  * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  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
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "cds/cdsConfig.hpp"
 27 #include "cds/classPreloader.hpp"
 28 #include "cds/dumpAllocStats.hpp"
 29 #include "logging/log.hpp"
 30 #include "logging/logMessage.hpp"
 31 
 32 void DumpAllocStats::print_stats(int ro_all, int rw_all) {
 33   // symbols
 34   _counts[RO][SymbolHashentryType] = _symbol_stats.hashentry_count;
 35   _bytes [RO][SymbolHashentryType] = _symbol_stats.hashentry_bytes;
 36 
 37   _counts[RO][SymbolBucketType] = _symbol_stats.bucket_count;
 38   _bytes [RO][SymbolBucketType] = _symbol_stats.bucket_bytes;
 39 
 40   // strings
 41   _counts[RO][StringHashentryType] = _string_stats.hashentry_count;
 42   _bytes [RO][StringHashentryType] = _string_stats.hashentry_bytes;
 43 
 44   _counts[RO][StringBucketType] = _string_stats.bucket_count;
 45   _bytes [RO][StringBucketType] = _string_stats.bucket_bytes;
 46 
 47   int all_ro_count = 0;

 87   int all_bytes = all_ro_bytes + all_rw_bytes;
 88 
 89   double all_ro_perc = percent_of(all_ro_bytes, ro_all);
 90   double all_rw_perc = percent_of(all_rw_bytes, rw_all);
 91   double all_perc    = percent_of(all_bytes, ro_all + rw_all);
 92 
 93   msg.debug("%s", sep);
 94   msg.debug(fmt_stats, "Total",
 95                        all_ro_count, all_ro_bytes, all_ro_perc,
 96                        all_rw_count, all_rw_bytes, all_rw_perc,
 97                        all_count, all_bytes, all_perc);
 98 
 99   msg.flush();
100 
101   assert(all_ro_bytes == ro_all && all_rw_bytes == rw_all,
102          "everything should have been counted (used/counted: ro %d/%d, rw %d/%d",
103          ro_all, all_ro_bytes, rw_all, all_rw_bytes);
104 
105 #undef fmt_stats
106 
107   msg.info("Class  CP entries = %6d, archived = %6d (%5.1f%%), excluded = %6d",
108            _num_klass_cp_entries, _num_klass_cp_entries_archived,
109            percent_of(_num_klass_cp_entries_archived, _num_klass_cp_entries),
110            _num_klass_cp_entries_excluded);
111   msg.info("Field  CP entries = %6d, archived = %6d (%5.1f%%), excluded = %6d",
112            _num_field_cp_entries, _num_field_cp_entries_archived,
113            percent_of(_num_field_cp_entries_archived, _num_field_cp_entries),
114            _num_field_cp_entries_excluded);
115   msg.info("Method CP entries = %6d, archived = %6d (%5.1f%%), excluded = %6d",
116            _num_method_cp_entries, _num_method_cp_entries_archived,
117            percent_of(_num_method_cp_entries_archived, _num_method_cp_entries),
118            _num_method_cp_entries_excluded);
119   msg.info("Indy   CP entries = %6d, archived = %6d (%5.1f%%), excluded = %6d",
120            _num_indy_cp_entries, _num_indy_cp_entries_archived,
121            percent_of(_num_indy_cp_entries_archived, _num_indy_cp_entries),
122            _num_indy_cp_entries_excluded);
123   msg.info("Platform loader initiated classes = %5d", ClassPreloader::num_platform_initiated_classes());
124   msg.info("App      loader initiated classes = %5d", ClassPreloader::num_app_initiated_classes());
125   msg.info("Dynamic proxy classes             = %5d%s", _num_dynamic_proxy_classes,
126            CDSConfig::is_dumping_full_module_graph() ? "" : " (not archiving FMG)");
127 }
< prev index next >