Search in sources :

Example 31 with InMemoryStreamConsumer

use of com.thoughtworks.go.util.command.InMemoryStreamConsumer in project gocd by gocd.

the class PipelineConfigServicePerformanceTest method takeHeapDump.

private void takeHeapDump(int i) {
    InMemoryStreamConsumer outputStreamConsumer = inMemoryConsumer();
    CommandLine commandLine = CommandLine.createCommandLine("jmap").withArgs("-J-d64", String.format("-dump:format=b,file=%s/%s.hprof", tempDir.toFile().getAbsoluteFile(), i), ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);
    LOGGER.info(commandLine.describe());
    int exitCode = commandLine.run(outputStreamConsumer, new NamedProcessTag("thread" + i));
    LOGGER.info(outputStreamConsumer.getAllOutput());
    assertThat(exitCode, is(0));
    LOGGER.info("Heap dump available at " + tempDir.toFile().getAbsolutePath());
}
Also used : CommandLine(com.thoughtworks.go.util.command.CommandLine) InMemoryStreamConsumer(com.thoughtworks.go.util.command.InMemoryStreamConsumer)

Aggregations

InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)31 Test (org.junit.Test)17 GitSubmoduleRepos (com.thoughtworks.go.helper.GitSubmoduleRepos)8 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)7 File (java.io.File)7 StringContains.containsString (org.hamcrest.core.StringContains.containsString)7 Test (org.junit.jupiter.api.Test)5 ModifiedFile (com.thoughtworks.go.domain.materials.ModifiedFile)4 CommandLine (com.thoughtworks.go.util.command.CommandLine)4 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)3 Modification (com.thoughtworks.go.domain.materials.Modification)3 RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)2 P4Client (com.thoughtworks.go.domain.materials.perforce.P4Client)2 IOException (java.io.IOException)2 SubprocessExecutionContext (com.thoughtworks.go.config.materials.SubprocessExecutionContext)1 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)1 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)1 PluggableSCMMaterialAgent (com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialAgent)1