Skip to content

Commit e9c962c

Browse files
cost0muchPaul Hohensee
authored andcommitted
8308633: Increase precision of timestamps in g1 log
Backport-of: c23794f88270c121bf99fdf297fdfde53072e3b6
1 parent fd86129 commit e9c962c

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void G1GCPhaseTimes::trace_phase(WorkerDataArray<double>* phase, bool print_sum,
340340
}
341341
}
342342

343-
#define TIME_FORMAT "%.1lfms"
343+
#define TIME_FORMAT "%.2lfms"
344344

345345
void G1GCPhaseTimes::info_time(const char* name, double value) const {
346346
log_info(gc, phases)(" %s: " TIME_FORMAT, name, value);

src/hotspot/share/gc/shared/weakProcessorTimes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static const char* indent_str(size_t i) {
173173
return indents[MIN2(i, max_indents_index)];
174174
}
175175

176-
#define TIME_FORMAT "%.1lfms"
176+
#define TIME_FORMAT "%.2lfms"
177177

178178
void WeakProcessorTimes::log_summary(OopStorageSet::WeakId id, uint indent) const {
179179
LogTarget(Debug, gc, phases) lt;

src/hotspot/share/gc/shared/workerDataArray.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ double WorkerDataArray<double>::uninitialized() {
3636
return -1.0;
3737
}
3838

39+
#define WDA_TIME_FORMAT "%4.2lf"
40+
3941
template <>
4042
void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, double time) {
4143
out->print_cr(" %.1lfms", time * MILLIUNITS);
@@ -48,9 +50,10 @@ void WorkerDataArray<size_t>::WDAPrinter::summary(outputStream* out, size_t valu
4850

4951
template <>
5052
void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, double min, double avg, double max, double diff, double sum, bool print_sum) {
51-
out->print(" Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf", min * MILLIUNITS, avg * MILLIUNITS, max * MILLIUNITS, diff* MILLIUNITS);
53+
out->print(" Min: " WDA_TIME_FORMAT ", Avg: " WDA_TIME_FORMAT ", Max: " WDA_TIME_FORMAT ", Diff: " WDA_TIME_FORMAT,
54+
min * MILLIUNITS, avg * MILLIUNITS, max * MILLIUNITS, diff* MILLIUNITS);
5255
if (print_sum) {
53-
out->print(", Sum: %4.1lf", sum * MILLIUNITS);
56+
out->print(", Sum: " WDA_TIME_FORMAT, sum * MILLIUNITS);
5457
}
5558
}
5659

@@ -68,7 +71,7 @@ void WorkerDataArray<double>::WDAPrinter::details(const WorkerDataArray<double>*
6871
for (uint i = 0; i < phase->_length; ++i) {
6972
double value = phase->get(i);
7073
if (value != phase->uninitialized()) {
71-
out->print(" %4.1lf", phase->get(i) * 1000.0);
74+
out->print(" " WDA_TIME_FORMAT, phase->get(i) * 1000.0);
7275
} else {
7376
out->print(" -");
7477
}

test/hotspot/gtest/gc/shared/test_workerDataArray.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ const char* WorkerDataArrayTest<double>::format_summary(
102102
double min, double avg, double max, double diff, double sum, size_t workers) {
103103

104104
stringStream out;
105-
out.print(" Min: %4.1lf"
106-
", Avg: %4.1lf, Max: %4.1lf"
107-
", Diff: %4.1lf, Sum: %4.1lf"
105+
out.print(" Min: %4.2lf"
106+
", Avg: %4.2lf, Max: %4.2lf"
107+
", Diff: %4.2lf, Sum: %4.2lf"
108108
", Workers: " SIZE_FORMAT "\n",
109109
min, avg, max, diff, sum, workers);
110110
return out.as_string();
@@ -278,12 +278,12 @@ class UninitializedDoubleElementWorkerDataArrayTest : public WorkerDataArrayTest
278278

279279
private:
280280
virtual const char* expected_summary() {
281-
return format_summary(5.1, 6.1, 7.2, 2.1, 12.3, 2);
281+
return format_summary(5.10, 6.15, 7.20, 2.10, 12.30, 2);
282282
}
283283

284284
virtual const char* expected_details() {
285285
stringStream out;
286-
out.print(" %4.1lf - %4.1lf\n", 5.1, 7.2);
286+
out.print(" %4.2lf - %4.2lf\n", 5.1, 7.2);
287287
return out.as_string();
288288
}
289289
};

0 commit comments

Comments
 (0)