aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/BUILD27
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/BUILD1
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/BUILD46
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/Profiler.java72
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java (renamed from src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java)31
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java35
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/CommonChartCreator.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathHtml.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathText.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/output/HtmlCreator.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/CriticalPathStatistics.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/MultiProfileStatistics.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseStatistics.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseSummaryStatistics.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseVfsStatistics.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/SkylarkStatistics.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/statistics/TasksStatistics.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/BUILD1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/BUILD1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/BUILD1
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java6
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/BUILD1
23 files changed, 157 insertions, 115 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/BUILD b/src/main/java/com/google/devtools/build/lib/BUILD
index 8559c70e59..5db8132fa6 100644
--- a/src/main/java/com/google/devtools/build/lib/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/BUILD
@@ -21,6 +21,7 @@ filegroup(
"//src/main/java/com/google/devtools/build/lib/exec/apple:srcs",
"//src/main/java/com/google/devtools/build/lib/exec/local:srcs",
"//src/main/java/com/google/devtools/build/lib/graph:srcs",
+ "//src/main/java/com/google/devtools/build/lib/profiler:srcs",
"//src/main/java/com/google/devtools/build/lib/query2:srcs",
"//src/main/java/com/google/devtools/build/lib/remote:srcs",
"//src/main/java/com/google/devtools/build/lib/rules/apple/cpp:srcs",
@@ -68,6 +69,7 @@ java_library(
":os_util",
":preconditions",
":vfs",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/shell",
"//third_party:guava",
],
@@ -124,7 +126,6 @@ java_library(
java_library(
name = "vfs",
srcs = glob([
- "profiler/*.java",
"vfs/*.java",
]),
visibility = ["//visibility:public"],
@@ -134,6 +135,7 @@ java_library(
":concurrent",
":os_util",
":preconditions",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/common/options",
"//third_party:guava",
@@ -141,23 +143,6 @@ java_library(
],
)
-# Profiler chart library.
-java_library(
- name = "profiler-output",
- srcs = glob([
- "profiler/chart/*.java",
- "profiler/output/*.java",
- "profiler/statistics/*.java",
- ]),
- deps = [
- ":util",
- ":vfs",
- "//src/main/java/com/google/devtools/build/lib/actions",
- "//third_party:guava",
- "//third_party:jsr305",
- ],
-)
-
# In-memory virtual file system.
java_library(
name = "inmemoryfs",
@@ -220,6 +205,7 @@ java_library(
":clock",
":concurrent",
":vfs",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//third_party:guava",
],
)
@@ -451,6 +437,7 @@ java_library(
":util",
":vfs",
"//src/main/java/com/google/devtools/build/lib/cmdline",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/common/options",
"//third_party:asm",
"//third_party:asm-commons",
@@ -621,6 +608,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/causes",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/graph",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization",
"//src/main/java/com/google/devtools/build/skyframe",
@@ -1153,7 +1141,6 @@ java_library(
":io",
":packages-internal",
":process_util",
- ":profiler-output",
":shared-base-rules",
":unix",
":util",
@@ -1165,6 +1152,8 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/exec/local",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
+ "//src/main/java/com/google/devtools/build/lib/profiler:profiler-output",
"//src/main/java/com/google/devtools/build/lib/query2",
"//src/main/java/com/google/devtools/build/lib/query2:query-engine",
"//src/main/java/com/google/devtools/build/lib/query2:query-output",
diff --git a/src/main/java/com/google/devtools/build/lib/actions/BUILD b/src/main/java/com/google/devtools/build/lib/actions/BUILD
index 29568da4e5..416b15f1e5 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/actions/BUILD
@@ -22,6 +22,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto",
"//src/main/java/com/google/devtools/build/lib/causes",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/BUILD b/src/main/java/com/google/devtools/build/lib/profiler/BUILD
new file mode 100644
index 0000000000..22d58a0560
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/profiler/BUILD
@@ -0,0 +1,46 @@
+package(
+ default_visibility = ["//src:__subpackages__"],
+)
+
+java_library(
+ name = "profiler",
+ srcs = glob([
+ "*.java",
+ ]),
+ visibility = ["//visibility:public"],
+ deps = [
+ "//src/main/java/com/google/devtools/build/lib:base-util",
+ "//src/main/java/com/google/devtools/build/lib:clock",
+ "//src/main/java/com/google/devtools/build/lib:concurrent",
+ "//src/main/java/com/google/devtools/build/lib:os_util",
+ "//src/main/java/com/google/devtools/build/lib:preconditions",
+ "//src/main/java/com/google/devtools/build/lib/shell",
+ "//src/main/java/com/google/devtools/common/options",
+ "//third_party:guava",
+ "//third_party:jsr305",
+ ],
+)
+
+# Profiler chart library.
+java_library(
+ name = "profiler-output",
+ srcs = glob([
+ "analysis/*.java",
+ "chart/*.java",
+ "output/*.java",
+ "statistics/*.java",
+ ]),
+ deps = [
+ ":profiler",
+ "//src/main/java/com/google/devtools/build/lib:util",
+ "//src/main/java/com/google/devtools/build/lib:vfs",
+ "//src/main/java/com/google/devtools/build/lib/actions",
+ "//third_party:guava",
+ "//third_party:jsr305",
+ ],
+)
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["**"]),
+)
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java
index d4a7ca14b6..2ad353f6da 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java
@@ -18,6 +18,8 @@ import static com.google.devtools.build.lib.profiler.ProfilerTask.TASK_COUNT;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
+import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible;
+import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.profiler.PredicateBasedStatRecorder.RecorderAndPredicate;
import com.google.devtools.build.lib.profiler.StatRecorder.VfsHeuristics;
import com.google.devtools.build.lib.util.Clock;
@@ -45,28 +47,27 @@ import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
/**
- * Blaze internal profiler. Provides facility to report various Blaze tasks and
- * store them (asynchronously) in the file for future analysis.
- * <p>
- * Implemented as singleton so any caller should use Profiler.instance() to
- * obtain reference.
- * <p>
- * Internally, profiler uses two data structures - ThreadLocal task stack to track
- * nested tasks and single ConcurrentLinkedQueue to gather all completed tasks.
- * <p>
- * Also, due to the nature of the provided functionality (instrumentation of all
- * Blaze components), build.lib.profiler package will be used by almost every
- * other Blaze package, so special attention should be paid to avoid any
- * dependencies on the rest of the Blaze code, including build.lib.util and
- * build.lib.vfs. This is important because build.lib.util and build.lib.vfs
- * contain Profiler invocations and any dependency on those two packages would
- * create circular relationship.
- * <p>
- * All gathered instrumentation data will be stored in the file. Please, note,
- * that while file format is described here it is considered internal and can
- * change at any time. For scripting, using blaze analyze-profile --dump=raw
- * would be more robust and stable solution.
+ * Blaze internal profiler. Provides facility to report various Blaze tasks and store them
+ * (asynchronously) in the file for future analysis.
+ *
+ * <p>Implemented as singleton so any caller should use Profiler.instance() to obtain reference.
+ *
+ * <p>Internally, profiler uses two data structures - ThreadLocal task stack to track nested tasks
+ * and single ConcurrentLinkedQueue to gather all completed tasks.
+ *
+ * <p>Also, due to the nature of the provided functionality (instrumentation of all Blaze
+ * components), build.lib.profiler package will be used by almost every other Blaze package, so
+ * special attention should be paid to avoid any dependencies on the rest of the Blaze code,
+ * including build.lib.util and build.lib.vfs. This is important because build.lib.util and
+ * build.lib.vfs contain Profiler invocations and any dependency on those two packages would create
+ * circular relationship.
+ *
+ * <p>All gathered instrumentation data will be stored in the file. Please, note, that while file
+ * format is described here it is considered internal and can change at any time. For scripting,
+ * using blaze analyze-profile --dump=raw would be more robust and stable solution.
+ *
* <p>
+ *
* <pre>
* Profiler file consists of the deflated stream with following overall structure:
* HEADER
@@ -115,19 +116,19 @@ import java.util.zip.DeflaterOutputStream;
*
* @see ProfilerTask enum for recognized task types.
*/
-//@ThreadSafe - commented out to avoid cyclic dependency with lib.util package
+@ThreadSafe
public final class Profiler {
private static final Logger LOG = Logger.getLogger(Profiler.class.getName());
- static final int MAGIC = 0x11223344;
+ public static final int MAGIC = 0x11223344;
// File version number. Note that merely adding new record types in
// the ProfilerTask does not require bumping version number as long as original
// enum values are not renamed or deleted.
- static final int VERSION = 0x03;
+ public static final int VERSION = 0x03;
// EOF marker. Must be < 0.
- static final int EOF_MARKER = -1;
+ public static final int EOF_MARKER = -1;
// Profiler will check for gathered data and persist all of it in the
// separate thread every SAVE_DELAY ms.
@@ -140,11 +141,8 @@ public final class Profiler {
private static final int HISTOGRAM_BUCKETS = 20;
- /**
- *
- * A task that was very slow.
- */
- public final class SlowTask implements Comparable<SlowTask> {
+ /** A task that was very slow. */
+ public static final class SlowTask implements Comparable<SlowTask> {
final long durationNanos;
final Object object;
ProfilerTask type;
@@ -187,7 +185,7 @@ public final class Profiler {
* Class itself is not thread safe, but all access to it from Profiler
* methods is.
*/
- //@ThreadCompatible - commented out to avoid cyclic dependency with lib.util.
+ @ThreadCompatible
private final class TaskData {
final long threadId;
final long startTime;
@@ -240,7 +238,7 @@ public final class Profiler {
* However, ArrayDeque is 1.6 only. For 1.5 best approach would be to utilize
* ArrayList and emulate stack using it.
*/
- //@ThreadSafe - commented out to avoid cyclic dependency with lib.util.
+ @ThreadSafe
private final class TaskStack extends ThreadLocal<List<TaskData>> {
@Override
@@ -293,11 +291,11 @@ public final class Profiler {
}
/**
- * Implements datastore for object description indices. Intended to be used
- * only by the Profiler.save() method.
+ * Implements datastore for object description indices. Intended to be used only by the
+ * Profiler.save() method.
*/
- //@ThreadCompatible - commented out to avoid cyclic dependency with lib.util.
- private final class ObjectDescriber {
+ @ThreadCompatible
+ private static final class ObjectDescriber {
private Map<Object, Integer> descMap = new IdentityHashMap<>(2000);
private int indexCounter = 0;
@@ -337,7 +335,7 @@ public final class Profiler {
* lock if they do the same operation at the same time. Access to the individual queues is
* synchronized on the queue objects themselves.
*/
- private final class SlowestTaskAggregator {
+ private static final class SlowestTaskAggregator {
private static final int SHARDS = 16;
private final int size;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java b/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java
index 242bdb2c7f..f1273231c3 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java
@@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-package com.google.devtools.build.lib.profiler;
+package com.google.devtools.build.lib.profiler.analysis;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.devtools.build.lib.profiler.ProfilerTask.CRITICAL_PATH;
@@ -26,6 +26,9 @@ import com.google.common.collect.Maps;
import com.google.common.collect.MultimapBuilder.ListMultimapBuilder;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
+import com.google.devtools.build.lib.profiler.ProfilePhase;
+import com.google.devtools.build.lib.profiler.Profiler;
+import com.google.devtools.build.lib.profiler.ProfilerTask;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.util.VarInt;
import com.google.devtools.build.lib.vfs.Path;
@@ -74,10 +77,8 @@ public class ProfileInfo {
}
}
- /**
- * Immutable compact representation of the Map<ProfilerTask, AggregateAttr>.
- */
- static final class CompactStatistics {
+ /** Immutable compact representation of the Map<ProfilerTask, AggregateAttr>. */
+ public static final class CompactStatistics {
final byte[] content;
CompactStatistics(byte[] content) {
@@ -103,13 +104,15 @@ public class ProfileInfo {
content = sink.position() > 0 ? Arrays.copyOf(sink.array(), sink.position()) : null;
}
- boolean isEmpty() { return content == null; }
+ public boolean isEmpty() {
+ return content == null;
+ }
/**
- * Converts instance back into AggregateAttr[TASK_COUNT]. See
- * constructor documentation for more information.
+ * Converts instance back into AggregateAttr[TASK_COUNT]. See constructor documentation for more
+ * information.
*/
- AggregateAttr[] toArray() {
+ public AggregateAttr[] toArray() {
AggregateAttr[] stats = new AggregateAttr[TASK_COUNT];
if (!isEmpty()) {
ByteBuffer source = ByteBuffer.wrap(content);
@@ -123,10 +126,8 @@ public class ProfileInfo {
return stats;
}
- /**
- * Returns AggregateAttr instance for the given ProfilerTask value.
- */
- AggregateAttr getAttr(ProfilerTask task) {
+ /** Returns AggregateAttr instance for the given ProfilerTask value. */
+ public AggregateAttr getAttr(ProfilerTask task) {
if (isEmpty()) { return ZERO; }
ByteBuffer source = ByteBuffer.wrap(content);
byte id = (byte) task.ordinal();
@@ -181,9 +182,9 @@ public class ProfileInfo {
public final long startTime;
public final long durationNanos;
public final ProfilerTask type;
- final CompactStatistics stats;
+ public final CompactStatistics stats;
// Contains statistic for a task and all subtasks. Populated only for root tasks.
- CompactStatistics aggregatedStats = null;
+ public CompactStatistics aggregatedStats = null;
// Subtasks are stored as an array for performance and memory utilization
// reasons (we can easily deal with millions of those objects).
public Task[] subtasks = NO_TASKS;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
index 98c58cd507..b6d66eb1b6 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
@@ -14,10 +14,9 @@
package com.google.devtools.build.lib.profiler.chart;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.ProfilerTask;
-
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import java.util.EnumSet;
import java.util.Set;
@@ -43,20 +42,32 @@ public class AggregatingChartCreator implements ChartCreator {
ProfilerTask.ACTION_SUBMIT);
/** The tasks in the 'blaze internal' category. */
- private static Set<ProfilerTask> BLAZE_TASKS =
- EnumSet.of(ProfilerTask.CREATE_PACKAGE, ProfilerTask.PACKAGE_VALIDITY_CHECK,
- ProfilerTask.CONFIGURED_TARGET, ProfilerTask.TRANSITIVE_CLOSURE,
- ProfilerTask.EXCEPTION, ProfilerTask.INFO, ProfilerTask.UNKNOWN);
+ private static final Set<ProfilerTask> BLAZE_TASKS =
+ EnumSet.of(
+ ProfilerTask.CREATE_PACKAGE,
+ ProfilerTask.PACKAGE_VALIDITY_CHECK,
+ ProfilerTask.CONFIGURED_TARGET,
+ ProfilerTask.TRANSITIVE_CLOSURE,
+ ProfilerTask.EXCEPTION,
+ ProfilerTask.INFO,
+ ProfilerTask.UNKNOWN);
/** The tasks in the 'locks' category. */
- private static Set<ProfilerTask> LOCK_TASKS =
+ private static final Set<ProfilerTask> LOCK_TASKS =
EnumSet.of(ProfilerTask.ACTION_LOCK, ProfilerTask.WAIT);
/** The tasks in the 'VFS' category. */
- private static Set<ProfilerTask> VFS_TASKS =
- EnumSet.of(ProfilerTask.VFS_STAT, ProfilerTask.VFS_DIR, ProfilerTask.VFS_READLINK,
- ProfilerTask.VFS_MD5, ProfilerTask.VFS_DELETE, ProfilerTask.VFS_OPEN,
- ProfilerTask.VFS_READ, ProfilerTask.VFS_WRITE, ProfilerTask.VFS_GLOB,
+ private static final Set<ProfilerTask> VFS_TASKS =
+ EnumSet.of(
+ ProfilerTask.VFS_STAT,
+ ProfilerTask.VFS_DIR,
+ ProfilerTask.VFS_READLINK,
+ ProfilerTask.VFS_MD5,
+ ProfilerTask.VFS_DELETE,
+ ProfilerTask.VFS_OPEN,
+ ProfilerTask.VFS_READ,
+ ProfilerTask.VFS_WRITE,
+ ProfilerTask.VFS_GLOB,
ProfilerTask.VFS_XATTR);
/** The data of the profiled build. */
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/CommonChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/CommonChartCreator.java
index 9f09adcc3e..bb681604d3 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/CommonChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/CommonChartCreator.java
@@ -14,8 +14,8 @@
package com.google.devtools.build.lib.profiler.chart;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
import com.google.devtools.build.lib.profiler.ProfilePhase;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
/**
* Provides some common functions for {@link ChartCreator}s.
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
index 2477d3a9a6..27ea8571f5 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
@@ -14,11 +14,10 @@
package com.google.devtools.build.lib.profiler.chart;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.ProfilerTask;
-
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.CriticalPathEntry;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import java.util.EnumSet;
/**
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathHtml.java b/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathHtml.java
index 71299e43d2..101a27e27e 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathHtml.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathHtml.java
@@ -13,12 +13,11 @@
// limitations under the License.
package com.google.devtools.build.lib.profiler.output;
-import com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.CriticalPathEntry;
import com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics;
import com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.TimeUtilities;
-
import java.io.PrintStream;
/**
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathText.java b/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathText.java
index 61c885c4b3..bf1053551d 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathText.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/output/CriticalPathText.java
@@ -13,12 +13,11 @@
// limitations under the License.
package com.google.devtools.build.lib.profiler.output;
-import com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.CriticalPathEntry;
import com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics;
import com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.TimeUtilities;
-
import java.io.PrintStream;
/**
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/output/HtmlCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/output/HtmlCreator.java
index ab35718613..854f4ebd43 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/output/HtmlCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/output/HtmlCreator.java
@@ -14,8 +14,8 @@
package com.google.devtools.build.lib.profiler.output;
import com.google.common.base.Optional;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
import com.google.devtools.build.lib.profiler.ProfilePhase;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
import com.google.devtools.build.lib.profiler.chart.AggregatingChartCreator;
import com.google.devtools.build.lib.profiler.chart.Chart;
import com.google.devtools.build.lib.profiler.chart.ChartCreator;
@@ -27,7 +27,6 @@ import com.google.devtools.build.lib.profiler.statistics.PhaseStatistics;
import com.google.devtools.build.lib.profiler.statistics.PhaseSummaryStatistics;
import com.google.devtools.build.lib.profiler.statistics.SkylarkStatistics;
import com.google.devtools.build.lib.vfs.Path;
-
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.PrintStream;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/CriticalPathStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/CriticalPathStatistics.java
index 8631016543..4c6f87cb6e 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/CriticalPathStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/CriticalPathStatistics.java
@@ -15,19 +15,17 @@ package com.google.devtools.build.lib.profiler.statistics;
import com.google.common.base.Predicate;
import com.google.devtools.build.lib.actions.MiddlemanAction;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.ProfilerTask;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.CriticalPathEntry;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import com.google.devtools.build.lib.util.Pair;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
-
import javax.annotation.Nullable;
/**
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/MultiProfileStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/MultiProfileStatistics.java
index a4e8959f44..7270fae86b 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/MultiProfileStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/MultiProfileStatistics.java
@@ -13,11 +13,10 @@
// limitations under the License.
package com.google.devtools.build.lib.profiler.statistics;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.InfoListener;
import com.google.devtools.build.lib.profiler.ProfilePhase;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.InfoListener;
import com.google.devtools.build.lib.vfs.Path;
-
import java.io.IOException;
import java.util.EnumMap;
import java.util.HashMap;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseStatistics.java
index 290eb72fa0..0e998ec178 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseStatistics.java
@@ -14,11 +14,11 @@
package com.google.devtools.build.lib.profiler.statistics;
import com.google.common.collect.Iterators;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.AggregateAttr;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.ProfilePhase;
import com.google.devtools.build.lib.profiler.ProfilerTask;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.AggregateAttr;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import com.google.devtools.build.lib.util.Preconditions;
import java.util.EnumMap;
import java.util.Iterator;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseSummaryStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseSummaryStatistics.java
index 59032b13ef..ee741047a6 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseSummaryStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseSummaryStatistics.java
@@ -13,9 +13,8 @@
// limitations under the License.
package com.google.devtools.build.lib.profiler.statistics;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
import com.google.devtools.build.lib.profiler.ProfilePhase;
-
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.NoSuchElementException;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseVfsStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseVfsStatistics.java
index cdc794c033..7c1cdb51c5 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseVfsStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/PhaseVfsStatistics.java
@@ -18,10 +18,10 @@ import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Table;
import com.google.common.collect.Table.Cell;
import com.google.common.collect.Tables;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.ProfilePhase;
import com.google.devtools.build.lib.profiler.ProfilerTask;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/SkylarkStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/SkylarkStatistics.java
index 325446668c..4dff2723d4 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/SkylarkStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/SkylarkStatistics.java
@@ -15,8 +15,8 @@ package com.google.devtools.build.lib.profiler.statistics;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import com.google.devtools.build.lib.util.LongArrayList;
import java.util.Collection;
import java.util.HashMap;
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/statistics/TasksStatistics.java b/src/main/java/com/google/devtools/build/lib/profiler/statistics/TasksStatistics.java
index 2b60eb73e8..4ab9c33c44 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/statistics/TasksStatistics.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/statistics/TasksStatistics.java
@@ -13,7 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.profiler.statistics;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import com.google.devtools.build.lib.util.LongArrayList;
import java.util.List;
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BUILD b/src/main/java/com/google/devtools/build/lib/query2/BUILD
index d8fb69277a..79c008249b 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/query2/BUILD
@@ -15,6 +15,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/graph",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//third_party:guava",
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/BUILD b/src/main/java/com/google/devtools/build/lib/rules/cpp/BUILD
index 9a67dc4c33..da061084eb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/BUILD
@@ -24,6 +24,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/analysis/platform",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/rules/apple",
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/build/skyframe",
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD b/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD
index be5d9aea78..ad39aefbb9 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD
@@ -23,6 +23,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/analysis/platform",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/rules/apple",
"//src/main/java/com/google/devtools/build/lib/rules/cpp",
"//src/main/java/com/google/devtools/build/lib/shell",
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java
index 4956c3b97a..56b76bf5d5 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java
@@ -18,11 +18,11 @@ import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
-import com.google.devtools.build.lib.profiler.ProfileInfo;
-import com.google.devtools.build.lib.profiler.ProfileInfo.InfoListener;
-import com.google.devtools.build.lib.profiler.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.ProfilePhase;
import com.google.devtools.build.lib.profiler.ProfilerTask;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.InfoListener;
+import com.google.devtools.build.lib.profiler.analysis.ProfileInfo.Task;
import com.google.devtools.build.lib.profiler.output.HtmlCreator;
import com.google.devtools.build.lib.profiler.output.PhaseText;
import com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics;
diff --git a/src/main/java/com/google/devtools/build/skyframe/BUILD b/src/main/java/com/google/devtools/build/skyframe/BUILD
index 55c35f8102..6620997ca3 100644
--- a/src/main/java/com/google/devtools/build/skyframe/BUILD
+++ b/src/main/java/com/google/devtools/build/skyframe/BUILD
@@ -37,6 +37,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:events",
"//src/main/java/com/google/devtools/build/lib:util",
"//src/main/java/com/google/devtools/build/lib:vfs",
+ "//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/common/options",
"//third_party:guava",
"//third_party:jsr305",