< prev index next >

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

Print this page
rev 57531 : imported patch 8234173.0


  99   return count;
 100 }
 101 
 102 static int array_size(const oop object) {
 103   assert(object != NULL, "invariant");
 104   if (object->is_array()) {
 105     return arrayOop(object)->length();
 106   }
 107   return min_jint;
 108 }
 109 
 110 void EventEmitter::write_event(const ObjectSample* sample, EdgeStore* edge_store) {
 111   assert(sample != NULL, "invariant");
 112   assert(!sample->is_dead(), "invariant");
 113   assert(edge_store != NULL, "invariant");
 114   assert(_jfr_thread_local != NULL, "invariant");
 115 
 116   traceid gc_root_id = 0;
 117   const Edge* edge = NULL;
 118   if (SafepointSynchronize::is_at_safepoint()) {

 119     edge = (const Edge*)(sample->object())->mark().to_pointer();

 120   }
 121   if (edge == NULL) {
 122     // In order to dump out a representation of the event
 123     // even though it was not reachable / too long to reach,
 124     // we need to register a top level edge for this object.
 125     edge = edge_store->put(UnifiedOopRef::encode_in_native(sample->object_addr()));
 126   } else {
 127     gc_root_id = edge_store->gc_root_id(edge);
 128   }
 129 
 130   assert(edge != NULL, "invariant");
 131   const traceid object_id = edge_store->get_id(edge);
 132   assert(object_id != 0, "invariant");
 133 
 134   Tickspan object_age = Ticks(_start_time.value()) - sample->allocation_time();
 135 
 136   EventOldObjectSample e(UNTIMED);
 137   e.set_starttime(_start_time);
 138   e.set_endtime(_end_time);
 139   e.set_allocationTime(sample->allocation_time());


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