< prev index next >

src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp

Print this page




  94 }
  95 
  96 static int array_size(const oop object) {
  97   assert(object != NULL, "invariant");
  98   if (object->is_array()) {
  99     return arrayOop(object)->length();
 100   }
 101   return min_jint;
 102 }
 103 
 104 void EventEmitter::write_event(const ObjectSample* sample, EdgeStore* edge_store) {
 105   assert(sample != NULL, "invariant");
 106   assert(!sample->is_dead(), "invariant");
 107   assert(edge_store != NULL, "invariant");
 108   assert(_jfr_thread_local != NULL, "invariant");
 109 
 110   const oop* object_addr = sample->object_addr();
 111   traceid gc_root_id = 0;
 112   const Edge* edge = NULL;
 113   if (SafepointSynchronize::is_at_safepoint()) {
 114     edge = (const Edge*)(*object_addr)->mark().value();
 115   }
 116   if (edge == NULL) {
 117     // In order to dump out a representation of the event
 118     // even though it was not reachable / too long to reach,
 119     // we need to register a top level edge for this object.
 120     edge = edge_store->put(object_addr);
 121   } else {
 122     gc_root_id = edge_store->gc_root_id(edge);
 123   }
 124 
 125   assert(edge != NULL, "invariant");
 126   const traceid object_id = edge_store->get_id(edge);
 127   assert(object_id != 0, "invariant");
 128 
 129   EventOldObjectSample e(UNTIMED);
 130   e.set_starttime(_start_time);
 131   e.set_endtime(_end_time);
 132   e.set_allocationTime(sample->allocation_time());
 133   e.set_lastKnownHeapUsage(sample->heap_used_at_last_gc());
 134   e.set_object(object_id);


  94 }
  95 
  96 static int array_size(const oop object) {
  97   assert(object != NULL, "invariant");
  98   if (object->is_array()) {
  99     return arrayOop(object)->length();
 100   }
 101   return min_jint;
 102 }
 103 
 104 void EventEmitter::write_event(const ObjectSample* sample, EdgeStore* edge_store) {
 105   assert(sample != NULL, "invariant");
 106   assert(!sample->is_dead(), "invariant");
 107   assert(edge_store != NULL, "invariant");
 108   assert(_jfr_thread_local != NULL, "invariant");
 109 
 110   const oop* object_addr = sample->object_addr();
 111   traceid gc_root_id = 0;
 112   const Edge* edge = NULL;
 113   if (SafepointSynchronize::is_at_safepoint()) {
 114     edge = (const Edge*)(*object_addr)->mark().to_pointer();
 115   }
 116   if (edge == NULL) {
 117     // In order to dump out a representation of the event
 118     // even though it was not reachable / too long to reach,
 119     // we need to register a top level edge for this object.
 120     edge = edge_store->put(object_addr);
 121   } else {
 122     gc_root_id = edge_store->gc_root_id(edge);
 123   }
 124 
 125   assert(edge != NULL, "invariant");
 126   const traceid object_id = edge_store->get_id(edge);
 127   assert(object_id != 0, "invariant");
 128 
 129   EventOldObjectSample e(UNTIMED);
 130   e.set_starttime(_start_time);
 131   e.set_endtime(_end_time);
 132   e.set_allocationTime(sample->allocation_time());
 133   e.set_lastKnownHeapUsage(sample->heap_used_at_last_gc());
 134   e.set_object(object_id);
< prev index next >