7161545: G1: Minor cleanups to the G1 logging

Mon, 14 May 2012 17:32:17 +0200

author
brutisso
date
Mon, 14 May 2012 17:32:17 +0200
changeset 3762
3a22b77e755a
parent 3757
56d1af561395
child 3764
33e366609904

7161545: G1: Minor cleanups to the G1 logging
Summary: Rename "to-space-overflow" to "to-space-exhausted", Introduce one decimal point in the size format, Add Sum to the aggregate and re-order the entries, Add number of GC workers to the log output
Reviewed-by: johnc, jwilhelm

src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/globalDefinitions.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri May 11 14:54:35 2012 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon May 14 17:32:17 2012 +0200
     1.3 @@ -5502,7 +5502,7 @@
     1.4    if (evacuation_failed()) {
     1.5      remove_self_forwarding_pointers();
     1.6      if (G1Log::finer()) {
     1.7 -      gclog_or_tty->print(" (to-space overflow)");
     1.8 +      gclog_or_tty->print(" (to-space exhausted)");
     1.9      } else if (G1Log::fine()) {
    1.10        gclog_or_tty->print("--");
    1.11      }
     2.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri May 11 14:54:35 2012 -0700
     2.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Mon May 14 17:32:17 2012 +0200
     2.3 @@ -1010,7 +1010,8 @@
     2.4  
     2.5  void G1CollectorPolicy::print_par_stats(int level,
     2.6                                          const char* str,
     2.7 -                                        double* data) {
     2.8 +                                        double* data,
     2.9 +                                        bool showDecimals) {
    2.10    double min = data[0], max = data[0];
    2.11    double total = 0.0;
    2.12    LineBuffer buf(level);
    2.13 @@ -1023,7 +1024,11 @@
    2.14        max = val;
    2.15      total += val;
    2.16      if (G1Log::finest()) {
    2.17 -      buf.append("  %.1lf", val);
    2.18 +      if (showDecimals) {
    2.19 +        buf.append("  %.1lf", val);
    2.20 +      } else {
    2.21 +        buf.append("  %d", (int)val);
    2.22 +      }
    2.23      }
    2.24    }
    2.25  
    2.26 @@ -1031,36 +1036,26 @@
    2.27      buf.append_and_print_cr("");
    2.28    }
    2.29    double avg = total / (double) no_of_gc_threads();
    2.30 -  buf.append_and_print_cr(" Avg: %.1lf Min: %.1lf Max: %.1lf Diff: %.1lf]",
    2.31 -    avg, min, max, max - min);
    2.32 -}
    2.33 -
    2.34 -void G1CollectorPolicy::print_par_sizes(int level,
    2.35 -                                        const char* str,
    2.36 -                                        double* data) {
    2.37 -  double min = data[0], max = data[0];
    2.38 -  double total = 0.0;
    2.39 -  LineBuffer buf(level);
    2.40 -  buf.append("[%s :", str);
    2.41 -  for (uint i = 0; i < no_of_gc_threads(); ++i) {
    2.42 -    double val = data[i];
    2.43 -    if (val < min)
    2.44 -      min = val;
    2.45 -    if (val > max)
    2.46 -      max = val;
    2.47 -    total += val;
    2.48 -    buf.append(" %d", (int) val);
    2.49 +  if (showDecimals) {
    2.50 +    buf.append_and_print_cr(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf, Sum: %.1lf]",
    2.51 +      min, avg, max, max - min, total);
    2.52 +  } else {
    2.53 +    buf.append_and_print_cr(" Min: %d, Avg: %d, Max: %d, Diff: %d, Sum: %d]",
    2.54 +      (int)min, (int)avg, (int)max, (int)max - (int)min, (int)total);
    2.55    }
    2.56 -  buf.append_and_print_cr("");
    2.57 -  double avg = total / (double) no_of_gc_threads();
    2.58 -  buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]",
    2.59 -    (int)total, (int)avg, (int)min, (int)max, (int)max - (int)min);
    2.60  }
    2.61  
    2.62  void G1CollectorPolicy::print_stats(int level,
    2.63                                      const char* str,
    2.64                                      double value) {
    2.65 -  LineBuffer(level).append_and_print_cr("[%s: %5.1lf ms]", str, value);
    2.66 +  LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value);
    2.67 +}
    2.68 +
    2.69 +void G1CollectorPolicy::print_stats(int level,
    2.70 +                                    const char* str,
    2.71 +                                    double value,
    2.72 +                                    int workers) {
    2.73 +  LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %d]", str, value, workers);
    2.74  }
    2.75  
    2.76  void G1CollectorPolicy::print_stats(int level,
    2.77 @@ -1373,7 +1368,7 @@
    2.78        print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
    2.79      }
    2.80      if (parallel) {
    2.81 -      print_stats(1, "Parallel Time", _cur_collection_par_time_ms);
    2.82 +      print_stats(1, "Parallel Time", _cur_collection_par_time_ms, no_of_gc_threads);
    2.83        print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms);
    2.84        print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms);
    2.85        if (print_marking_info) {
    2.86 @@ -1381,13 +1376,15 @@
    2.87        }
    2.88        print_par_stats(2, "Update RS", _par_last_update_rs_times_ms);
    2.89        if (G1Log::finest()) {
    2.90 -        print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers);
    2.91 +        print_par_stats(3, "Processed Buffers", _par_last_update_rs_processed_buffers,
    2.92 +          false /* showDecimals */);
    2.93        }
    2.94        print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms);
    2.95        print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms);
    2.96        print_par_stats(2, "Termination", _par_last_termination_times_ms);
    2.97        if (G1Log::finest()) {
    2.98 -        print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts);
    2.99 +        print_par_stats(3, "Termination Attempts", _par_last_termination_attempts,
   2.100 +          false /* showDecimals */);
   2.101        }
   2.102  
   2.103        for (int i = 0; i < _parallel_gc_threads; i++) {
   2.104 @@ -1601,9 +1598,9 @@
   2.105    _collectionSetChooser->verify();
   2.106  }
   2.107  
   2.108 -#define EXT_SIZE_FORMAT "%d%s"
   2.109 +#define EXT_SIZE_FORMAT "%.1f%s"
   2.110  #define EXT_SIZE_PARAMS(bytes)                                  \
   2.111 -  byte_size_in_proper_unit((bytes)),                            \
   2.112 +  byte_size_in_proper_unit((double)(bytes)),                    \
   2.113    proper_unit_for_byte_size((bytes))
   2.114  
   2.115  void G1CollectorPolicy::print_heap_transition() {
     3.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri May 11 14:54:35 2012 -0700
     3.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Mon May 14 17:32:17 2012 +0200
     3.3 @@ -552,10 +552,10 @@
     3.4  
     3.5  private:
     3.6    void print_stats(int level, const char* str, double value);
     3.7 +  void print_stats(int level, const char* str, double value, int workers);
     3.8    void print_stats(int level, const char* str, int value);
     3.9  
    3.10 -  void print_par_stats(int level, const char* str, double* data);
    3.11 -  void print_par_sizes(int level, const char* str, double* data);
    3.12 +  void print_par_stats(int level, const char* str, double* data, bool showDecimals = true);
    3.13  
    3.14    void check_other_times(int level,
    3.15                           NumberSeq* other_times_ms,
     4.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Fri May 11 14:54:35 2012 -0700
     4.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Mon May 14 17:32:17 2012 +0200
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -188,17 +188,17 @@
    4.11    }
    4.12  }
    4.13  
    4.14 -inline size_t byte_size_in_proper_unit(size_t s) {
    4.15 +template <class T>
    4.16 +inline T byte_size_in_proper_unit(T s) {
    4.17    if (s >= 10*M) {
    4.18 -    return s/M;
    4.19 +    return (T)(s/M);
    4.20    } else if (s >= 10*K) {
    4.21 -    return s/K;
    4.22 +    return (T)(s/K);
    4.23    } else {
    4.24      return s;
    4.25    }
    4.26  }
    4.27  
    4.28 -
    4.29  //----------------------------------------------------------------------------------------------------
    4.30  // VM type definitions
    4.31  

mercurial