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 */
23 package common;
24
25 import sun.hotspot.code.BlobType;
26 import java.util.Arrays;
27
28 public class CodeCacheInfoFormatter {
29 private static final String DEFAULT_SIZE_FORMAT = "[0-9]+Kb";
30 private BlobType heap = null;
31 private String size = DEFAULT_SIZE_FORMAT;
32 private String used = DEFAULT_SIZE_FORMAT;
33 private String maxUsed = DEFAULT_SIZE_FORMAT;
34 private String free = DEFAULT_SIZE_FORMAT;
35
36 public static CodeCacheInfoFormatter forHeap(BlobType heap) {
37 return new CodeCacheInfoFormatter(heap);
38 }
39
40 public static String[] forHeaps(BlobType... heaps) {
41 return Arrays.stream(heaps)
42 .map(CodeCacheInfoFormatter::forHeap)
43 .map(CodeCacheInfoFormatter::getInfoString)
44 .toArray(String[]::new);
45 }
|
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 */
23 package compiler.codecache.cli.common;
24
25 import sun.hotspot.code.BlobType;
26
27 import java.util.Arrays;
28
29 public class CodeCacheInfoFormatter {
30 private static final String DEFAULT_SIZE_FORMAT = "[0-9]+Kb";
31 private BlobType heap = null;
32 private String size = DEFAULT_SIZE_FORMAT;
33 private String used = DEFAULT_SIZE_FORMAT;
34 private String maxUsed = DEFAULT_SIZE_FORMAT;
35 private String free = DEFAULT_SIZE_FORMAT;
36
37 public static CodeCacheInfoFormatter forHeap(BlobType heap) {
38 return new CodeCacheInfoFormatter(heap);
39 }
40
41 public static String[] forHeaps(BlobType... heaps) {
42 return Arrays.stream(heaps)
43 .map(CodeCacheInfoFormatter::forHeap)
44 .map(CodeCacheInfoFormatter::getInfoString)
45 .toArray(String[]::new);
46 }
|