hotspot/src/share/vm/runtime/timer.hpp
changeset 36178 9739f8c767da
parent 33160 c59f1676d27e
child 37161 e881f320966e
equal deleted inserted replaced
36177:b2b76aba8e42 36178:9739f8c767da
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_VM_RUNTIME_TIMER_HPP
    25 #ifndef SHARE_VM_RUNTIME_TIMER_HPP
    26 #define SHARE_VM_RUNTIME_TIMER_HPP
    26 #define SHARE_VM_RUNTIME_TIMER_HPP
    27 
    27 
       
    28 #include "logging/logTag.hpp"
    28 #include "utilities/globalDefinitions.hpp"
    29 #include "utilities/globalDefinitions.hpp"
    29 
    30 
    30 // Timers for simple measurement.
    31 // Timers for simple measurement.
    31 
    32 
    32 class elapsedTimer VALUE_OBJ_CLASS_SPEC {
    33 class elapsedTimer VALUE_OBJ_CLASS_SPEC {
    83  private:
    84  private:
    84   bool          _active;    // do timing
    85   bool          _active;    // do timing
    85   bool          _verbose;   // report every timing
    86   bool          _verbose;   // report every timing
    86   elapsedTimer  _t;         // timer
    87   elapsedTimer  _t;         // timer
    87   elapsedTimer* _accum;     // accumulator
    88   elapsedTimer* _accum;     // accumulator
       
    89   const char*   _title;     // name of timer
       
    90   LogTagType    _tag;       // stream to print to
       
    91 
    88  public:
    92  public:
    89   // Constructors
    93   // Constructors
    90   TraceTime(const char* title,
    94   TraceTime(const char* title,
    91             bool doit = true);
    95             bool doit = true,
       
    96             LogTagType tag = LogTag::__NO_TAG);
    92   TraceTime(const char* title,
    97   TraceTime(const char* title,
    93             elapsedTimer* accumulator,
    98             elapsedTimer* accumulator,
    94             bool doit = true,
    99             bool doit = true,
    95             bool verbose = false);
   100             bool verbose = false,
       
   101             LogTagType tag = LogTag::__NO_TAG);
    96   ~TraceTime();
   102   ~TraceTime();
    97 
   103 
    98   // Accessors
   104   // Accessors
    99   void set_verbose(bool verbose)  { _verbose = verbose; }
   105   void set_verbose(bool verbose)  { _verbose = verbose; }
   100   bool verbose() const            { return _verbose;    }
   106   bool verbose() const            { return _verbose;    }