Path: blob/master/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.hpp
41155 views
/*1* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_JFR_LEAKPROFILER_SAMPLING_SAMPLELIST_HPP25#define SHARE_JFR_LEAKPROFILER_SAMPLING_SAMPLELIST_HPP26#include "jfr/utilities/jfrAllocation.hpp"27#include "jfr/utilities/jfrDoublyLinkedList.hpp"2829class ObjectSample;3031class SampleList : public JfrCHeapObj {32typedef JfrDoublyLinkedList<ObjectSample> List;33private:34List _free_list;35List _in_use_list;36const ObjectSample* _last_resolved;37mutable size_t _allocated;38const size_t _limit;39const size_t _cache_size;4041void populate_cache();42ObjectSample* newSample() const;43void link(ObjectSample* sample);44void unlink(ObjectSample* sample);45void deallocate_samples(List& list);46void reset(ObjectSample* sample);4748public:49SampleList(size_t limit, size_t cache_size = 0);50~SampleList();5152ObjectSample* get();53ObjectSample* first() const;54ObjectSample* last() const;55const ObjectSample* last_resolved() const;56void set_last_resolved(const ObjectSample* sample);57void release(ObjectSample* sample);58ObjectSample* reuse(ObjectSample* sample);59bool is_full() const;60size_t count() const;61};6263#endif // SHARE_JFR_LEAKPROFILER_SAMPLING_SAMPLELIST_HPP646566