Skip to content

Commit 73e564b

Browse files
committed
chore: Try computing foot print size early
1 parent 86fb978 commit 73e564b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 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()
@@ -138,14 +138,18 @@ class FootprintForkedTest extends DDSpecification {
138138
}
139139

140140

141-
static GraphLayout footprint(Object root, Object... excludedRootFieldInstance) {
141+
static long footprint(Object root, Object... excludedRootFieldInstance) {
142142
GraphLayout layout = GraphLayout.parseInstance(root)
143+
def size = layout.totalSize()
144+
143145

144146
excludedRootFieldInstance.each {
145-
layout = layout.subtract(GraphLayout.parseInstance(it))
147+
def excludedLayout = GraphLayout.parseInstance(it)
148+
layout = layout.subtract(excludedLayout)
149+
size -= excludedLayout.totalSize()
146150
}
147151

148-
println layout.toFootprint()
149-
return layout
152+
System.err.println(layout.toFootprint())
153+
return size
150154
}
151155
}

0 commit comments

Comments
 (0)