/*
* Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
*
* This file is part of the Lock Contention Tracing Subsystem for the HotSpot
* Virtual Machine, which is developed at Christian Doppler Laboratory on
* Monitoring and Evolution of Very-Large-Scale Software Systems. Please
* contact us at if you need additional information
* or have any questions.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work. If not, see .
*
*/
#ifndef SHARE_VM_EVTRACE_TRACEMETADATA_HPP
#define SHARE_VM_EVTRACE_TRACEMETADATA_HPP
#include "evtrace/traceStack.hpp"
#include "evtrace/traceTypes.hpp"
#include "memory/allocation.hpp"
#include "oops/oopsHierarchy.hpp"
class ObjectMonitor;
class Klass;
class Method;
class TraceMetadata: public CHeapObj {
private:
TraceStackCache *_stack_cache;
volatile intptr_t _last_stack_id;
volatile intptr_t _last_global_seq;
class MarkKlassUnknownClosure;
class ClearInvalidatedMementoStacksClosure;
public:
TraceMetadata();
virtual ~TraceMetadata();
TraceTypes::timestamp time_now();
TraceTypes::thread_id thread_id(Thread *t);
TraceTypes::object_id object_id(oop obj);
TraceTypes::objmonitor_id objmonitor_id(ObjectMonitor *m);
TraceTypes::object_id objmonitor_object_id(ObjectMonitor *m);
TraceTypes::thread_state thread_state(Thread *t);
TraceTypes::classloader_id classloader_id(ClassLoaderData *c);
TraceTypes::class_id class_id(Klass *k, bool &added);
TraceTypes::method_id method_id(Method *m, bool &added);
const CachedTraceStack * get_or_try_add_stack(CompositeTraceStack &ts, bool &known, TraceTypes::stack_id preallocated_id = 0);
TraceTypes::stack_id next_stack_id();
TraceTypes::seq_num next_global_seq();
void purge_all();
void purge_unloading_classes(ClassLoaderData *loader);
void purge_unloading_nmethod(const nmethod *nm);
void do_maintenance();
intptr_t stack_cache_lookups() { return _stack_cache->lookups(); }
intptr_t stack_cache_lookup_misses() { return _stack_cache->lookup_misses(); }
intptr_t stack_cache_lookup_collisions() { return _stack_cache->lookup_collisions(); }
intptr_t stack_cache_probes() { return _stack_cache->probes(); }
intptr_t stack_cache_probe_collisions() { return _stack_cache->probe_collisions(); }
jlong stack_cache_purge_millis() { return _stack_cache->purge_millis(); }
jlong stack_cache_maintenance_millis() { return _stack_cache->maintenance_millis(); }
void reset_stack_cache_stats() { _stack_cache->reset_stats(); }
};
#include "evtrace/traceMetadata.inline.hpp"
#endif /* SHARE_VM_EVTRACE_TRACEMETADATA_HPP */