1 /* |
1 /* |
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2018, 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. |
25 #ifndef SHARE_VM_TRACE_TRACESTREAM_HPP |
25 #ifndef SHARE_VM_TRACE_TRACESTREAM_HPP |
26 #define SHARE_VM_TRACE_TRACESTREAM_HPP |
26 #define SHARE_VM_TRACE_TRACESTREAM_HPP |
27 |
27 |
28 #include "utilities/macros.hpp" |
28 #include "utilities/macros.hpp" |
29 #if INCLUDE_TRACE |
29 #if INCLUDE_TRACE |
|
30 #include "memory/resourceArea.hpp" |
30 #include "oops/klass.hpp" |
31 #include "oops/klass.hpp" |
31 #include "oops/method.hpp" |
32 #include "oops/method.hpp" |
32 #include "oops/symbol.hpp" |
33 #include "oops/symbol.hpp" |
33 #include "utilities/ostream.hpp" |
34 #include "utilities/ostream.hpp" |
34 |
35 |
77 |
78 |
78 void print_val(const char* label, double val) { |
79 void print_val(const char* label, double val) { |
79 _st.print("%s = %f", label, val); |
80 _st.print("%s = %f", label, val); |
80 } |
81 } |
81 |
82 |
82 // Caller is machine generated code located in traceEventClasses.hpp |
|
83 // Event<TraceId>::writeEvent() (pseudocode) contains the |
|
84 // necessary ResourceMark for the resource allocations below. |
|
85 // See traceEventClasses.xsl for details. |
|
86 void print_val(const char* label, const Klass* const val) { |
83 void print_val(const char* label, const Klass* const val) { |
|
84 ResourceMark rm; |
87 const char* description = "NULL"; |
85 const char* description = "NULL"; |
88 if (val != NULL) { |
86 if (val != NULL) { |
89 Symbol* name = val->name(); |
87 Symbol* name = val->name(); |
90 if (name != NULL) { |
88 if (name != NULL) { |
91 description = name->as_C_string(); |
89 description = name->as_C_string(); |
92 } |
90 } |
93 } |
91 } |
94 _st.print("%s = %s", label, description); |
92 _st.print("%s = %s", label, description); |
95 } |
93 } |
96 |
94 |
97 // Caller is machine generated code located in traceEventClasses.hpp |
|
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) { |
95 void print_val(const char* label, const Method* const val) { |
|
96 ResourceMark rm; |
102 const char* description = "NULL"; |
97 const char* description = "NULL"; |
103 if (val != NULL) { |
98 if (val != NULL) { |
104 description = val->name_and_sig_as_C_string(); |
99 description = val->name_and_sig_as_C_string(); |
105 } |
100 } |
106 _st.print("%s = %s", label, description); |
101 _st.print("%s = %s", label, description); |