Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
7668e175
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7668e175
编写于
2月 28, 2013
作者:
B
brutisso
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
42d6e841
5813feaf
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
139 addition
and
39 deletion
+139
-39
agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java
...share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java
+6
-6
agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
.../src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
+12
-11
agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java
agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java
+9
-7
src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
+3
-3
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+9
-1
src/share/vm/gc_implementation/g1/g1_globals.hpp
src/share/vm/gc_implementation/g1/g1_globals.hpp
+1
-1
src/share/vm/runtime/atomic.hpp
src/share/vm/runtime/atomic.hpp
+11
-1
src/share/vm/utilities/ostream.cpp
src/share/vm/utilities/ostream.cpp
+10
-8
src/share/vm/utilities/ostream.hpp
src/share/vm/utilities/ostream.hpp
+1
-1
test/gc/metaspace/ClassMetaspaceSizeInJmapHeap.java
test/gc/metaspace/ClassMetaspaceSizeInJmapHeap.java
+77
-0
未找到文件。
agent/src/share/classes/sun/jvm/hotspot/tools/
PermStat
.java
→
agent/src/share/classes/sun/jvm/hotspot/tools/
ClassLoaderStats
.java
浏览文件 @
7668e175
/*
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,16 +35,16 @@ import sun.jvm.hotspot.tools.*;
...
@@ -35,16 +35,16 @@ import sun.jvm.hotspot.tools.*;
import
sun.jvm.hotspot.utilities.*
;
import
sun.jvm.hotspot.utilities.*
;
/**
/**
A command line tool to print
perm. generation
statistics.
A command line tool to print
class loader
statistics.
*/
*/
public
class
PermStat
extends
Tool
{
public
class
ClassLoaderStats
extends
Tool
{
boolean
verbose
=
true
;
boolean
verbose
=
true
;
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
PermStat
ps
=
new
PermStat
();
ClassLoaderStats
cls
=
new
ClassLoaderStats
();
p
s
.
start
(
args
);
cl
s
.
start
(
args
);
p
s
.
stop
();
cl
s
.
stop
();
}
}
private
static
class
ClassData
{
private
static
class
ClassData
{
...
...
agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
浏览文件 @
7668e175
...
@@ -57,17 +57,18 @@ public class HeapSummary extends Tool {
...
@@ -57,17 +57,18 @@ public class HeapSummary extends Tool {
printGCAlgorithm
(
flagMap
);
printGCAlgorithm
(
flagMap
);
System
.
out
.
println
();
System
.
out
.
println
();
System
.
out
.
println
(
"Heap Configuration:"
);
System
.
out
.
println
(
"Heap Configuration:"
);
printValue
(
"MinHeapFreeRatio = "
,
getFlagValue
(
"MinHeapFreeRatio"
,
flagMap
));
printValue
(
"MinHeapFreeRatio = "
,
getFlagValue
(
"MinHeapFreeRatio"
,
flagMap
));
printValue
(
"MaxHeapFreeRatio = "
,
getFlagValue
(
"MaxHeapFreeRatio"
,
flagMap
));
printValue
(
"MaxHeapFreeRatio = "
,
getFlagValue
(
"MaxHeapFreeRatio"
,
flagMap
));
printValMB
(
"MaxHeapSize = "
,
getFlagValue
(
"MaxHeapSize"
,
flagMap
));
printValMB
(
"MaxHeapSize = "
,
getFlagValue
(
"MaxHeapSize"
,
flagMap
));
printValMB
(
"NewSize = "
,
getFlagValue
(
"NewSize"
,
flagMap
));
printValMB
(
"NewSize = "
,
getFlagValue
(
"NewSize"
,
flagMap
));
printValMB
(
"MaxNewSize = "
,
getFlagValue
(
"MaxNewSize"
,
flagMap
));
printValMB
(
"MaxNewSize = "
,
getFlagValue
(
"MaxNewSize"
,
flagMap
));
printValMB
(
"OldSize = "
,
getFlagValue
(
"OldSize"
,
flagMap
));
printValMB
(
"OldSize = "
,
getFlagValue
(
"OldSize"
,
flagMap
));
printValue
(
"NewRatio = "
,
getFlagValue
(
"NewRatio"
,
flagMap
));
printValue
(
"NewRatio = "
,
getFlagValue
(
"NewRatio"
,
flagMap
));
printValue
(
"SurvivorRatio = "
,
getFlagValue
(
"SurvivorRatio"
,
flagMap
));
printValue
(
"SurvivorRatio = "
,
getFlagValue
(
"SurvivorRatio"
,
flagMap
));
printValMB
(
"MetaspaceSize = "
,
getFlagValue
(
"MetaspaceSize"
,
flagMap
));
printValMB
(
"MetaspaceSize = "
,
getFlagValue
(
"MetaspaceSize"
,
flagMap
));
printValMB
(
"MaxMetaspaceSize = "
,
getFlagValue
(
"MaxMetaspaceSize"
,
flagMap
));
printValMB
(
"ClassMetaspaceSize = "
,
getFlagValue
(
"ClassMetaspaceSize"
,
flagMap
));
printValMB
(
"G1HeapRegionSize = "
,
HeapRegion
.
grainBytes
());
printValMB
(
"MaxMetaspaceSize = "
,
getFlagValue
(
"MaxMetaspaceSize"
,
flagMap
));
printValMB
(
"G1HeapRegionSize = "
,
HeapRegion
.
grainBytes
());
System
.
out
.
println
();
System
.
out
.
println
();
System
.
out
.
println
(
"Heap Usage:"
);
System
.
out
.
println
(
"Heap Usage:"
);
...
...
agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java
浏览文件 @
7668e175
/*
/*
* Copyright (c) 2004, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -45,7 +45,7 @@ public class JMap extends Tool {
...
@@ -45,7 +45,7 @@ public class JMap extends Tool {
}
}
protected
String
getCommandFlags
()
{
protected
String
getCommandFlags
()
{
return
"-heap|-heap:format=b|-histo|-
permstat
|-finalizerinfo"
;
return
"-heap|-heap:format=b|-histo|-
clstats
|-finalizerinfo"
;
}
}
protected
void
printFlagsUsage
()
{
protected
void
printFlagsUsage
()
{
...
@@ -53,14 +53,14 @@ public class JMap extends Tool {
...
@@ -53,14 +53,14 @@ public class JMap extends Tool {
System
.
out
.
println
(
" -heap\tto print java heap summary"
);
System
.
out
.
println
(
" -heap\tto print java heap summary"
);
System
.
out
.
println
(
" -heap:format=b\tto dump java heap in hprof binary format"
);
System
.
out
.
println
(
" -heap:format=b\tto dump java heap in hprof binary format"
);
System
.
out
.
println
(
" -histo\tto print histogram of java object heap"
);
System
.
out
.
println
(
" -histo\tto print histogram of java object heap"
);
System
.
out
.
println
(
" -
permstat\tto print permanent generation
statistics"
);
System
.
out
.
println
(
" -
clstats\tto print class loader
statistics"
);
System
.
out
.
println
(
" -finalizerinfo\tto print information on objects awaiting finalization"
);
System
.
out
.
println
(
" -finalizerinfo\tto print information on objects awaiting finalization"
);
super
.
printFlagsUsage
();
super
.
printFlagsUsage
();
}
}
public
static
final
int
MODE_HEAP_SUMMARY
=
0
;
public
static
final
int
MODE_HEAP_SUMMARY
=
0
;
public
static
final
int
MODE_HISTOGRAM
=
1
;
public
static
final
int
MODE_HISTOGRAM
=
1
;
public
static
final
int
MODE_
PERMSTAT
=
2
;
public
static
final
int
MODE_
CLSTATS
=
2
;
public
static
final
int
MODE_PMAP
=
3
;
public
static
final
int
MODE_PMAP
=
3
;
public
static
final
int
MODE_HEAP_GRAPH_HPROF_BIN
=
4
;
public
static
final
int
MODE_HEAP_GRAPH_HPROF_BIN
=
4
;
public
static
final
int
MODE_HEAP_GRAPH_GXL
=
5
;
public
static
final
int
MODE_HEAP_GRAPH_GXL
=
5
;
...
@@ -78,8 +78,8 @@ public class JMap extends Tool {
...
@@ -78,8 +78,8 @@ public class JMap extends Tool {
tool
=
new
ObjectHistogram
();
tool
=
new
ObjectHistogram
();
break
;
break
;
case
MODE_
PERMSTAT
:
case
MODE_
CLSTATS
:
tool
=
new
PermStat
();
tool
=
new
ClassLoaderStats
();
break
;
break
;
case
MODE_PMAP:
case
MODE_PMAP:
...
@@ -118,7 +118,9 @@ public class JMap extends Tool {
...
@@ -118,7 +118,9 @@ public class JMap extends Tool {
}
else
if
(
modeFlag
.
equals
(
"-histo"
))
{
}
else
if
(
modeFlag
.
equals
(
"-histo"
))
{
mode
=
MODE_HISTOGRAM
;
mode
=
MODE_HISTOGRAM
;
}
else
if
(
modeFlag
.
equals
(
"-permstat"
))
{
}
else
if
(
modeFlag
.
equals
(
"-permstat"
))
{
mode
=
MODE_PERMSTAT
;
mode
=
MODE_CLSTATS
;
}
else
if
(
modeFlag
.
equals
(
"-clstats"
))
{
mode
=
MODE_CLSTATS
;
}
else
if
(
modeFlag
.
equals
(
"-finalizerinfo"
))
{
}
else
if
(
modeFlag
.
equals
(
"-finalizerinfo"
))
{
mode
=
MODE_FINALIZERINFO
;
mode
=
MODE_FINALIZERINFO
;
}
else
{
}
else
{
...
...
src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
浏览文件 @
7668e175
...
@@ -117,7 +117,7 @@ void ConcurrentMarkThread::run() {
...
@@ -117,7 +117,7 @@ void ConcurrentMarkThread::run() {
if
(
G1Log
::
fine
())
{
if
(
G1Log
::
fine
())
{
gclog_or_tty
->
date_stamp
(
PrintGCDateStamps
);
gclog_or_tty
->
date_stamp
(
PrintGCDateStamps
);
gclog_or_tty
->
stamp
(
PrintGCTimeStamps
);
gclog_or_tty
->
stamp
(
PrintGCTimeStamps
);
gclog_or_tty
->
print_cr
(
"[GC concurrent-root-region-scan-end, %1.7lf]"
,
gclog_or_tty
->
print_cr
(
"[GC concurrent-root-region-scan-end, %1.7lf
secs
]"
,
scan_end
-
scan_start
);
scan_end
-
scan_start
);
}
}
}
}
...
@@ -150,7 +150,7 @@ void ConcurrentMarkThread::run() {
...
@@ -150,7 +150,7 @@ void ConcurrentMarkThread::run() {
if
(
G1Log
::
fine
())
{
if
(
G1Log
::
fine
())
{
gclog_or_tty
->
date_stamp
(
PrintGCDateStamps
);
gclog_or_tty
->
date_stamp
(
PrintGCDateStamps
);
gclog_or_tty
->
stamp
(
PrintGCTimeStamps
);
gclog_or_tty
->
stamp
(
PrintGCTimeStamps
);
gclog_or_tty
->
print_cr
(
"[GC concurrent-mark-end, %1.7lf sec]"
,
gclog_or_tty
->
print_cr
(
"[GC concurrent-mark-end, %1.7lf sec
s
]"
,
mark_end_sec
-
mark_start_sec
);
mark_end_sec
-
mark_start_sec
);
}
}
...
@@ -234,7 +234,7 @@ void ConcurrentMarkThread::run() {
...
@@ -234,7 +234,7 @@ void ConcurrentMarkThread::run() {
if
(
G1Log
::
fine
())
{
if
(
G1Log
::
fine
())
{
gclog_or_tty
->
date_stamp
(
PrintGCDateStamps
);
gclog_or_tty
->
date_stamp
(
PrintGCDateStamps
);
gclog_or_tty
->
stamp
(
PrintGCTimeStamps
);
gclog_or_tty
->
stamp
(
PrintGCTimeStamps
);
gclog_or_tty
->
print_cr
(
"[GC concurrent-cleanup-end, %1.7lf]"
,
gclog_or_tty
->
print_cr
(
"[GC concurrent-cleanup-end, %1.7lf
secs
]"
,
cleanup_end_sec
-
cleanup_start_sec
);
cleanup_end_sec
-
cleanup_start_sec
);
}
}
}
}
...
...
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
浏览文件 @
7668e175
...
@@ -267,7 +267,15 @@ G1CollectorPolicy::G1CollectorPolicy() :
...
@@ -267,7 +267,15 @@ G1CollectorPolicy::G1CollectorPolicy() :
double
max_gc_time
=
(
double
)
MaxGCPauseMillis
/
1000.0
;
double
max_gc_time
=
(
double
)
MaxGCPauseMillis
/
1000.0
;
double
time_slice
=
(
double
)
GCPauseIntervalMillis
/
1000.0
;
double
time_slice
=
(
double
)
GCPauseIntervalMillis
/
1000.0
;
_mmu_tracker
=
new
G1MMUTrackerQueue
(
time_slice
,
max_gc_time
);
_mmu_tracker
=
new
G1MMUTrackerQueue
(
time_slice
,
max_gc_time
);
_sigma
=
(
double
)
G1ConfidencePercent
/
100.0
;
uintx
confidence_perc
=
G1ConfidencePercent
;
// Put an artificial ceiling on this so that it's not set to a silly value.
if
(
confidence_perc
>
100
)
{
confidence_perc
=
100
;
warning
(
"G1ConfidencePercent is set to a value that is too large, "
"it's been updated to %u"
,
confidence_perc
);
}
_sigma
=
(
double
)
confidence_perc
/
100.0
;
// start conservatively (around 50ms is about right)
// start conservatively (around 50ms is about right)
_concurrent_mark_remark_times_ms
->
add
(
0.05
);
_concurrent_mark_remark_times_ms
->
add
(
0.05
);
...
...
src/share/vm/gc_implementation/g1/g1_globals.hpp
浏览文件 @
7668e175
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#define G1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw) \
#define G1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw) \
\
\
product(
intx, G1ConfidencePercent, 50,
\
product(
uintx, G1ConfidencePercent, 50,
\
"Confidence level for MMU/pause predictions") \
"Confidence level for MMU/pause predictions") \
\
\
develop(intx, G1MarkingOverheadPercent, 0, \
develop(intx, G1MarkingOverheadPercent, 0, \
...
...
src/share/vm/runtime/atomic.hpp
浏览文件 @
7668e175
...
@@ -29,10 +29,17 @@
...
@@ -29,10 +29,17 @@
class
Atomic
:
AllStatic
{
class
Atomic
:
AllStatic
{
public:
public:
// Atomic operations on jlong types are not available on all 32-bit
// platforms. If atomic ops on jlongs are defined here they must only
// be used from code that verifies they are available at runtime and
// can provide an alternative action if not - see supports_cx8() for
// a means to test availability.
// Atomically store to a location
// Atomically store to a location
inline
static
void
store
(
jbyte
store_value
,
jbyte
*
dest
);
inline
static
void
store
(
jbyte
store_value
,
jbyte
*
dest
);
inline
static
void
store
(
jshort
store_value
,
jshort
*
dest
);
inline
static
void
store
(
jshort
store_value
,
jshort
*
dest
);
inline
static
void
store
(
jint
store_value
,
jint
*
dest
);
inline
static
void
store
(
jint
store_value
,
jint
*
dest
);
// See comment above about using jlong atomics on 32-bit platforms
inline
static
void
store
(
jlong
store_value
,
jlong
*
dest
);
inline
static
void
store
(
jlong
store_value
,
jlong
*
dest
);
inline
static
void
store_ptr
(
intptr_t
store_value
,
intptr_t
*
dest
);
inline
static
void
store_ptr
(
intptr_t
store_value
,
intptr_t
*
dest
);
inline
static
void
store_ptr
(
void
*
store_value
,
void
*
dest
);
inline
static
void
store_ptr
(
void
*
store_value
,
void
*
dest
);
...
@@ -40,17 +47,19 @@ class Atomic : AllStatic {
...
@@ -40,17 +47,19 @@ class Atomic : AllStatic {
inline
static
void
store
(
jbyte
store_value
,
volatile
jbyte
*
dest
);
inline
static
void
store
(
jbyte
store_value
,
volatile
jbyte
*
dest
);
inline
static
void
store
(
jshort
store_value
,
volatile
jshort
*
dest
);
inline
static
void
store
(
jshort
store_value
,
volatile
jshort
*
dest
);
inline
static
void
store
(
jint
store_value
,
volatile
jint
*
dest
);
inline
static
void
store
(
jint
store_value
,
volatile
jint
*
dest
);
// See comment above about using jlong atomics on 32-bit platforms
inline
static
void
store
(
jlong
store_value
,
volatile
jlong
*
dest
);
inline
static
void
store
(
jlong
store_value
,
volatile
jlong
*
dest
);
inline
static
void
store_ptr
(
intptr_t
store_value
,
volatile
intptr_t
*
dest
);
inline
static
void
store_ptr
(
intptr_t
store_value
,
volatile
intptr_t
*
dest
);
inline
static
void
store_ptr
(
void
*
store_value
,
volatile
void
*
dest
);
inline
static
void
store_ptr
(
void
*
store_value
,
volatile
void
*
dest
);
// See comment above about using jlong atomics on 32-bit platforms
inline
static
jlong
load
(
volatile
jlong
*
src
);
inline
static
jlong
load
(
volatile
jlong
*
src
);
// Atomically add to a location, return updated value
// Atomically add to a location, return updated value
inline
static
jint
add
(
jint
add_value
,
volatile
jint
*
dest
);
inline
static
jint
add
(
jint
add_value
,
volatile
jint
*
dest
);
inline
static
intptr_t
add_ptr
(
intptr_t
add_value
,
volatile
intptr_t
*
dest
);
inline
static
intptr_t
add_ptr
(
intptr_t
add_value
,
volatile
intptr_t
*
dest
);
inline
static
void
*
add_ptr
(
intptr_t
add_value
,
volatile
void
*
dest
);
inline
static
void
*
add_ptr
(
intptr_t
add_value
,
volatile
void
*
dest
);
// See comment above about using jlong atomics on 32-bit platforms
static
jlong
add
(
jlong
add_value
,
volatile
jlong
*
dest
);
static
jlong
add
(
jlong
add_value
,
volatile
jlong
*
dest
);
// Atomically increment location
// Atomically increment location
...
@@ -75,6 +84,7 @@ class Atomic : AllStatic {
...
@@ -75,6 +84,7 @@ class Atomic : AllStatic {
// barrier across the cmpxchg. I.e., it's really a 'fence_cmpxchg_acquire'.
// barrier across the cmpxchg. I.e., it's really a 'fence_cmpxchg_acquire'.
static
jbyte
cmpxchg
(
jbyte
exchange_value
,
volatile
jbyte
*
dest
,
jbyte
compare_value
);
static
jbyte
cmpxchg
(
jbyte
exchange_value
,
volatile
jbyte
*
dest
,
jbyte
compare_value
);
inline
static
jint
cmpxchg
(
jint
exchange_value
,
volatile
jint
*
dest
,
jint
compare_value
);
inline
static
jint
cmpxchg
(
jint
exchange_value
,
volatile
jint
*
dest
,
jint
compare_value
);
// See comment above about using jlong atomics on 32-bit platforms
inline
static
jlong
cmpxchg
(
jlong
exchange_value
,
volatile
jlong
*
dest
,
jlong
compare_value
);
inline
static
jlong
cmpxchg
(
jlong
exchange_value
,
volatile
jlong
*
dest
,
jlong
compare_value
);
static
unsigned
int
cmpxchg
(
unsigned
int
exchange_value
,
static
unsigned
int
cmpxchg
(
unsigned
int
exchange_value
,
...
...
src/share/vm/utilities/ostream.cpp
浏览文件 @
7668e175
...
@@ -431,7 +431,7 @@ rotatingFileStream::~rotatingFileStream() {
...
@@ -431,7 +431,7 @@ rotatingFileStream::~rotatingFileStream() {
rotatingFileStream
::
rotatingFileStream
(
const
char
*
file_name
)
{
rotatingFileStream
::
rotatingFileStream
(
const
char
*
file_name
)
{
_cur_file_num
=
0
;
_cur_file_num
=
0
;
_bytes_writen
=
0L
;
_bytes_writ
t
en
=
0L
;
_file_name
=
NEW_C_HEAP_ARRAY
(
char
,
strlen
(
file_name
)
+
10
,
mtInternal
);
_file_name
=
NEW_C_HEAP_ARRAY
(
char
,
strlen
(
file_name
)
+
10
,
mtInternal
);
jio_snprintf
(
_file_name
,
strlen
(
file_name
)
+
10
,
"%s.%d"
,
file_name
,
_cur_file_num
);
jio_snprintf
(
_file_name
,
strlen
(
file_name
)
+
10
,
"%s.%d"
,
file_name
,
_cur_file_num
);
_file
=
fopen
(
_file_name
,
"w"
);
_file
=
fopen
(
_file_name
,
"w"
);
...
@@ -440,7 +440,7 @@ rotatingFileStream::rotatingFileStream(const char* file_name) {
...
@@ -440,7 +440,7 @@ rotatingFileStream::rotatingFileStream(const char* file_name) {
rotatingFileStream
::
rotatingFileStream
(
const
char
*
file_name
,
const
char
*
opentype
)
{
rotatingFileStream
::
rotatingFileStream
(
const
char
*
file_name
,
const
char
*
opentype
)
{
_cur_file_num
=
0
;
_cur_file_num
=
0
;
_bytes_writen
=
0L
;
_bytes_writ
t
en
=
0L
;
_file_name
=
NEW_C_HEAP_ARRAY
(
char
,
strlen
(
file_name
)
+
10
,
mtInternal
);
_file_name
=
NEW_C_HEAP_ARRAY
(
char
,
strlen
(
file_name
)
+
10
,
mtInternal
);
jio_snprintf
(
_file_name
,
strlen
(
file_name
)
+
10
,
"%s.%d"
,
file_name
,
_cur_file_num
);
jio_snprintf
(
_file_name
,
strlen
(
file_name
)
+
10
,
"%s.%d"
,
file_name
,
_cur_file_num
);
_file
=
fopen
(
_file_name
,
opentype
);
_file
=
fopen
(
_file_name
,
opentype
);
...
@@ -448,10 +448,9 @@ rotatingFileStream::rotatingFileStream(const char* file_name, const char* openty
...
@@ -448,10 +448,9 @@ rotatingFileStream::rotatingFileStream(const char* file_name, const char* openty
}
}
void
rotatingFileStream
::
write
(
const
char
*
s
,
size_t
len
)
{
void
rotatingFileStream
::
write
(
const
char
*
s
,
size_t
len
)
{
if
(
_file
!=
NULL
)
{
if
(
_file
!=
NULL
)
{
// Make an unused local variable to avoid warning from gcc 4.x compiler.
size_t
count
=
fwrite
(
s
,
1
,
len
,
_file
);
size_t
count
=
fwrite
(
s
,
1
,
len
,
_file
);
Atomic
::
add
((
jlong
)
count
,
&
_bytes_writen
)
;
_bytes_written
+=
count
;
}
}
update_position
(
s
,
len
);
update_position
(
s
,
len
);
}
}
...
@@ -465,7 +464,10 @@ void rotatingFileStream::write(const char* s, size_t len) {
...
@@ -465,7 +464,10 @@ void rotatingFileStream::write(const char* s, size_t len) {
// concurrent GC threads to run parallel with VMThread at safepoint, write and rotate_log
// concurrent GC threads to run parallel with VMThread at safepoint, write and rotate_log
// must be synchronized.
// must be synchronized.
void
rotatingFileStream
::
rotate_log
()
{
void
rotatingFileStream
::
rotate_log
()
{
if
(
_bytes_writen
<
(
jlong
)
GCLogFileSize
)
return
;
if
(
_bytes_written
<
(
jlong
)
GCLogFileSize
)
{
return
;
}
#ifdef ASSERT
#ifdef ASSERT
Thread
*
thread
=
Thread
::
current
();
Thread
*
thread
=
Thread
::
current
();
assert
(
thread
==
NULL
||
assert
(
thread
==
NULL
||
...
@@ -475,7 +477,7 @@ void rotatingFileStream::rotate_log() {
...
@@ -475,7 +477,7 @@ void rotatingFileStream::rotate_log() {
if
(
NumberOfGCLogFiles
==
1
)
{
if
(
NumberOfGCLogFiles
==
1
)
{
// rotate in same file
// rotate in same file
rewind
();
rewind
();
_bytes_writen
=
0L
;
_bytes_writ
t
en
=
0L
;
return
;
return
;
}
}
...
@@ -491,7 +493,7 @@ void rotatingFileStream::rotate_log() {
...
@@ -491,7 +493,7 @@ void rotatingFileStream::rotate_log() {
}
}
_file
=
fopen
(
_file_name
,
"w"
);
_file
=
fopen
(
_file_name
,
"w"
);
if
(
_file
!=
NULL
)
{
if
(
_file
!=
NULL
)
{
_bytes_writen
=
0L
;
_bytes_writ
t
en
=
0L
;
_need_close
=
true
;
_need_close
=
true
;
}
else
{
}
else
{
tty
->
print_cr
(
"failed to open rotation log file %s due to %s
\n
"
,
tty
->
print_cr
(
"failed to open rotation log file %s due to %s
\n
"
,
...
...
src/share/vm/utilities/ostream.hpp
浏览文件 @
7668e175
...
@@ -231,7 +231,7 @@ class fdStream : public outputStream {
...
@@ -231,7 +231,7 @@ class fdStream : public outputStream {
class
rotatingFileStream
:
public
fileStream
{
class
rotatingFileStream
:
public
fileStream
{
protected:
protected:
char
*
_file_name
;
char
*
_file_name
;
jlong
_bytes_writen
;
jlong
_bytes_writ
t
en
;
uintx
_cur_file_num
;
// current logfile rotation number, from 0 to MaxGCLogFileNumbers-1
uintx
_cur_file_num
;
// current logfile rotation number, from 0 to MaxGCLogFileNumbers-1
public:
public:
rotatingFileStream
(
const
char
*
file_name
);
rotatingFileStream
(
const
char
*
file_name
);
...
...
test/gc/metaspace/ClassMetaspaceSizeInJmapHeap.java
0 → 100644
浏览文件 @
7668e175
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test ClassMetaspaceSizeInJmapHeap
* @bug 8004924
* @summary Checks that jmap -heap contains the flag ClassMetaspaceSize
* @library /testlibrary
* @run main/othervm -XX:ClassMetaspaceSize=50m ClassMetaspaceSizeInJmapHeap
*/
import
com.oracle.java.testlibrary.*
;
import
java.nio.file.*
;
import
java.io.File
;
import
java.nio.charset.Charset
;
import
java.util.List
;
public
class
ClassMetaspaceSizeInJmapHeap
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
pid
=
Integer
.
toString
(
ProcessTools
.
getProcessId
());
ProcessBuilder
pb
=
new
ProcessBuilder
();
pb
.
command
(
JDKToolFinder
.
getJDKTool
(
"jmap"
),
"-heap"
,
pid
);
File
out
=
new
File
(
"ClassMetaspaceSizeInJmapHeap.stdout.txt"
);
pb
.
redirectOutput
(
out
);
File
err
=
new
File
(
"ClassMetaspaceSizeInJmapHeap.stderr.txt"
);
pb
.
redirectError
(
err
);
run
(
pb
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
read
(
out
));
output
.
shouldContain
(
"ClassMetaspaceSize = 52428800 (50.0MB)"
);
out
.
delete
();
}
private
static
void
run
(
ProcessBuilder
pb
)
throws
Exception
{
Process
p
=
pb
.
start
();
p
.
waitFor
();
int
exitValue
=
p
.
exitValue
();
if
(
exitValue
!=
0
)
{
throw
new
Exception
(
"jmap -heap exited with error code: "
+
exitValue
);
}
}
private
static
String
read
(
File
f
)
throws
Exception
{
Path
p
=
f
.
toPath
();
List
<
String
>
lines
=
Files
.
readAllLines
(
p
,
Charset
.
defaultCharset
());
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
line
:
lines
)
{
sb
.
append
(
line
).
append
(
'\n'
);
}
return
sb
.
toString
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录