Search in sources :

Example 21 with BeforeExperiment

use of com.google.caliper.BeforeExperiment in project guava by google.

the class LessThanBenchmark method setUp.

@BeforeExperiment
void setUp() {
    Random random = new Random(randomSeed);
    xInts = new int[SAMPLE_SIZE];
    yInts = new int[SAMPLE_SIZE];
    xLongs = new long[SAMPLE_SIZE];
    yLongs = new long[SAMPLE_SIZE];
    constant = new int[SAMPLE_SIZE];
    for (int i = 0; i < SAMPLE_SIZE; i++) {
        xInts[i] = random.nextInt(Integer.MAX_VALUE);
        yInts[i] = random.nextInt(Integer.MAX_VALUE);
        xLongs[i] = random.nextLong() & NONNEGATIVE_LONG_MASK;
        yLongs[i] = random.nextLong() & NONNEGATIVE_LONG_MASK;
        constant[i] = random.nextInt();
    }
}
Also used : Random(java.util.Random) BeforeExperiment(com.google.caliper.BeforeExperiment)

Example 22 with BeforeExperiment

use of com.google.caliper.BeforeExperiment in project guava by google.

the class CycleDetectingLockFactoryBenchmark method setUp.

@BeforeExperiment
void setUp() throws Exception {
    this.factory = CycleDetectingLockFactory.newInstance(CycleDetectingLockFactory.Policies.WARN);
    this.plainLocks = new Lock[lockNestingDepth];
    for (int i = 0; i < lockNestingDepth; i++) {
        plainLocks[i] = new ReentrantLock();
    }
    this.detectingLocks = new Lock[lockNestingDepth];
    for (int i = 0; i < lockNestingDepth; i++) {
        detectingLocks[i] = factory.newReentrantLock("Lock" + i);
    }
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) BeforeExperiment(com.google.caliper.BeforeExperiment)

Example 23 with BeforeExperiment

use of com.google.caliper.BeforeExperiment in project platform_frameworks_base by android.

the class IndentingPrintWriterBenchmark method setUp.

@BeforeExperiment
protected void setUp() throws IOException {
    final FileOutputStream os = new FileOutputStream(new File("/dev/null"));
    mDirect = new PrintWriter(os);
    mIndenting = new IndentingPrintWriter(mDirect, "  ");
    final Node manyChildren = Node.build("ManyChildren", Node.build("1"), Node.build("2"), Node.build("3"), Node.build("4"), Node.build("5"), Node.build("6"), Node.build("7"), Node.build("8"), Node.build("9"), Node.build("10"));
    mSimple = Node.build("RED");
    mComplex = Node.build("PARENT", Node.build("RED"), Node.build("GREEN", Node.build("BLUE", manyChildren, manyChildren), manyChildren, manyChildren), manyChildren);
}
Also used : FileOutputStream(java.io.FileOutputStream) File(java.io.File) PrintWriter(java.io.PrintWriter) BeforeExperiment(com.google.caliper.BeforeExperiment)

Example 24 with BeforeExperiment

use of com.google.caliper.BeforeExperiment in project platform_frameworks_base by android.

the class LinkifyBenchmark method setUp.

@BeforeExperiment
protected void setUp() throws Exception {
    int copyAmount = Integer.parseInt(mParamCopyAmount);
    StringBuilder strBuilder = new StringBuilder();
    for (int i = 0; i < copyAmount; i++) {
        strBuilder.append(mParamBasicText);
    }
    mTestSpannable = new SpannableString(strBuilder.toString());
}
Also used : SpannableString(android.text.SpannableString) BeforeExperiment(com.google.caliper.BeforeExperiment)

Example 25 with BeforeExperiment

use of com.google.caliper.BeforeExperiment in project android_frameworks_base by AOSPA.

the class IndentingPrintWriterBenchmark method setUp.

@BeforeExperiment
protected void setUp() throws IOException {
    final FileOutputStream os = new FileOutputStream(new File("/dev/null"));
    mDirect = new PrintWriter(os);
    mIndenting = new IndentingPrintWriter(mDirect, "  ");
    final Node manyChildren = Node.build("ManyChildren", Node.build("1"), Node.build("2"), Node.build("3"), Node.build("4"), Node.build("5"), Node.build("6"), Node.build("7"), Node.build("8"), Node.build("9"), Node.build("10"));
    mSimple = Node.build("RED");
    mComplex = Node.build("PARENT", Node.build("RED"), Node.build("GREEN", Node.build("BLUE", manyChildren, manyChildren), manyChildren, manyChildren), manyChildren);
}
Also used : FileOutputStream(java.io.FileOutputStream) File(java.io.File) PrintWriter(java.io.PrintWriter) BeforeExperiment(com.google.caliper.BeforeExperiment)

Aggregations

BeforeExperiment (com.google.caliper.BeforeExperiment)28 Random (java.util.Random)13 SpannableString (android.text.SpannableString)5 File (java.io.File)5 FileOutputStream (java.io.FileOutputStream)5 PrintWriter (java.io.PrintWriter)5 Footprint (com.google.caliper.api.Footprint)3 BitSet (java.util.BitSet)2 BuckConfig (com.facebook.buck.cli.BuckConfig)1 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)1 BroadcastEventListener (com.facebook.buck.event.listener.BroadcastEventListener)1 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 ConstructorArgMarshaller (com.facebook.buck.rules.ConstructorArgMarshaller)1 TestCellBuilder (com.facebook.buck.rules.TestCellBuilder)1 DefaultTypeCoercerFactory (com.facebook.buck.rules.coercer.DefaultTypeCoercerFactory)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 GetCheckedTypeValidator (com.google.common.util.concurrent.FuturesGetChecked.GetCheckedTypeValidator)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1