Skip to content

Commit ea85e01

Browse files
authored
Try computing footprint size early (#9324)
1 parent 86fb978 commit ea85e01

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

dd-trace-core/src/test/groovy/datadog/trace/common/metrics/FootprintForkedTest.groovy

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class FootprintForkedTest extends DDSpecification {
7373
assert latch.await(30, SECONDS)
7474

7575
then:
76-
def layout = footprint(aggregator, features)
77-
layout.totalSize() - baseline.totalSize() <= 10 * 1024 * 1024
76+
def after = footprint(aggregator, features)
77+
after - baseline <= 10 * 1024 * 1024
7878

7979
cleanup:
8080
aggregator.close()
@@ -137,15 +137,17 @@ class FootprintForkedTest extends DDSpecification {
137137
}
138138
}
139139

140-
141-
static GraphLayout footprint(Object root, Object... excludedRootFieldInstance) {
140+
static long footprint(Object root, Object... excludedRootFieldInstance) {
142141
GraphLayout layout = GraphLayout.parseInstance(root)
142+
def size = layout.totalSize()
143143

144144
excludedRootFieldInstance.each {
145-
layout = layout.subtract(GraphLayout.parseInstance(it))
145+
def excludedLayout = GraphLayout.parseInstance(it)
146+
layout = layout.subtract(excludedLayout)
147+
size -= excludedLayout.totalSize()
146148
}
147149

148-
println layout.toFootprint()
149-
return layout
150+
println(layout.toFootprint())
151+
return size
150152
}
151153
}

0 commit comments

Comments
 (0)