void () { PlatformTestUtil.startPerformanceTest("two streams", 30000, () -> { mySynchronizer = new MockProcessStreamsSynchronizer(getTestRootDisposable()); long nowTimeMillis = 10; for (int i = 0; i < 10_000_000; i++) { mySynchronizer.doWhenStreamsSynchronized("Std", ProcessOutputType.STDOUT, nowTimeMillis); mySynchronizer.doWhenStreamsSynchronized("Std", ProcessOutputType.STDERR, nowTimeMillis + 4); mySynchronizer.doWhenStreamsSynchronized("Out\n", ProcessOutputType.STDOUT, nowTimeMillis + 5); mySynchronizer.doWhenStreamsSynchronized("Err\n", ProcessOutputType.STDERR, nowTimeMillis + 7); mySynchronizer.doWhenStreamsSynchronized("stdout again", ProcessOutputType.STDOUT, nowTimeMillis + 6 + AWAIT_SAME_STREAM_TEXT_MILLIS); mySynchronizer.advanceTimeTo(nowTimeMillis + 8 + 2 * AWAIT_SAME_STREAM_TEXT_MILLIS); assertFlushedChunks( new FlushedChunk("Std", ProcessOutputType.STDOUT, nowTimeMillis), new FlushedChunk("Out\n", ProcessOutputType.STDOUT, nowTimeMillis + 5), new FlushedChunk("Std", ProcessOutputType.STDERR, nowTimeMillis + AWAIT_SAME_STREAM_TEXT_MILLIS), new FlushedChunk("Err\n", ProcessOutputType.STDERR, nowTimeMillis + AWAIT_SAME_STREAM_TEXT_MILLIS), new FlushedChunk("stdout again", ProcessOutputType.STDOUT, nowTimeMillis + 7 + AWAIT_SAME_STREAM_TEXT_MILLIS) ); assertNoPendingChunks(); nowTimeMillis += 8 + 2 * AWAIT_SAME_STREAM_TEXT_MILLIS; } }).assertTiming(); }