1 /* 2 * Copyright (c) 2019, 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 #ifndef SHARE_UTILITIES_TABLE_STATISTICS_HPP 26 #define SHARE_UTILITIES_TABLE_STATISTICS_HPP 27 28 #include "memory/allocation.hpp" 29 #include "utilities/debug.hpp" 30 #include "utilities/globalDefinitions.hpp" 31 #include "utilities/numberSeq.hpp" 32 33 class TableRateStatistics : CHeapObj<mtStatistics> { 34 35 friend class TableStatistics; 36 37 private: 38 volatile size_t _added_items; 39 volatile size_t _removed_items; 40 41 jlong _time_stamp; 42 double _seconds_stamp; 43 size_t _added_items_stamp; 44 size_t _added_items_stamp_prev; 45 size_t _removed_items_stamp; 46 size_t _removed_items_stamp_prev; 47 48 public: 49 TableRateStatistics(); 50 ~TableRateStatistics(); 51 52 void add(); 53 void remove(); 54 55 protected: 56 void stamp(); 57 float get_add_rate(); 58 float get_remove_rate(); 59 }; 60 61 class TableStatistics : CHeapObj<mtStatistics> { 62 63 public: 64 size_t _literal_bytes; 65 66 size_t _number_of_buckets; 67 size_t _number_of_entries; 68 69 size_t _maximum_bucket_size; 70 float _average_bucket_size; 71 float _variance_of_bucket_size; 72 float _stddev_of_bucket_size; 73 74 size_t _bucket_bytes; 75 size_t _entry_bytes; 76 size_t _total_footprint; 77 78 size_t _bucket_size; 79 size_t _entry_size; 80 81 float _add_rate; 82 float _remove_rate; 83 84 TableStatistics(); 85 TableStatistics(TableRateStatistics& rate_stats, NumberSeq summary, size_t literal_bytes, size_t bucket_bytes, size_t node_bytes); 86 ~TableStatistics(); 87 88 void print(outputStream* st, const char *table_name); 89 }; 90 91 #endif // SHARE_UTILITIES_TABLE_STATISTICS_HPP