< prev index next >

hotspot/src/share/vm/trace/traceStream.hpp

Print this page
rev 6909 : 8065361: Fixup headers and definitions for INCLUDE_TRACE
Reviewed-by: sla, stefank


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_TRACE_TRACESTREAM_HPP
  26 #define SHARE_VM_TRACE_TRACESTREAM_HPP
  27 
  28 #include "utilities/macros.hpp"
  29 
  30 #if INCLUDE_TRACE
  31 
  32 #include "oops/klass.hpp"
  33 #include "oops/method.hpp"
  34 #include "oops/symbol.hpp"
  35 #include "utilities/ostream.hpp"
  36 
  37 class TraceStream : public StackObj {
  38  private:
  39   outputStream& _st;
  40 
  41  public:
  42   TraceStream(outputStream& stream): _st(stream) {}
  43 
  44   void print_val(const char* label, u1 val) {
  45     _st.print("%s = "UINT32_FORMAT, label, val);
  46   }
  47 
  48   void print_val(const char* label, u2 val) {
  49     _st.print("%s = "UINT32_FORMAT, label, val);
  50   }
  51 


 100   // Event<TraceId>::writeEvent() (pseudocode) contains the
 101   // necessary ResourceMark for the resource allocations below.
 102   // See traceEventClasses.xsl for details.
 103   void print_val(const char* label, const Method* const val) {
 104     const char* description = "NULL";
 105     if (val != NULL) {
 106       description = val->name_and_sig_as_C_string();
 107     }
 108     _st.print("%s = %s", label, description);
 109   }
 110 
 111   void print_val(const char* label, const char* val) {
 112     _st.print("%s = '%s'", label, val);
 113   }
 114 
 115   void print(const char* val) {
 116     _st.print("%s", val);
 117   }
 118 };
 119 
 120 #endif /* INCLUDE_TRACE */
 121 #endif /* SHARE_VM_TRACE_TRACESTREAM_HPP */


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_TRACE_TRACESTREAM_HPP
  26 #define SHARE_VM_TRACE_TRACESTREAM_HPP
  27 
  28 #include "utilities/macros.hpp"

  29 #if INCLUDE_TRACE

  30 #include "oops/klass.hpp"
  31 #include "oops/method.hpp"
  32 #include "oops/symbol.hpp"
  33 #include "utilities/ostream.hpp"
  34 
  35 class TraceStream : public StackObj {
  36  private:
  37   outputStream& _st;
  38 
  39  public:
  40   TraceStream(outputStream& stream): _st(stream) {}
  41 
  42   void print_val(const char* label, u1 val) {
  43     _st.print("%s = "UINT32_FORMAT, label, val);
  44   }
  45 
  46   void print_val(const char* label, u2 val) {
  47     _st.print("%s = "UINT32_FORMAT, label, val);
  48   }
  49 


  98   // Event<TraceId>::writeEvent() (pseudocode) contains the
  99   // necessary ResourceMark for the resource allocations below.
 100   // See traceEventClasses.xsl for details.
 101   void print_val(const char* label, const Method* const val) {
 102     const char* description = "NULL";
 103     if (val != NULL) {
 104       description = val->name_and_sig_as_C_string();
 105     }
 106     _st.print("%s = %s", label, description);
 107   }
 108 
 109   void print_val(const char* label, const char* val) {
 110     _st.print("%s = '%s'", label, val);
 111   }
 112 
 113   void print(const char* val) {
 114     _st.print("%s", val);
 115   }
 116 };
 117 
 118 #endif // INCLUDE_TRACE
 119 #endif // SHARE_VM_TRACE_TRACESTREAM_HPP
< prev index next >