Re: [rvm-research] How to record objects' read/write times

王晨曦 <[email protected]>
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CAECgty8qooVkr-v+J+d9M3FA7_LAuagzGWQ1aieA2C5DJF_SqQ@mail.gmail.com>
Thanks for Robin and Eliot 's heap!

This problem is complex and I don't make it clear. When I make
progress  ,I will post it here.

Now I'm working on some basic problems. And one of these problems is
how to confirm the nurser's size.( in GenImmix config )
I want to know the nursery(CopySpace)'s  exact size when the jikesrvm
is running.  So I insert some Log.writeln into the source code.


The  x86_64-linux.properties content is:

 13 target.arch=ia32
 14 target.os=Linux
 15 target.bootimage.code.address=0x64000000
 16 target.bootimage.data.address=0x60000000
 17 target.bootimage.rmap.address=0x67000000
 18 #target.max-mappable.address=0xb0000000
 19 target.max-mappable.address=0xa0000000
 20 target.address.size=32
 21 target.dll-ext=.so
 22 target.dll-prefix=lib
 23 target.jni-suffix=${target.dll-ext}
 24 target.arch.sse2=full
 25 target.arch.hw_fsqrt=true


I insert some Log.writeln in the CopyLocal.java

  public CopyLocal(CopySpace space) {
    super(space, true);

    //debug
    Log.writeln("In CopyLocal");
    Log.writeln("heap start:"+space.HEAP_START.toLong());
    Log.writeln("heap end:"+space.HEAP_END.toLong());
    Log.writeln("heap name:"+space.getName());
    Log.writeln("nursery space start:"+space.getStart().toLong());
    Log.writeln("nursery space extent:"+space.getExtent().toLong());
  }


I got the output as below:

   2 In CopyLocal
   3 heap start:1610612736  //0x6000 0000
   4 heap end:2684354560  // 0xA000 0000
   5 heap name:nursery
   6 nursery space start:2537553920  //0x9740 0000
   7 nursery space extent:146800640   //0x8c00 0000


The heap size is matching to the config in the x86_64-linux.properties
(1G) ; and the nursery size is 15% of the heap (140M),  just as the
NURSERY_VM_FRACTION = 0.15f;

And I know this is just  the limit of the heap size and nursery size
,not the exact size when the jikesRVM is running. So I insert some
other Log.writeln into the function " public void
collectionPhase(short phaseId)" in Gen.java , see below:


  public void collectionPhase(short phaseId) {  //Initialize?  every
phase need to be  initialized ??

    if (phaseId == SET_COLLECTION_KIND) {
      super.collectionPhase(phaseId);
      gcFullHeap = requiresFullHeapCollection(); // gcFullHeap is a
boolean, what's the flag use for ?
      return;
    }

    if (phaseId == PREPARE) {

    Log.writeln("In Gen.java/PREPARE");
    Log.writeln("nursery lowerbound:"+Options.nurserySize.getMinNursery());
    Log.writeln("nursery uppperbound"+Options.nurserySize.getMaxNursery());

    nurserySpace.prepare(true);

      if (traceFullHeap()){
        if (gcFullHeap) {
          if (Stats.gatheringStats()) fullHeap.set();
          fullHeapTime.start();
        }
        super.collectionPhase(phaseId);

        // we can throw away the remsets (but not modbuf) for a full heap GC
        remsetPool.clearDeque(1);
        arrayRemsetPool.clearDeque(2);
      }
      return;
    }

    if (phaseId == CLOSURE) {
    //debug
    Log.writeln("In Gen.java/CLOSURE");
    Log.writeln("nursery lowerbound:"+Options.nurserySize.getMinNursery());
    Log.writeln("nursery uppperbound"+Options.nurserySize.getMaxNursery());

      if (!traceFullHeap()) {
        nurseryTrace.prepare();
      }
      return;
    }

    if (phaseId == RELEASE) {

    Log.writeln("In Gen.java/RELEASE");
    Log.writeln("nursery lowerbound:"+Options.nurserySize.getMinNursery());
    Log.writeln("nursery uppperbound"+Options.nurserySize.getMaxNursery());


      nurserySpace.release();
      switchNurseryZeroingApproach(nurserySpace);
      modbufPool.clearDeque(1);
      remsetPool.clearDeque(1);
      arrayRemsetPool.clearDeque(2);
      if (!traceFullHeap()) {
        nurseryTrace.release();
      } else {
        super.collectionPhase(phaseId);
        if (gcFullHeap) fullHeapTime.stop();
      }
      nextGCFullHeap = (getPagesAvail() < Options.nurserySize.getMinNursery());
      return;
    }

    super.collectionPhase(phaseId);
  }



