< prev index next >

src/hotspot/share/runtime/perfData.cpp

Print this page

279 
280   delete(_all);
281   delete(_sampled);
282   delete(_constants);
283 
284   _all = nullptr;
285   _sampled = nullptr;
286   _constants = nullptr;
287 }
288 
289 void PerfDataManager::add_item(PerfData* p, bool sampled) {
290 
291   MutexLocker ml(PerfDataManager_lock);
292 
293   // Default sizes determined using -Xlog:perf+datacreation=debug
294   if (_all == nullptr) {
295     _all = new PerfDataList(191);
296     _has_PerfData = true;
297   }
298 
299   assert(!_all->contains(p->name()), "duplicate name added");
300 
301   // add to the list of all perf data items
302   _all->append(p);
303 
304   if (p->variability() == PerfData::V_Constant) {
305     if (_constants == nullptr) {
306       _constants = new PerfDataList(51);
307     }
308     _constants->append(p);
309     return;
310   }
311 
312   if (sampled) {
313     if (_sampled == nullptr) {
314       _sampled = new PerfDataList(1);
315     }
316     _sampled->append(p);
317   }
318 }
319 

510 
511 PerfData* PerfDataList::find_by_name(const char* name) {
512 
513   int i = _set->find_if([&](PerfData* pd) { return pd->name_equals(name); });
514 
515   if (i >= 0 && i <= _set->length())
516     return _set->at(i);
517   else
518     return nullptr;
519 }
520 
521 PerfDataList* PerfDataList::clone() {
522 
523   PerfDataList* copy = new PerfDataList(this);
524 
525   assert(copy != nullptr, "just checking");
526 
527   return copy;
528 }
529 
530 PerfTraceTime::~PerfTraceTime() {
531   if (!UsePerfData) return;
532   _t.stop();
533   _timerp->inc(_t.ticks());


534 }

279 
280   delete(_all);
281   delete(_sampled);
282   delete(_constants);
283 
284   _all = nullptr;
285   _sampled = nullptr;
286   _constants = nullptr;
287 }
288 
289 void PerfDataManager::add_item(PerfData* p, bool sampled) {
290 
291   MutexLocker ml(PerfDataManager_lock);
292 
293   // Default sizes determined using -Xlog:perf+datacreation=debug
294   if (_all == nullptr) {
295     _all = new PerfDataList(191);
296     _has_PerfData = true;
297   }
298 
299   assert(!_all->contains(p->name()), "duplicate name added: %s", p->name());
300 
301   // add to the list of all perf data items
302   _all->append(p);
303 
304   if (p->variability() == PerfData::V_Constant) {
305     if (_constants == nullptr) {
306       _constants = new PerfDataList(51);
307     }
308     _constants->append(p);
309     return;
310   }
311 
312   if (sampled) {
313     if (_sampled == nullptr) {
314       _sampled = new PerfDataList(1);
315     }
316     _sampled->append(p);
317   }
318 }
319 

510 
511 PerfData* PerfDataList::find_by_name(const char* name) {
512 
513   int i = _set->find_if([&](PerfData* pd) { return pd->name_equals(name); });
514 
515   if (i >= 0 && i <= _set->length())
516     return _set->at(i);
517   else
518     return nullptr;
519 }
520 
521 PerfDataList* PerfDataList::clone() {
522 
523   PerfDataList* copy = new PerfDataList(this);
524 
525   assert(copy != nullptr, "just checking");
526 
527   return copy;
528 }
529 
530 PerfTraceTimeBase::~PerfTraceTimeBase() {
531   if (!UsePerfData || !_t->is_active()) return;
532   if (_counter != nullptr) {
533     _t->stop();
534     _counter->inc(_t->ticks());
535   }
536 }
< prev index next >