compressHeapDumps() — netty Function Reference
Architecture documentation for the compressHeapDumps() function in TestUtils.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD f25a8461_3618_94fd_3176_45bda8f59b4f["compressHeapDumps()"] 1dee7150_7837_4c34_2e0a_b594ae531484["TestUtils"] f25a8461_3618_94fd_3176_45bda8f59b4f -->|defined in| 1dee7150_7837_4c34_2e0a_b594ae531484 style f25a8461_3618_94fd_3176_45bda8f59b4f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/util/TestUtils.java lines 143–198
public static void compressHeapDumps() throws IOException {
final File[] files = new File(System.getProperty("user.dir")).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".hprof");
}
});
if (files == null) {
logger.warn("failed to find heap dump due to I/O error!");
return;
}
final byte[] buf = new byte[65536];
final LZMA2Options options = new LZMA2Options(LZMA2Options.PRESET_DEFAULT);
for (File file: files) {
final String filename = file.toString();
final String xzFilename = filename + ".xz";
final long fileLength = file.length();
logger.info("Compressing the heap dump: {}", xzFilename);
long lastLogTime = System.nanoTime();
long counter = 0;
try (InputStream in = Files.newInputStream(Paths.get(filename));
OutputStream out = new XZOutputStream(Files.newOutputStream(Paths.get(xzFilename)), options)) {
for (;;) {
int readBytes = in.read(buf);
if (readBytes < 0) {
break;
}
if (readBytes == 0) {
continue;
}
out.write(buf, 0, readBytes);
counter += readBytes;
long currentTime = System.nanoTime();
if (currentTime - lastLogTime > DUMP_PROGRESS_LOGGING_INTERVAL) {
logger.info("Compressing the heap dump: {} ({}%)",
xzFilename, counter * 100 / fileLength);
lastLogTime = currentTime;
}
}
} catch (Throwable t) {
logger.warn("Failed to compress the heap dump: {}", xzFilename, t);
}
// Delete the uncompressed dump in favor of the compressed one.
if (!file.delete()) {
logger.warn("Failed to delete the uncompressed heap dump: {}", filename);
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does compressHeapDumps() do?
compressHeapDumps() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/util/TestUtils.java.
Where is compressHeapDumps() defined?
compressHeapDumps() is defined in testsuite/src/main/java/io/netty/testsuite/util/TestUtils.java at line 143.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free