src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp
author mgronlun
Sat, 24 Aug 2019 14:30:27 +0200
branchJEP-349-branch
changeset 57870 00860d9caf4d
parent 52850 f527b24990d7
child 57902 f6502e486572
permissions -rw-r--r--
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     1
/*
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
     2
 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     4
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     8
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    13
 * accompanied this code).
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    14
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    18
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    21
 * questions.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    22
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    23
 */
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    24
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    25
#include "precompiled.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    26
#include "jfr/jfrEvents.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    27
#include "jfr/leakprofiler/sampling/objectSample.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    28
#include "jfr/leakprofiler/sampling/objectSampler.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    29
#include "jfr/leakprofiler/sampling/sampleList.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    30
#include "jfr/leakprofiler/sampling/samplePriorityQueue.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    31
#include "jfr/recorder/jfrEventSetting.inline.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    32
#include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    33
#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    34
#include "jfr/support/jfrThreadLocal.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    35
#include "jfr/utilities/jfrTryLock.hpp"
50880
e1117321adaf 8197425: Liveset information for Old Object sample event
egahlin
parents: 50113
diff changeset
    36
#include "logging/log.hpp"
e1117321adaf 8197425: Liveset information for Old Object sample event
egahlin
parents: 50113
diff changeset
    37
#include "memory/universe.hpp"
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    38
#include "oops/oop.inline.hpp"
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    39
#include "runtime/atomic.hpp"
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    40
#include "runtime/orderAccess.hpp"
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    41
#include "runtime/safepoint.hpp"
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    42
#include "runtime/thread.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    43
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    44
static ObjectSampler* _instance = NULL;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    45
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    46
static ObjectSampler& instance() {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    47
  assert(_instance != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    48
  return *_instance;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    49
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    50
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    51
ObjectSampler::ObjectSampler(size_t size) :
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    52
  _priority_queue(new SamplePriorityQueue(size)),
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    53
  _list(new SampleList(size)),
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    54
  _last_sweep(JfrTicks::now()),
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    55
  _total_allocated(0),
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    56
  _threshold(0),
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    57
  _size(size),
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    58
  _dead_samples(false) {}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    59
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    60
ObjectSampler::~ObjectSampler() {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    61
  delete _priority_queue;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    62
  _priority_queue = NULL;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    63
  delete _list;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    64
  _list = NULL;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    65
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    66
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    67
bool ObjectSampler::create(size_t size) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    68
  assert(SafepointSynchronize::is_at_safepoint(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    69
  assert(_instance == NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    70
  _instance = new ObjectSampler(size);
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    71
  return _instance != NULL;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    72
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    73
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    74
bool ObjectSampler::is_created() {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    75
  return _instance != NULL;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    76
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    77
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    78
ObjectSampler* ObjectSampler::sampler() {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    79
  assert(is_created(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    80
  return _instance;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    81
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    82
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    83
void ObjectSampler::destroy() {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    84
  assert(SafepointSynchronize::is_at_safepoint(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    85
  if (_instance != NULL) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    86
    ObjectSampler* const sampler = _instance;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    87
    _instance = NULL;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    88
    delete sampler;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    89
  }
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    90
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    91
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    92
static volatile int _lock = 0;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    93
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    94
ObjectSampler* ObjectSampler::acquire() {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    95
  assert(is_created(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    96
  while (Atomic::cmpxchg(1, &_lock, 0) == 1) {}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    97
  return _instance;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    98
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
    99
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   100
void ObjectSampler::release() {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   101
  assert(is_created(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   102
  OrderAccess::fence();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   103
  _lock = 0;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   104
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   105
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   106
static traceid get_thread_id(JavaThread* thread) {
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   107
  assert(thread != NULL, "invariant");
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   108
  if (thread->threadObj() == NULL) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   109
    return 0;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   110
  }
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   111
  const JfrThreadLocal* const tl = thread->jfr_thread_local();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   112
  assert(tl != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   113
  if (!tl->has_thread_checkpoint()) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   114
    JfrCheckpointManager::create_thread_checkpoint(thread);
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   115
  }
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   116
  assert(tl->has_thread_checkpoint(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   117
  return tl->thread_id();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   118
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   119
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   120
// Populates the thread local stack frames, but does not add them
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   121
// to the stacktrace repository (...yet, see stacktrace_id() below)
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   122
//
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   123
void ObjectSampler::fill_stacktrace(JfrStackTrace* stacktrace, JavaThread* thread) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   124
  assert(stacktrace != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   125
  assert(thread != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   126
  if (JfrEventSetting::has_stacktrace(EventOldObjectSample::eventId)) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   127
    JfrStackTraceRepository::fill_stacktrace_for(thread, stacktrace, 0);
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   128
  }
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   129
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   130
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   131
// We were successful in acquiring the try lock and have been selected for adding a sample.
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   132
// Go ahead with installing our previously taken stacktrace into the stacktrace repository.
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   133
//
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   134
traceid ObjectSampler::stacktrace_id(const JfrStackTrace* stacktrace, JavaThread* thread) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   135
  assert(stacktrace != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   136
  assert(stacktrace->hash() != 0, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   137
  const traceid stacktrace_id = JfrStackTraceRepository::add(stacktrace, thread);
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   138
  thread->jfr_thread_local()->set_cached_stack_trace_id(stacktrace_id, stacktrace->hash());
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   139
  return stacktrace_id;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   140
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   141
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   142
void ObjectSampler::sample(HeapWord* obj, size_t allocated, JavaThread* thread) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   143
  assert(thread != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   144
  assert(is_created(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   145
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   146
  const traceid thread_id = get_thread_id(thread);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   147
  if (thread_id == 0) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   148
    return;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   149
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   150
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   151
  const JfrThreadLocal* const tl = thread->jfr_thread_local();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   152
  JfrStackTrace stacktrace(tl->stackframes(), tl->stackdepth());
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   153
  fill_stacktrace(&stacktrace, thread);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   154
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   155
  // try enter critical section
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   156
  JfrTryLock tryLock(&_lock);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   157
  if (!tryLock.has_lock()) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   158
    log_trace(jfr, oldobject, sampling)("Skipping old object sample due to lock contention");
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   159
    return;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   160
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   161
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   162
  instance().add(obj, allocated, thread_id, &stacktrace, thread);
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   163
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   164
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   165
void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, JfrStackTrace* stacktrace, JavaThread* thread) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   166
  assert(stacktrace != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   167
  assert(thread_id != 0, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   168
  assert(thread != NULL, "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   169
  assert(thread->jfr_thread_local()->has_thread_checkpoint(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   170
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   171
  if (_dead_samples) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   172
    scavenge();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   173
    assert(!_dead_samples, "invariant");
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   174
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   175
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   176
  _total_allocated += allocated;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   177
  const size_t span = _total_allocated - _priority_queue->total();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   178
  ObjectSample* sample;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   179
  if ((size_t)_priority_queue->count() == _size) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   180
    assert(_list->count() == _size, "invariant");
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   181
    const ObjectSample* peek = _priority_queue->peek();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   182
    if (peek->span() > span) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   183
      // quick reject, will not fit
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   184
      return;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   185
    }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   186
    sample = _list->reuse(_priority_queue->pop());
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   187
  } else {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   188
    sample = _list->get();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   189
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   190
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   191
  assert(sample != NULL, "invariant");
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   192
  sample->set_thread_id(thread_id);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   193
  sample->set_thread_checkpoint(thread->jfr_thread_local()->thread_checkpoint());
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   194
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   195
  const unsigned int stacktrace_hash = stacktrace->hash();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   196
  if (stacktrace_hash != 0) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   197
    sample->set_stack_trace_id(stacktrace_id(stacktrace, thread));
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   198
    sample->set_stack_trace_hash(stacktrace_hash);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   199
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   200
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   201
  sample->set_span(allocated);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   202
  sample->set_object((oop)obj);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   203
  sample->set_allocated(allocated);
50880
e1117321adaf 8197425: Liveset information for Old Object sample event
egahlin
parents: 50113
diff changeset
   204
  sample->set_allocation_time(JfrTicks::now());
e1117321adaf 8197425: Liveset information for Old Object sample event
egahlin
parents: 50113
diff changeset
   205
  sample->set_heap_used_at_last_gc(Universe::get_heap_used_at_last_gc());
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   206
  _priority_queue->push(sample);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   207
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   208
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   209
void ObjectSampler::scavenge() {
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   210
  ObjectSample* current = _list->last();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   211
  while (current != NULL) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   212
    ObjectSample* next = current->next();
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   213
    if (current->is_dead()) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   214
      remove_dead(current);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   215
    }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   216
    current = next;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   217
  }
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   218
  _dead_samples = false;
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   219
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   220
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   221
void ObjectSampler::remove_dead(ObjectSample* sample) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   222
  assert(sample != NULL, "invariant");
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   223
  assert(sample->is_dead(), "invariant");
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   224
  ObjectSample* const previous = sample->prev();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   225
  // push span on to previous
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   226
  if (previous != NULL) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   227
    _priority_queue->remove(previous);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   228
    previous->add_span(sample->span());
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   229
    _priority_queue->push(previous);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   230
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   231
  _priority_queue->remove(sample);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   232
  _list->release(sample);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   233
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   234
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   235
void ObjectSampler::oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   236
  assert(is_created(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   237
  assert(SafepointSynchronize::is_at_safepoint(), "invariant");
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   238
  ObjectSampler& sampler = instance();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   239
  ObjectSample* current = sampler._list->last();
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   240
  while (current != NULL) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   241
    ObjectSample* next = current->next();
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   242
    if (!current->is_dead()) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   243
      if (is_alive->do_object_b(current->object())) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   244
        // The weakly referenced object is alive, update pointer
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   245
        f->do_oop(const_cast<oop*>(current->object_addr()));
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   246
      } else {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   247
        current->set_dead();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   248
        sampler._dead_samples = true;
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   249
      }
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   250
    }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   251
    current = next;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   252
  }
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   253
  sampler._last_sweep = JfrTicks::now();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   254
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   255
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   256
ObjectSample* ObjectSampler::last() const {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   257
  return _list->last();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   258
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   259
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   260
const ObjectSample* ObjectSampler::first() const {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   261
  return _list->first();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   262
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   263
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   264
const ObjectSample* ObjectSampler::last_resolved() const {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   265
  return _list->last_resolved();
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   266
}
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   267
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   268
void ObjectSampler::set_last_resolved(const ObjectSample* sample) {
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   269
  _list->set_last_resolved(sample);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   270
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   271
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   272
int ObjectSampler::item_count() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   273
  return _priority_queue->count();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   274
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   275
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   276
const ObjectSample* ObjectSampler::item_at(int index) const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   277
  return _priority_queue->item_at(index);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   278
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   279
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   280
ObjectSample* ObjectSampler::item_at(int index) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   281
  return const_cast<ObjectSample*>(
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   282
    const_cast<const ObjectSampler*>(this)->item_at(index)
57870
00860d9caf4d New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents: 52850
diff changeset
   283
                                  );
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   284
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   285
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   286
const JfrTicks& ObjectSampler::last_sweep() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   287
  return _last_sweep;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   288
}