hotspot/src/share/vm/gc/g1/g1ErgoVerbose.hpp
author tschatzl
Wed, 25 Nov 2015 14:43:29 +0100
changeset 34300 6075c1e0e913
parent 34298 f3c9dcc5af96
permissions -rw-r--r--
8136679: JFR event for adaptive IHOP Reviewed-by: tbenson, mgerdin, sangheki, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30272
diff changeset
     2
 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     4
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     8
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    13
 * accompanied this code).
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    14
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    18
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    21
 * questions.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    22
 *
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    23
 */
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30272
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1ERGOVERBOSE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30272
diff changeset
    26
#define SHARE_VM_GC_G1_G1ERGOVERBOSE_HPP
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    27
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    28
#include "memory/allocation.hpp"
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    29
#include "utilities/debug.hpp"
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    30
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    31
// The log of G1's heuristic decisions comprises of a series of
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    32
// records which have a similar format in order to maintain
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    33
// consistency across records and ultimately easier parsing of the
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    34
// output, if we ever choose to do that. Each record consists of:
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    35
// * A time stamp to be able to easily correlate each record with
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    36
// other events.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    37
// * A unique string to allow us to easily identify such records.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    38
// * The name of the heuristic the record corresponds to.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    39
// * An action string which describes the action that G1 did or is
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    40
// about to do.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    41
// * An optional reason string which describes the reason for the
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    42
// action.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    43
// * An optional number of name/value pairs which contributed to the
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    44
// decision to take the action described in the record.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    45
//
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    46
// Each record is associated with a "tag" which is the combination of
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    47
// the heuristic the record corresponds to, as well as the min level
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    48
// of verboseness at which the record should be printed. The tag is
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    49
// checked against the current settings to determine whether the record
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    50
// should be printed or not.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    51
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    52
// The available verboseness levels.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    53
typedef enum {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    54
  // Determine which part of the tag is occupied by the level.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    55
  ErgoLevelShift = 8,
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    56
  ErgoLevelMask = ~((1 << ErgoLevelShift) - 1),
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    57
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    58
  // ErgoLow is 0 so that we don't have to explicitly or a heuristic
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    59
  // id with ErgoLow to keep its use simpler.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    60
  ErgoLow = 0,
10535
891f353a95c0 7089625: G1: policy for how many old regions to add to the CSet (when young gen is fixed) is broken
tonyp
parents: 10523
diff changeset
    61
  ErgoHigh = 1 << ErgoLevelShift
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    62
} ErgoLevel;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    63
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    64
// The available heuristics.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    65
typedef enum {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    66
  // Determines which part of the tag is occupied by the heuristic id.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    67
  ErgoHeuristicMask = ~ErgoLevelMask,
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    68
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    69
  ErgoHeapSizing = 0,
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    70
  ErgoCSetConstruction,
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    71
  ErgoConcCycles,
11249
b0c1cc35cafe 7113012: G1: rename not-fully-young GCs as "mixed"
tonyp
parents: 10535
diff changeset
    72
  ErgoMixedGCs,
33204
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 31592
diff changeset
    73
  ErgoTiming,
34298
f3c9dcc5af96 8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents: 33204
diff changeset
    74
  ErgoIHOP,
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    75
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    76
  ErgoHeuristicNum
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    77
} ErgoHeuristic;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    78
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    79
class G1ErgoVerbose : AllStatic {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    80
private:
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    81
  // Determines the minimum verboseness level at which records will be
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    82
  // printed.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    83
  static ErgoLevel _level;
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    84
  // Determines which heuristics are currently enabled.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    85
  static bool _enabled[ErgoHeuristicNum];
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    86
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    87
  static ErgoLevel extract_level(int tag) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    88
    return (ErgoLevel) (tag & ErgoLevelMask);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    89
  }
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    90
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    91
  static ErgoHeuristic extract_heuristic(int tag) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    92
    return (ErgoHeuristic) (tag & ErgoHeuristicMask);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    93
  }
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    94
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    95
public:
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    96
  // Needs to be explicitly called at GC initialization.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    97
  static void initialize();
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    98
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
    99
  static void set_level(ErgoLevel level);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   100
  static void set_enabled(ErgoHeuristic h, bool enabled);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   101
  // It is applied to all heuristics.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   102
  static void set_enabled(bool enabled);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   103
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   104
  static bool enabled(int tag) {
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   105
    ErgoLevel level = extract_level(tag);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   106
    ErgoHeuristic n = extract_heuristic(tag);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   107
    return level <= _level && _enabled[n];
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   108
  }
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   109
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   110
  // Extract the heuristic id from the tag and return a string with
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   111
  // its name.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   112
  static const char* to_string(int tag);
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   113
};
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   114
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   115
// The macros below generate the format string for values of different
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   116
// types and/or metrics.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   117
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   118
// The reason for the action is optional and is handled specially: the
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   119
// reason string is concatenated here so it's not necessary to pass it
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   120
// as a parameter.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   121
#define ergo_format_reason(_reason_) ", reason: " _reason_
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   122
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   123
// Single parameter format strings
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   124
#define ergo_format_str(_name_)      ", " _name_ ": %s"
12381
1438e0fbfa27 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 11756
diff changeset
   125
