1 /*
2 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
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 *
68 "com.sun.rt",
69 "sun.rt",
70 "java.os", // Operating System name spaces
71 "com.sun.os",
72 "sun.os",
73 "java.threads", // Threads System name spaces
74 "com.sun.threads",
75 "sun.threads",
76 "java.property", // Java Property name spaces
77 "com.sun.property",
78 "sun.property",
79 "",
80 };
81
82 PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v)
83 : _name(NULL), _v(v), _u(u), _on_c_heap(false), _valuep(NULL) {
84
85 const char* prefix = PerfDataManager::ns_to_string(ns);
86
87 _name = NEW_C_HEAP_ARRAY(char, strlen(name) + strlen(prefix) + 2, mtInternal);
88 assert(_name != NULL && strlen(name) != 0, "invalid name");
89
90 if (ns == NULL_NS) {
91 // No prefix is added to counters with the NULL_NS namespace.
92 strcpy(_name, name);
93 // set the F_Supported flag based on the counter name prefix.
94 if (PerfDataManager::is_stable_supported(_name) ||
95 PerfDataManager::is_unstable_supported(_name)) {
96 _flags = F_Supported;
97 }
98 else {
99 _flags = F_None;
100 }
101 }
102 else {
103 sprintf(_name, "%s.%s", prefix, name);
104 // set the F_Supported flag based on the given namespace.
105 if (PerfDataManager::is_stable_supported(ns) ||
106 PerfDataManager::is_unstable_supported(ns)) {
107 _flags = F_Supported;
108 }
|
1 /*
2 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
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 *
68 "com.sun.rt",
69 "sun.rt",
70 "java.os", // Operating System name spaces
71 "com.sun.os",
72 "sun.os",
73 "java.threads", // Threads System name spaces
74 "com.sun.threads",
75 "sun.threads",
76 "java.property", // Java Property name spaces
77 "com.sun.property",
78 "sun.property",
79 "",
80 };
81
82 PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v)
83 : _name(NULL), _v(v), _u(u), _on_c_heap(false), _valuep(NULL) {
84
85 const char* prefix = PerfDataManager::ns_to_string(ns);
86
87 _name = NEW_C_HEAP_ARRAY(char, strlen(name) + strlen(prefix) + 2, mtInternal);
88 assert(strlen(name) != 0, "invalid name");
89
90 if (ns == NULL_NS) {
91 // No prefix is added to counters with the NULL_NS namespace.
92 strcpy(_name, name);
93 // set the F_Supported flag based on the counter name prefix.
94 if (PerfDataManager::is_stable_supported(_name) ||
95 PerfDataManager::is_unstable_supported(_name)) {
96 _flags = F_Supported;
97 }
98 else {
99 _flags = F_None;
100 }
101 }
102 else {
103 sprintf(_name, "%s.%s", prefix, name);
104 // set the F_Supported flag based on the given namespace.
105 if (PerfDataManager::is_stable_supported(ns) ||
106 PerfDataManager::is_unstable_supported(ns)) {
107 _flags = F_Supported;
108 }
|