When I run :  rvm

the output is  matching  to the default config :

2685 In Gen.java/PREPARE
2686 nursery lowerbound:512      // 2MB
2687 nursery uppperbound8192   // 32MB

2085 In Gen.java/CLOSURE
2086 nursery lowerbound:512
2087 nursery uppperbound8192

2694 In Gen.java/RELEASE
2695 nursery lowerbound:512
2696 nursery uppperbound8192


And I know this is only the config of the option ,not the exact
nursery size. It's just the upper bound and lower bound.

When I run : rvm -X:gc:fixedNursery=10m  -jar dacapo-9.12-bach.jar h2

The output is :

1143 In Gen.java/CLOSURE
1144 nursery lowerbound:2560   // 10MB
1145 nursery uppperbound2560

1110 In Gen.java/RELEASE
1111 nursery lowerbound:2560
1112 nursery uppperbound2560

Yeah, Now the option of the nursery size is fixed 10MB.

My questions are :

1) I want to know how do the default  parameters pass to the PagesOption.value ?

I insert Log.writln into the NurserySize and  FixedNursery 's
constructor ,but print nothing ! And just as above, The
Options.nurserySize.getMinNursery() output is the default parameters.
So I think the object  fixedNursery must be built.


  public NurserySize() {

    //debug
    Log.writeln("In NurserySize.java:Init NurserySize");

    boundedNursery = new BoundedNursery();
    fixedNursery = new FixedNursery(boundedNursery);
  }


  public FixedNursery(BoundedNursery boundedNursery) {
    super(Options.set, "Fixed Nursery",
        "Fix the minimum and maximum size of the nursery to this value",
        Plan.DEFAULT_MIN_NURSERY);
    this.boundedNursery = boundedNursery;

    //debug
    Log.writeln("In fixedNursery");
    Log.writeln("Plan.DEFAULT_MIN_NURSERY"+Plan.DEFAULT_MIN_NURSERY);
    Log.writeln("Plan.DEFAULT_MIN_NURSERY"+Plan.DEFAULT_MIN_NURSERY);
  }



2) If I want to know the exact size of the nursery (GenImmix), Where
can I insert the Log.writeln ?


Thank you very much.



On Tue, May 12, 2015 at 12:35 PM, Robin Garner <[email protected]> wrote:
> On 11/05/15 17:53, 王晨曦 wrote:
>> Hi,every one
>>
>>    I want to record objects' read and write times. As far as I know,
>> the Write Barrier is inserted before every Pointer update( object
>> assignment ), so I can modify the Write Barrier to record the
>> reference  times of the source object. But I know the reference times
>> is not equal to the write times of the   source object. Such as:
>>
>> class a{
>>    ........
>> }
>>
>> class b{
>>
>> a test =new a();
>>
>> double array_double[ ];
>> int   array_int[];
>>
>> ....
>> }
>>
>>
>> and the write barrier will only be inserted before the: (Is this right ?)
>>
>> b.test=a ; //pointer update
>>
>> but these assignment below will be ignored. But I think these
>> assignments will contribute the main read/write times.
>>
>> for(i=0;i<Const;i++)
>>     array[i]=...
>>     array_int[i]===
>>
>
> If you look at the MutatorContext class you will see that there is not
> just one write barrier, but one per type plus a couple of special cases,
> so there should be opportunities to instrument every field access.
>
> I can't emphasize Eliot's point (3) enough: be very careful of the code
> you invoke in a barrier.  You need to be certain you don't trigger
> another barrier, and if you are instrumenting all types you must use the
> methods in org.mmtk.vm.Barriers to do *all* heap writes.
>
> Regards,
> Robin
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers



-- 
ChenXi.Wang
ICT.CAS China

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.