#define ergo_format_region(_name_)   ", " _name_ ": %u regions"
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   126
#define ergo_format_byte(_name_)     ", " _name_ ": " SIZE_FORMAT " bytes"
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   127
#define ergo_format_double(_name_)   ", " _name_ ": %1.2f"
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   128
#define ergo_format_perc(_name_)     ", " _name_ ": %1.2f %%"
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   129
#define ergo_format_ms(_name_)       ", " _name_ ": %1.2f ms"
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   130
#define ergo_format_size(_name_)     ", " _name_ ": " SIZE_FORMAT
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   131
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   132
// Double parameter format strings
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   133
#define ergo_format_byte_perc(_name_)                                   \
31592
43f48e165466 8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
bpittore
parents: 30764
diff changeset
   134
                             ", " _name_ ": " SIZE_FORMAT " bytes (%1.2f %%)"
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   135
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   136
// Generates the format string
11756
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   137
#define ergo_format(_extra_format_)                           \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   138
  " %1.3f: [G1Ergonomics (%s) %s" _extra_format_ "]"
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   139
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   140
// Conditionally, prints an ergonomic decision record. _extra_format_
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   141
// is the format string for the optional items we'd like to print
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   142
// (i.e., the decision's reason and any associated values). This
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   143
// string should be built up using the ergo_*_format macros (see
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   144
// above) to ensure consistency.
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   145
//
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   146
// Since we cannot rely on the compiler supporting variable argument
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   147
// macros, this macro accepts a fixed number of arguments and passes
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   148
// them to the print method. For convenience, we have wrapper macros
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   149
// below which take a specific number of arguments and set the rest to
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   150
// a default value.
11756
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   151
#define ergo_verbose_common(_tag_, _action_, _extra_format_,                \
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   152
                            _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \
11756
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   153
  do {                                                                      \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   154
    if (G1ErgoVerbose::enabled((_tag_))) {                                  \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   155
      gclog_or_tty->print_cr(ergo_format(_extra_format_),                   \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   156
                             os::elapsedTime(),                             \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   157
                             G1ErgoVerbose::to_string((_tag_)),             \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   158
                             (_action_),                                    \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   159
                             (_arg0_), (_arg1_), (_arg2_),                  \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   160
                             (_arg3_), (_arg4_), (_arg5_));                 \
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 11249
diff changeset
   161
    }                                                                       \
10523
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   162
  } while (0)
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   163
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   164
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   165
#define ergo_verbose6(_tag_, _action_, _extra_format_,                  \
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   166
                      _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_)   \
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   167
  ergo_verbose_common(_tag_, _action_, _extra_format_,                  \
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   168
                      _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_)
cdb54c167ab0 7050392: G1: Introduce flag to generate a log of the G1 ergonomic decisions
tonyp
parents:
diff changeset
   169
30272
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   170
#define ergo_verbose5(_tag_, _action_, _extra_format_,                  \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   171
                      _arg0_, _arg1_, _arg2_, _arg3_, _arg4_)           \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   172
  ergo_verbose6(_tag_, _action_, _extra_format_ "%s",                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   173
                _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   174
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   175
#define ergo_verbose4(_tag_, _action_, _extra_format_,                  \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   176
                      _arg0_, _arg1_, _arg2_, _arg3_)                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   177
  ergo_verbose5(_tag_, _action_, _extra_format_ "%s",                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   178
                _arg0_, _arg1_, _arg2_, _arg3_, "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   179
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   180
#define ergo_verbose3(_tag_, _action_, _extra_format_,                  \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   181
                      _arg0_, _arg1_, _arg2_)                           \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   182
  ergo_verbose4(_tag_, _action_, _extra_format_ "%s",                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   183
                _arg0_, _arg1_, _arg2_, "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   184
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   185
#define ergo_verbose2(_tag_, _action_, _extra_format_,                  \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   186
                      _arg0_, _arg1_)                                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   187
  ergo_verbose3(_tag_, _action_, _extra_format_ "%s",                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   188
                _arg0_, _arg1_, "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   189
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   190
#define ergo_verbose1(_tag_, _action_, _extra_format_,                  \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   191
                      _arg0_)                                           \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   192
  ergo_verbose2(_tag_, _action_, _extra_format_ "%s",                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   193
                _arg0_, "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   194
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   195
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   196
#define ergo_verbose0(_tag_, _action_, _extra_format_)                  \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   197
  ergo_verbose1(_tag_, _action_, _extra_format_ "%s",                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   198
                "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   199
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   200
#define ergo_verbose(_tag_, _action_)                                   \
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   201
  ergo_verbose0(_tag_, _action_, "")
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   202
8cbe337a692c 8042891: Format issues embedded in macros for two g1 source files
stefank
parents: 13482
diff changeset
   203
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30272
diff changeset
   204
#endif // SHARE_VM_GC_G1_G1ERGOVERBOSE_HPP