Skip to content

Commit

Permalink
* Add debugging information.
Browse files Browse the repository at this point in the history
  • Loading branch information
NickWard committed Apr 26, 2018
1 parent 7d4b046 commit c5182bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Expand Up @@ -31,7 +31,7 @@ public class DirectoryUtils {
public static File tempDir(String name) {
final File tmpDir = new File(OS.TARGET, name + "-" + Long.toString(TIMESTAMPER.getAndIncrement(), 36));

DeleteStatic.INSTANCE.add(tmpDir);
// DeleteStatic.INSTANCE.add(tmpDir);

// Log the temporary directory in OSX as it is quite obscure
if (OS.isMacOSX()) {
Expand Down
Expand Up @@ -96,23 +96,23 @@ public static Collection<Object[]> data() {
});
}

private static int getMappedQueueFileCount() throws IOException, InterruptedException {
private static List<String> getMappedQueueFileCount() throws IOException, InterruptedException {

final int processId = OS.getProcessId();
final List<String> fileList = new ArrayList<>();

final Process pmap = new ProcessBuilder("pmap", Integer.toString(processId)).start();
pmap.waitFor();
int queueFileCount = 0;
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(pmap.getInputStream()))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains(SUFFIX)) {
queueFileCount++;
fileList.add(line);
}
}
}

return queueFileCount;
return fileList;
}

private static long countEntries(final ChronicleQueue queue) {
Expand Down Expand Up @@ -4490,10 +4490,13 @@ private boolean doMappedSegmentUnmappedRollTest(AtomicLong clock, StringBuilder

boolean passed = true;
if (OS.isLinux()) {
int filesOpen = getMappedQueueFileCount();
List<String> openFiles = getMappedQueueFileCount();
int filesOpen = openFiles.size();
if (filesOpen >= 50) {
passed = false;
builder.append(String.format("Test for time %s failed: Too many mapped files: %d%n", time, filesOpen));
builder.append("Open files:").append("\n");
openFiles.stream().map(s -> s + "\n").forEach(builder::append);
}
}

Expand Down

0 comments on commit c5182bc

Please sign in to comment.