traceStream.hpp revision 4141
36N/A/*
2362N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
36N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36N/A *
36N/A * This code is free software; you can redistribute it and/or modify it
36N/A * under the terms of the GNU General Public License version 2 only, as
36N/A * published by the Free Software Foundation.
36N/A *
36N/A * This code is distributed in the hope that it will be useful, but WITHOUT
36N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
36N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
36N/A * version 2 for more details (a copy is included in the LICENSE file that
36N/A * accompanied this code).
36N/A *
36N/A * You should have received a copy of the GNU General Public License version
36N/A * 2 along with this work; if not, write to the Free Software Foundation,
36N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
36N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
36N/A *
36N/A */
36N/A
36N/A#ifndef SHARE_VM_TRACE_TRACESTREAM_HPP
36N/A#define SHARE_VM_TRACE_TRACESTREAM_HPP
36N/A
36N/A#if INCLUDE_TRACE
36N/A
36N/A#include "utilities/ostream.hpp"
36N/A#include "oops/methodOop.hpp"
36N/A#include "oops/klassOop.hpp"
36N/A
36N/Aclass TraceStream : public StackObj {
36N/A private:
36N/A outputStream& _st;
36N/A
36N/A public:
36N/A TraceStream(outputStream& stream): _st(stream) {}
36N/A
36N/A void print_val(const char* label, u1 val) {
36N/A _st.print("%s = "UINT32_FORMAT, label, val);
36N/A }
36N/A
36N/A void print_val(const char* label, u2 val) {
36N/A _st.print("%s = "UINT32_FORMAT, label, val);
36N/A }
36N/A
36N/A void print_val(const char* label, s2 val) {
36N/A _st.print("%s = "INT32_FORMAT, label, val);
36N/A }
36N/A
36N/A void print_val(const char* label, u4 val) {
36N/A _st.print("%s = "UINT32_FORMAT, label, val);
}
void print_val(const char* label, s4 val) {
_st.print("%s = "INT32_FORMAT, label, val);
}
void print_val(const char* label, u8 val) {
_st.print("%s = "UINT64_FORMAT, label, val);
}
void print_val(const char* label, s8 val) {
_st.print("%s = "INT64_FORMAT, label, val);
}
void print_val(const char* label, bool val) {
_st.print("%s = %s", label, val ? "true" : "false");
}
void print_val(const char* label, float val) {
_st.print("%s = %f", label, val);
}
void print_val(const char* label, double val) {
_st.print("%s = %f", label, val);
}
void print_val(const char* label, klassOop& val) {
_st.print("%s = %s", label, val->print_string());
}
void print_val(const char* label, methodOop& val) {
_st.print("%s = %s", label, val->print_string());
}
void print_val(const char* label, const char* val) {
_st.print("%s = '%s'", label, val);
}
void print(const char* val) {
_st.print(val);
}
};
#endif
#endif