00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "../prof/prof.h"
00036 #include "../gc/gc.h"
00037
00038 void Prof::event_gcStart( JVMPI_Event* event) {
00039
00040 communLock.wait();
00041 dataLock.wait();
00042
00043 static int firstTime = 1;
00044 if( firstTime) {
00045
00046 jvmpiInterface->EnableEvent( JVMPI_EVENT_GC_FINISH, NULL);
00047
00048 jvmpiInterface->EnableEvent( JVMPI_EVENT_OBJECT_FREE, NULL);
00049 jvmpiInterface->EnableEvent( JVMPI_EVENT_OBJECT_MOVE, NULL);
00050
00051 jvmpiInterface->EnableEvent( JVMPI_EVENT_ARENA_DELETE, NULL);
00052
00053 firstTime = 0;
00054 }
00055
00056 GC* gc = new GC;
00057 gc->startTime = time( NULL);
00058
00059 gcStat.add( gc);
00060 }
00061
00062 void Prof::event_gcFinish( JVMPI_Event* event) {
00063
00064 GC* gc = gcStat.first();
00065
00066 gc->endTime = time( NULL);
00067
00068 gc->usedObjects = event->u.gc_info.used_objects;
00069 gc->usedObjectSpace = event->u.gc_info.used_object_space;
00070 gc->totalObjectSpace = event->u.gc_info.total_object_space;
00071
00072 dataLock.release();
00073 communLock.release();
00074 }