Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit ca5146b

Browse files
committed
log loading time
1 parent bf62e58 commit ca5146b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

algo/src/main/java/org/neo4j/graphalgo/LabelPropagationProc.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public Stream<LabelPropagationStats> labelPropagation(
100100
} else {
101101
graphLoader.withDirection(direction);
102102
}
103-
HeavyGraph graph = load(graphLoader, configuration);
103+
104+
HeavyGraph graph = load(graphLoader, configuration, stats);
104105

105106
if(graph.nodeCount() == 0) {
106107
graph.release();
@@ -143,15 +144,16 @@ public Stream<LabelPropagation.StreamResult> labelPropagationStream(
143144
} else {
144145
graphLoader.withDirection(direction);
145146
}
146-
HeavyGraph graph = load(graphLoader, configuration);
147+
LabelPropagationStats.Builder stats = new LabelPropagationStats.Builder();
148+
HeavyGraph graph = load(graphLoader, configuration, stats);
147149

148150

149151
if(graph.nodeCount() == 0) {
150152
graph.release();
151153
return Stream.empty();
152154
}
153155

154-
int[] result = compute(direction, iterations, batchSize, concurrency, graph, new LabelPropagationStats.Builder(), propertyMappings);
156+
int[] result = compute(direction, iterations, batchSize, concurrency, graph, stats, propertyMappings);
155157

156158
graph.release();
157159

@@ -166,11 +168,12 @@ private PropertyMapping[] createPropertyMappings(String partitionProperty, Strin
166168
};
167169
}
168170

169-
private HeavyGraph load(GraphLoader graphLoader, ProcedureConfiguration config) {
171+
private HeavyGraph load(GraphLoader graphLoader, ProcedureConfiguration config, LabelPropagationStats.Builder stats) {
170172
Class<? extends GraphFactory> graphImpl = config.getGraphImpl(
171173
HeavyGraph.TYPE, HeavyGraph.TYPE, HeavyCypherGraphFactory.TYPE);
172-
return (HeavyGraph) graphLoader.load(graphImpl);
173-
174+
try (ProgressTimer timer = stats.timeLoad()) {
175+
return (HeavyGraph) graphLoader.load(graphImpl);
176+
}
174177
}
175178

176179
private GraphLoader graphLoader(ProcedureConfiguration config, String partitionProperty, String weightKey, PropertyMapping... propertyMappings) {

0 commit comments

Comments
 (0)