hotspot/src/share/vm/memory/heapInspection.cpp
changeset 24424 2658d7834c6e
parent 18439 725ce18186b3
child 25946 1572c9f03fb9
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    33 #include "utilities/macros.hpp"
    33 #include "utilities/macros.hpp"
    34 #if INCLUDE_ALL_GCS
    34 #if INCLUDE_ALL_GCS
    35 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
    35 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
    36 #endif // INCLUDE_ALL_GCS
    36 #endif // INCLUDE_ALL_GCS
    37 
    37 
       
    38 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
       
    39 
    38 // HeapInspection
    40 // HeapInspection
    39 
    41 
    40 int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) {
    42 int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) {
    41   if(e1->_instance_words > e2->_instance_words) {
    43   if(e1->_instance_words > e2->_instance_words) {
    42     return -1;
    44     return -1;
   268   }
   270   }
   269 
   271 
   270   return true;
   272   return true;
   271 }
   273 }
   272 
   274 
       
   275 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
   273 void KlassInfoHisto::print_title(outputStream* st, bool csv_format,
   276 void KlassInfoHisto::print_title(outputStream* st, bool csv_format,
   274                                  bool selected[], int width_table[],
   277                                  bool selected[], int width_table[],
   275                                  const char *name_table[]) {
   278                                  const char *name_table[]) {
   276   if (csv_format) {
   279   if (csv_format) {
   277     st->print("Index,Super");
   280     st->print("Index,Super");
   280     }
   283     }
   281     st->print(",ClassName");
   284     st->print(",ClassName");
   282   } else {
   285   } else {
   283     st->print("Index Super");
   286     st->print("Index Super");
   284     for (int c=0; c<KlassSizeStats::_num_columns; c++) {
   287     for (int c=0; c<KlassSizeStats::_num_columns; c++) {
       
   288 PRAGMA_DIAG_PUSH
       
   289 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
   285       if (selected[c]) {st->print(str_fmt(width_table[c]), name_table[c]);}
   290       if (selected[c]) {st->print(str_fmt(width_table[c]), name_table[c]);}
       
   291 PRAGMA_DIAG_POP
   286     }
   292     }
   287     st->print(" ClassName");
   293     st->print(" ClassName");
   288   }
   294   }
   289 
   295 
   290   if (is_selected("ClassLoader")) {
   296   if (is_selected("ClassLoader")) {
   393         if (selected[c]) {
   399         if (selected[c]) {
   394           switch (c) {
   400           switch (c) {
   395           case KlassSizeStats::_index_inst_size:
   401           case KlassSizeStats::_index_inst_size:
   396           case KlassSizeStats::_index_inst_count:
   402           case KlassSizeStats::_index_inst_count:
   397           case KlassSizeStats::_index_method_count:
   403           case KlassSizeStats::_index_method_count:
       
   404 PRAGMA_DIAG_PUSH
       
   405 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
   398             st->print(str_fmt(width_table[c]), "-");
   406             st->print(str_fmt(width_table[c]), "-");
       
   407 PRAGMA_DIAG_POP
   399             break;
   408             break;
   400           default:
   409           default:
   401             {
   410             {
   402               double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes;
   411               double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes;
       
   412 PRAGMA_DIAG_PUSH
       
   413 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
   403               st->print(perc_fmt(width_table[c]), perc);
   414               st->print(perc_fmt(width_table[c]), perc);
       
   415 PRAGMA_DIAG_POP
   404             }
   416             }
   405           }
   417           }
   406         }
   418         }
   407       }
   419       }
   408     }
   420     }