src/hotspot/share/utilities/tableStatistics.hpp
author stefank
Mon, 25 Nov 2019 12:33:15 +0100
changeset 59252 623722a6aeb9
parent 54764 865ec913f916
permissions -rw-r--r--
8234740: Harmonize parameter order in Atomic - cmpxchg Reviewed-by: rehn, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54764
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     1
/*
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     4
 *
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     7
 * published by the Free Software Foundation.
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     8
 *
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    13
 * accompanied this code).
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    14
 *
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    18
 *
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    21
 * questions.
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    22
 *
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    23
 */
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    24
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    25
#ifndef SHARE_UTILITIES_TABLE_STATISTICS_HPP
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    26
#define SHARE_UTILITIES_TABLE_STATISTICS_HPP
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    27
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    28
#include "memory/allocation.hpp"
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    29
#include "utilities/debug.hpp"
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    30
#include "utilities/globalDefinitions.hpp"
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    31
#include "utilities/numberSeq.hpp"
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    32
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    33
class TableRateStatistics : CHeapObj<mtStatistics> {
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    34
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    35
  friend class TableStatistics;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    36
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    37
private:
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    38
  volatile size_t _added_items;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    39
  volatile size_t _removed_items;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    40
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    41
  jlong _time_stamp;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    42
  double _seconds_stamp;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    43
  size_t _added_items_stamp;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    44
  size_t _added_items_stamp_prev;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    45
  size_t _removed_items_stamp;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    46
  size_t _removed_items_stamp_prev;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    47
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    48
public:
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    49
  TableRateStatistics();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    50
  ~TableRateStatistics();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    51
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    52
  void add();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    53
  void remove();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    54
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    55
protected:
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    56
  void stamp();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    57
  float get_add_rate();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    58
  float get_remove_rate();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    59
};
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    60
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    61
class TableStatistics : CHeapObj<mtStatistics> {
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    62
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    63
public:
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    64
  size_t _literal_bytes;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    65
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    66
  size_t _number_of_buckets;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    67
  size_t _number_of_entries;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    68
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    69
  size_t _maximum_bucket_size;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    70
  float _average_bucket_size;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    71
  float _variance_of_bucket_size;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    72
  float _stddev_of_bucket_size;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    73
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    74
  size_t _bucket_bytes;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    75
  size_t _entry_bytes;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    76
  size_t _total_footprint;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    77
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    78
  size_t _bucket_size;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    79
  size_t _entry_size;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    80
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    81
  float _add_rate;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    82
  float _remove_rate;
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    83
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    84
  TableStatistics();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    85
  TableStatistics(TableRateStatistics& rate_stats, NumberSeq summary, size_t literal_bytes, size_t bucket_bytes, size_t node_bytes);
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    86
  ~TableStatistics();
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    87
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    88
  void print(outputStream* st, const char *table_name);
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    89
};
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    90
865ec913f916 8185525: Add JFR event for DictionarySizes
gziemski
parents:
diff changeset
    91
#endif // SHARE_UTILITIES_TABLE_STATISTICS_HPP