Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/hotspot/os/linux/vitals_linux_oswrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ProcFile {
char* endptr = nullptr;
value = (value_t)::strtoll(text, &endptr, 10);
if (endptr == text || errno != 0) {
log_debug(vitals, os)("Failed to parse \"%s\"", text);
value = INVALID_VALUE;
} else {
value *= scale;
Expand All @@ -120,7 +121,10 @@ class ProcFile {
if (s != nullptr) {
errno = 0;
const char* p = s + ::strlen(prefix);
return as_value(p, scale);
value = as_value(p, scale);
log_trace(vitals, os)("Reading \"%s\": %llu", prefix, (unsigned long long) value);
} else {
log_debug(vitals, os)("Could not find prefix \"%s\"", prefix);
}
return value;
}
Expand Down
12 changes: 6 additions & 6 deletions test/hotspot/jtreg/runtime/Vitals/TestHiMemReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void testPrint() throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportMax=64m",
"-XX:NativeMemoryTracking=summary",
"-Xlog:vitals=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-Xlog:vitals=trace,vitals+os=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-Xmx128m", "-Xms128m", "-XX:+AlwaysPreTouch",
TestHiMemReport.class.getName(),
"sleep", "2" // num seconds to sleep to give the reporter thread time to generate output
Expand All @@ -120,7 +120,7 @@ static void testDump() throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportMax=64m",
"-XX:NativeMemoryTracking=summary",
"-Xlog:vitals=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-Xlog:vitals=trace,vitals+os=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-XX:HiMemReportDir=himemreport-1",
"-Xmx128m", "-Xms128m", "-XX:+AlwaysPreTouch",
TestHiMemReport.class.getName(),
Expand Down Expand Up @@ -154,12 +154,12 @@ static void testDumpWithExecToReportDir() throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportMax=64m",
"-XX:HiMemReportDir=himemreport-2",
"-Xlog:vitals=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-Xlog:vitals=trace,vitals+os=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-XX:HiMemReportExec=VM.flags -all;VM.metaspace show-loaders;GC.heap_dump",
"-XX:NativeMemoryTracking=summary",
"-Xmx128m", "-Xms128m", "-XX:+AlwaysPreTouch",
TestHiMemReport.class.getName(),
"sleep", "12" // num seconds to sleep to give the reporter thread time to generate output
"sleep", "30" // num seconds to sleep to give the reporter thread time to generate output
);

OutputAnalyzer output = new OutputAnalyzer(pb.start());
Expand Down Expand Up @@ -262,7 +262,7 @@ static void testDumpWithExecToStderr() throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportMax=64m",
"-XX:HiMemReportExec=VM.flags -all;VM.metaspace show-loaders",
"-Xlog:vitals=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-Xlog:vitals=trace,vitals+os=trace", "-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-XX:NativeMemoryTracking=summary",
"-Xmx128m", "-Xms128m", "-XX:+AlwaysPreTouch",
TestHiMemReport.class.getName(),
Expand Down Expand Up @@ -309,7 +309,7 @@ static void testDumpWithExecToStderr() throws Exception {
static void testHasNaturalMax() throws IOException {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+PrintVitalsAtExit", "-XX:VitalsSampleInterval=1",
"-XX:+HiMemReport", "-Xlog:vitals=trace", "-Xmx64m", "-version");
"-XX:+HiMemReport", "-Xlog:vitals=trace,vitals+os=trace", "-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
output.shouldNotMatch("HiMemReport.*limit could not be established");
Expand Down
18 changes: 9 additions & 9 deletions test/hotspot/jtreg/runtime/Vitals/TestHiMemReportArgParsing.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ static void testValidNonExistingReportDir() throws IOException {
File subdir = VitalsUtils.createSubTestDir("test-outputdir-1", false);
VitalsUtils.fileShouldNotExist(subdir);
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportDir=" + subdir.getAbsolutePath(), "-Xlog:vitals",
"-Xmx64m", "-version");
"-XX:+HiMemReport", "-XX:HiMemReportDir=" + subdir.getAbsolutePath(),
"-Xlog:vitals=trace,vitals+os=trace", "-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
output.shouldHaveExitValue(0);
Expand All @@ -97,8 +97,8 @@ static void testValidExistingReportDir() throws IOException {
File subdir = VitalsUtils.createSubTestDir("test-outputdir-2", true);
VitalsUtils.fileShouldExist(subdir);
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportDir=" + subdir.getAbsolutePath(), "-Xlog:vitals",
"-Xmx64m", "-version");
"-XX:+HiMemReport", "-XX:HiMemReportDir=" + subdir.getAbsolutePath(),
"-Xlog:vitals=trace,vitals+os=trace", "-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
output.shouldHaveExitValue(0);
Expand All @@ -117,8 +117,8 @@ static void testInValidReportDir() throws IOException {
File f = new File("/tmp/gibsnicht/gibsnicht/gibsnicht");
VitalsUtils.fileShouldNotExist(f);
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-XX:HiMemReportDir=" + f.getAbsolutePath(), "-Xlog:vitals",
"-Xmx64m", "-version");
"-XX:+HiMemReport", "-XX:HiMemReportDir=" + f.getAbsolutePath(),
"-Xlog:vitals=trace,vitals+os=trace", "-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
output.shouldNotHaveExitValue(0);
Expand All @@ -134,7 +134,7 @@ static void testInValidReportDir() throws IOException {
*/
static void testHiMemReportOn() throws IOException {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+HiMemReport", "-Xlog:vitals",
"-XX:+HiMemReport", "-Xlog:vitals=trace,vitals+os=trace",
"-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
Expand All @@ -150,7 +150,7 @@ static void testHiMemReportOn() throws IOException {
*/
static void testHiMemReportOff() throws IOException {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:-HiMemReport", "-Xlog:vitals",
"-XX:-HiMemReport", "-Xlog:vitals=trace,vitals+os=trace",
"-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
Expand All @@ -163,7 +163,7 @@ static void testHiMemReportOff() throws IOException {
*/
static void testHiMemReportOffByDefault() throws IOException {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-Xlog:vitals",
"-Xlog:vitals=trace,vitals+os=trace",
"-Xmx64m", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
Expand Down