RFR (S) JDK-8014912 Restore PrintSharedSpaces after NPG

Ioi Lam ioi.lam at oracle.com
Thu May 23 09:51:06 PDT 2013


Coleen,

I looked at histogram.hpp, but it has only one _count field:

    class HistogramElement : public CHeapObj<mtInternal> {
      protected:
       jint _count;
       const char* _name;

      public:
       HistogramElement();
       virtual int count();
       virtual const char* name();
       virtual void increment_count();
       void print_on(outputStream* st) const;
       virtual int compare(HistogramElement* e1,HistogramElement* e2);
    };

For my purpose, I would need a count and size for each subtype of 
metadata, so it doesn't look like this class is immediately usable for me.

I am actually planning (with a different bug ID) to dump a detailed "map 
file" of every object in CDS. Now that I record all the allocations 
under Metaspace::_alloc_record_head, I can iterate over them and call, 
for example, Method::print_codes_on() on all the methods. This will 
allow you to do all kinds of analysis, like

     How many unquickened getfield bytecodes are inside CDS
     How many methods contain unquickened bytecodes

... etc. When we were doing Monty's romizer, a mapfile like this was 
very helpful in identifying possible areas for improvements.

While I do that, I can also dump a table of the size distribution of 
each type objects in a histogram format, similar to 
PrintSymbolTableSizeHistogram.

Thanks
- Ioi


On 05/22/2013 06:47 PM, Coleen Phillimore wrote:
>
> Ioi,
>
> This looks really good.  The only thing is that we have code to create 
> histograms in the VM (see utilities/histogram.hpp). Couldn't you reuse 
> this class instead of writing your own histogram creating function?   
> It would sort your data for you!  I don't know if it would have the 
> data you are looking for but lots of other jvm code uses this class 
> for a similar purpose.
>
> Thanks,
> Coleen
>
> On 5/21/2013 6:29 PM, Ioi Lam wrote:
>> Please review:
>>
>> http://cr.openjdk.java.net/~iklam/8014912/print_sharedspc_001/
>>
>> Bug: Restore PrintSharedSpaces functionality after NPG
>>
>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8014912
>>     https://jbs.oracle.com/bugs/browse/JDK-8014912
>>
>> Summary of fix:
>>
>> I added a new enum, MetaspaceObj::Type, which is passed to
>>
>>     Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
>>                         bool read_only, MetaspaceObj::Type type, TRAPS);
>>
>> During CDS dumping, all allocations are logged in a linked list to
>> be processed later by metaspaceShared.cpp to generate statistics for
>> objects in the CDS archive. See sample output below.
>>
>> * No such logging is doneat normal VM execution time so there
>>   is no performance impact.
>>
>> * I verified that the patch can be applied cleanly on Jon's
>>   recentpatch for JDK-8014862 "Add fast Metasapce capacity and
>>   used per MetadataType"
>>
>> http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/2b1a9d972fc2
>>
>> Testing:
>>
>>     JPRT, UTE (vm.quick.testlist)
>>
>> Sample output:
>>
>>                         ro_cnt   ro_bytes     % | rw_cnt rw_bytes     
>> % |  all_cnt  all_bytes     %
>> --------------------+---------------------------+---------------------------+-------------------------- 
>>
>> Unknown             :        1         64   0.0 | 1         64 0.0 
>> |        2        128   0.0
>> Class               :        0          0   0.0 | 2364 2006080 14.7 
>> |     2364    2006080   9.2
>> Symbol              :    49858    2507168  30.9 | 0          0 0.0 
>> |    49858    2507168  11.5
>> TypeArrayU1         :    13264     608336   7.5 | 2365 428784 3.1 
>> |    15629    1037120   4.8
>> TypeArrayU2         :     4796     341952   4.2 | 0          0 0.0 
>> |     4796     341952   1.6
>> TypeArrayU4         :     2371     178528   2.2 | 0          0 0.0 
>> |     2371     178528   0.8
>> TypeArrayU8         :     3708     365920   4.5 | 0          0 0.0 
>> |     3708     365920   1.7
>> TypeArrayOther      :        0          0   0.0 | 0          0 0.0 
>> |        0          0   0.0
>> Method              :        0          0   0.0 | 32552 3659888 26.8 
>> |    32552    3659888  16.8
>> ConstMethod         :    32552    4099008  50.6 | 0          0 0.0 
>> |    32552    4099008  18.8
>> MethodData          :        0          0   0.0 | 0          0 0.0 
>> |        0          0   0.0
>> ConstantPool        :        0          0   0.0 | 2365 3225600 23.6 
>> |     2365    3225600  14.8
>> ConstantPoolCache   :        0          0   0.0 | 2350 2212320 16.2 
>> |     2350    2212320  10.2
>> Annotation          :       26       1248   0.0 | 0          0 0.0 
>> |       26       1248   0.0
>> MethodCounters      :        0          0   0.0 | 0          0 0.0 
>> |        0          0   0.0
>> SymbolHashentry     :        0          0   0.0 | 49858 1595456 11.7 
>> |    49858    1595456   7.3
>> SymbolBuckets       :        0          0   0.0 | 20011 320176 2.3 
>> |    20011     320176   1.5
>> Other               :        0          0   0.0 | 0     203893 1.5 
>> |        0     203893   0.9
>> --------------------+---------------------------+---------------------------+-------------------------- 
>>
>> Total               :   106576    8102224 100.0 | 111866 13652261 
>> 100.0 |   218442   21754485 100.0
>>
>>
>> Thanks,
>> Ioi
>>
>>
>



More information about the hotspot-dev mailing list