< prev index next >
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/BasicLogEvent.java
Print this page
rev 8632 : 6900757: minor bug fixes to LogCompilation tool
* improve internal error reporting (point to XML element causing trouble)
* fix comparator for sorting by name and start
* make tool more robust wrt. incorrect options and files not found
* make inlining decision output more clear
* adopt uncommon traps history printing
* properly mention compiler in generated logs
* add options for printing time stamps and omitting compilation IDs
* add option for comparing compilation logs
* overall code cleanup and API documentation
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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.
@@ -25,51 +25,70 @@
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
/**
- *
- * @author never
+ * Provide basic data structures and behaviour for {@link LogEvent}s.
*/
public abstract class BasicLogEvent implements LogEvent {
+ /**
+ * The event's ID. This is a number; we represent it as a string for
+ * convenience.
+ */
protected final String id;
+
+ /**
+ * The event's start time.
+ */
protected final double start;
+
+ /**
+ * The event's end time.
+ */
protected double end;
+
+ /**
+ * The compilation during which this event was signalled.
+ */
protected Compilation compilation;
BasicLogEvent(double start, String id) {
this.start = start;
this.end = start;
this.id = id;
}
- public double getStart() {
+ public final double getStart() {
return start;
}
- public double getEnd() {
+ public final double getEnd() {
return end;
}
- public void setEnd(double end) {
+ public final void setEnd(double end) {
this.end = end;
}
- public double getElapsedTime() {
+ public final double getElapsedTime() {
return ((int) ((getEnd() - getStart()) * 1000)) / 1000.0;
}
- public String getId() {
+ public final String getId() {
return id;
}
- public Compilation getCompilation() {
+ public final Compilation getCompilation() {
return compilation;
}
+ /**
+ * Set the compilation for this event. This is not a {@code final} method
+ * as it is overridden in {@link UncommonTrapEvent}.
+ */
public void setCompilation(Compilation compilation) {
this.compilation = compilation;
}
- abstract public void print(PrintStream stream);
+ abstract public void print(PrintStream stream, boolean printID);
}
< prev index next >