1 /*
   2  * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
   3  *
   4  * This file is part of the Lock Contention Tracing Subsystem for the HotSpot
   5  * Virtual Machine, which is developed at Christian Doppler Laboratory on
   6  * Monitoring and Evolution of Very-Large-Scale Software Systems. Please
   7  * contact us at <http://mevss.jku.at/> if you need additional information
   8  * or have any questions.
   9  *
  10  * This code is free software; you can redistribute it and/or modify it
  11  * under the terms of the GNU General Public License version 2 only, as
  12  * published by the Free Software Foundation.
  13  *
  14  * This code is distributed in the hope that it will be useful, but WITHOUT
  15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17  * version 2 for more details (a copy is included in the LICENSE file that
  18  * accompanied this code).
  19  *
  20  * You should have received a copy of the GNU General Public License version
  21  * 2 along with this work. If not, see <http://www.gnu.org/licenses/>.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_EVTRACE_TRACEBUFFER_HPP
  26 #define SHARE_VM_EVTRACE_TRACEBUFFER_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 
  30 class Thread;
  31 
  32 class TraceBuffer: public CHeapObj<mtEventTracing> {
  33 public:
  34   TraceBuffer(size_t capacity);
  35   virtual ~TraceBuffer() { }
  36 
  37   void reset();
  38   bool reserve(size_t nbytes);
  39   size_t filled_size() const;
  40 
  41   void* operator new(size_t size, size_t capacity) throw();
  42 
  43   TraceBuffer  *queue_next;
  44   u1           *top;
  45   const u1     *end;
  46   Thread       *owner;
  47   s8            owner_id;
  48   u1            data[0]; // follows here
  49 };
  50 
  51 #include "evtrace/traceBuffer.inline.hpp"
  52 
  53 #endif /* SHARE_VM_EVTRACE_TRACEBUFFER_HPP */