Skip to content

Commit

Permalink
[feature] output used memory
Browse files Browse the repository at this point in the history
  • Loading branch information
ylht committed Dec 29, 2023
1 parent 7a1406c commit e034fe7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/ecnu/db/generator/DataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ public Integer call() throws Exception {
long solveCPTime = 0;
long computeStatusVectorTime = 0;
long populateKeyTime = 0;
long freeMemory = Long.MAX_VALUE;
Runtime runtime = Runtime.getRuntime();

long start = System.currentTimeMillis();
for (String schemaName : TableManager.getInstance().createTopologicalOrder()) {
Expand Down Expand Up @@ -309,6 +311,7 @@ public Integer call() throws Exception {
dataWriter.addWriteTask(schemaName, keyData, data);
batchStart += range + stepRange;
}
freeMemory = Math.min(freeMemory, runtime.freeMemory());
computeStatusVectorTime += Arrays.stream(fkGenerators).mapToLong(FkGenerator::getConstructHistogram).sum();
populateKeyTime += Arrays.stream(fkGenerators).mapToLong(FkGenerator::getPopulateFKTime).sum();
solveCPTime += Arrays.stream(fkGenerators).mapToLong(FkGenerator::getSolveCPTime).sum();
Expand All @@ -318,6 +321,7 @@ public Integer call() throws Exception {
logger.info("CP:{}", solveCPTime);
logger.info("PK:{}", populateKeyTime);
logger.info("total time: {}", System.currentTimeMillis() - start);
logger.info("used memory (MB): {}", (runtime.totalMemory() - freeMemory) / 1024 / 1024);
if (dataWriter.waitWriteFinish()) {
logger.info("Output table data completed");
}
Expand Down

0 comments on commit e034fe7

Please sign in to comment.