hotspot/src/share/vm/gc/g1/workerDataArray.hpp
author jprovino
Tue, 02 Aug 2016 16:39:33 -0400
changeset 40328 a2851f5f1cf6
parent 37214 bc4e0e0995e6
child 46571 c70b36f0730d
permissions -rw-r--r--
8071770: G1 does not implement millis_since_last_gc which is needed by RMI GC Summary: G1 does not return a correct value for the CollectedHeap::millis_since_last_gc Reviewed-by: jmasa, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     1
/*
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     4
 *
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     8
 *
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    13
 * accompanied this code).
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    14
 *
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    18
 *
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    21
 * questions.
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    22
 *
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    23
 */
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    24
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    25
#ifndef SHARE_VM_GC_G1_WORKERDATAARRAY_HPP
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    26
#define SHARE_VM_GC_G1_WORKERDATAARRAY_HPP
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    27
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    28
#include "memory/allocation.hpp"
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    29
#include "utilities/debug.hpp"
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    30
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    31
class outputStream;
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    32
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    33
template <class T>
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    34
class WorkerDataArray  : public CHeapObj<mtGC> {
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    35
  friend class WDAPrinter;
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    36
  T*          _data;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    37
  uint        _length;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    38
  const char* _title;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    39
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    40
  WorkerDataArray<size_t>* _thread_work_items;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    41
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    42
 public:
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    43
  WorkerDataArray(uint length, const char* title);
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    44
  ~WorkerDataArray();
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    45
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    46
  void link_thread_work_items(WorkerDataArray<size_t>* thread_work_items);
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    47
  void set_thread_work_item(uint worker_i, size_t value);
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    48
  WorkerDataArray<size_t>* thread_work_items() const {
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    49
    return _thread_work_items;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    50
  }
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    51
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    52
  static T uninitialized();
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    53
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    54
  void set(uint worker_i, T value);
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    55
  T get(uint worker_i) const;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    56
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    57
  void add(uint worker_i, T value);
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    58
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    59
  // The sum() and average() methods below consider uninitialized slots to be 0.
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    60
  double average() const;
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    61
  T sum() const;
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    62
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    63
  const char* title() const {
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    64
    return _title;
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    65
  }
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    66
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    67
  void reset();
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    68
  void set_all(T value);
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    69
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    70
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    71
 private:
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    72
  class WDAPrinter {
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    73
  public:
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    74
    static void summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum);
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    75
    static void summary(outputStream* out, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum);
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    76
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    77
    static void details(const WorkerDataArray<double>* phase, outputStream* out);
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    78
    static void details(const WorkerDataArray<size_t>* phase, outputStream* out);
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    79
  };
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    80
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    81
 public:
37214
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    82
  void print_summary_on(outputStream* out, bool print_sum = true) const;
bc4e0e0995e6 8152952: Allow G1 phase logging to use individual number of threads
brutisso
parents: 36374
diff changeset
    83
  void print_details_on(outputStream* out) const;
33623
8b6afaf25abd 8140393: Move WorkerDataArray to its own file
ehelin
parents:
diff changeset
    84
};
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    85
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 35061
diff changeset
    86
#endif // SHARE_VM_GC_G1_WORKERDATAARRAY_HPP