Runner function for benchmarks.

@param args program arguments
@param benchmarkStateFactory producer function for {@link AbstractBenchmarkState}
345296
public static void runWith(
      String[] args, Function<BenchmarkSettings, AbstractBenchmarkState<?>> benchmarkStateFactory) {

    BenchmarkSettings settings = BenchmarkSettings.from(args).build();

    AbstractBenchmarkState<?> benchmarkState = benchmarkStateFactory.apply(settings);

    benchmarkState.runForAsync(
        state -> {
          LatencyHelper latencyHelper = new LatencyHelper(state);

          BenchmarkMeter clientToServiceMeter = state.meter("meter.client-to-service");
          BenchmarkMeter serviceToClientMeter = state.meter("meter.service-to-client");

          ThreadLocal<Mono<Client>> clientHolder =
              ThreadLocal.withInitial(() -> state.createClient().cache());

          return i -> {
            Mono<Client> clientMono = clientHolder.get();
            return clientMono.flatMap(
                client -> {
                  clientToServiceMeter.mark();
                  return client
                      .requestResponse(enrichRequest())
                      .map(RequestOneScenario::enrichResponse)
                      .doOnNext(
                          msg -> {
                            serviceToClientMeter.mark();
                            Optional.ofNullable(msg.data())
                                .ifPresent(ReferenceCountUtil::safestRelease);
                            latencyHelper.calculate(msg);
                          })
                      .doOnError(th -> LOGGER.warn("Exception occured on requestResponse: " + th));
                });
          };
        });
  }
1364
public static void main(String[] argv) throws Exception {
    StreamingResponseBandwidthBenchmark bench = new StreamingResponseBandwidthBenchmark();
    bench.setup();
    Thread.sleep(30000);
    bench.teardown();
    System.exit(0);
  }
91185
public static void run(StreamFunctionExecutor functionExecutor, String... args) {
        parseData(args, (data, isDebug) -> {
            try (InputStream input = data != null ? new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)) : System.in) {
                functionExecutor.execute(input, System.out);
            } catch (Exception e) {
                exitWithError(isDebug, e);
            }
        });
    }
881072
public void executeBench(final Object objToExecute, final Object... args) {

        final double[] meterResults = new double[METERS_TO_BENCH.size()];

        final Method meth = element.getMethodToBench();

        int meterIndex1 = 0;
        int meterIndex2 = 0;
        for (final AbstractMeter meter : METERS_TO_BENCH) {
            meterResults[meterIndex1] = meter.getValue();
            meterIndex1++;
        }

        final PerfidixMethodInvocationException res = invokeMethod(objToExecute, Bench.class, meth, args);

        for (final AbstractMeter meter : METERS_TO_BENCH) {
            meterResults[meterIndex2] = meter.getValue() - meterResults[meterIndex2];
            meterIndex2++;
        }

        if (res == null) {
            meterIndex1 = 0;
            for (final AbstractMeter meter : METERS_TO_BENCH) {
                BENCHRES.addData(element, meter, meterResults[meterIndex1]);
                meterIndex1++;
            }
        } else {
            BENCHRES.addException(res);
        }

    }
156973
public static void main(String[] args) {
    if (args.length != 0) {
      LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR,
          AlluxioJobWorker.class.getCanonicalName());
      System.exit(-1);
    }

    if (!ConfigurationUtils.masterHostConfigured(ServerConfiguration.global())) {
      System.out.println(ConfigurationUtils
          .getMasterHostNotConfiguredMessage("Alluxio job worker"));
      System.exit(1);
    }

    if (!ConfigurationUtils.jobMasterHostConfigured(ServerConfiguration.global())) {
      System.out.println(ConfigurationUtils
          .getJobMasterHostNotConfiguredMessage("Alluxio job worker"));
      System.exit(1);
    }

    CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.JOB_WORKER);
    MasterInquireClient masterInquireClient =
        MasterInquireClient.Factory.create(ServerConfiguration.global());
    try {
      RetryUtils.retry("load cluster default configuration with master", () -> {
        InetSocketAddress masterAddress = masterInquireClient.getPrimaryRpcAddress();
        ServerConfiguration.loadClusterDefaults(masterAddress);
      },
          RetryUtils.defaultWorkerMasterClientRetry(
              ServerConfiguration.getDuration(PropertyKey.WORKER_MASTER_CONNECT_RETRY_TIMEOUT)));
    } catch (IOException e) {
      ProcessUtils.fatalError(LOG,
          "Failed to load cluster default configuration for job worker: %s", e.getMessage());
    }
    JobWorkerProcess process = JobWorkerProcess.Factory.create();
    ProcessUtils.run(process);
  }
1306849
public int run(String[] args) throws Exception {

    JobConf jobConf = new JobConf(getConf(), Sort.class);
    jobConf.setJobName("sorter");

    jobConf.setMapperClass(IdentityMapper.class);        
    jobConf.setReducerClass(IdentityReducer.class);

    JobClient client = new JobClient(jobConf);
    ClusterStatus cluster = client.getClusterStatus();
    int num_reduces = (int) (cluster.getMaxReduceTasks() * 0.9);
    String sort_reduces = jobConf.get("test.sort.reduces_per_host");
    if (sort_reduces != null) {
       num_reduces = cluster.getTaskTrackers() * 
                       Integer.parseInt(sort_reduces);
    }
    Class<? extends InputFormat> inputFormatClass = 
      SequenceFileInputFormat.class;
    Class<? extends OutputFormat> outputFormatClass = 
      SequenceFileOutputFormat.class;
    Class<? extends WritableComparable> outputKeyClass = BytesWritable.class;
    Class<? extends Writable> outputValueClass = BytesWritable.class;
    List<String> otherArgs = new ArrayList<String>();
    InputSampler.Sampler<K,V> sampler = null;
    for(int i=0; i < args.length; ++i) {
      try {
        if ("-m".equals(args[i])) {
          jobConf.setNumMapTasks(Integer.parseInt(args[++i]));
        } else if ("-r".equals(args[i])) {
          num_reduces = Integer.parseInt(args[++i]);
        } else if ("-inFormat".equals(args[i])) {
          inputFormatClass = 
            Class.forName(args[++i]).asSubclass(InputFormat.class);
        } else if ("-outFormat".equals(args[i])) {
          outputFormatClass = 
            Class.forName(args[++i]).asSubclass(OutputFormat.class);
        } else if ("-outKey".equals(args[i])) {
          outputKeyClass = 
            Class.forName(args[++i]).asSubclass(WritableComparable.class);
        } else if ("-outValue".equals(args[i])) {
          outputValueClass = 
            Class.forName(args[++i]).asSubclass(Writable.class);
        } else if ("-totalOrder".equals(args[i])) {
          double pcnt = Double.parseDouble(args[++i]);
          int numSamples = Integer.parseInt(args[++i]);
          int maxSplits = Integer.parseInt(args[++i]);
          if (0 >= maxSplits) maxSplits = Integer.MAX_VALUE;
          sampler =
            new InputSampler.RandomSampler<K,V>(pcnt, numSamples, maxSplits);
        } else {
          otherArgs.add(args[i]);
        }
      } catch (NumberFormatException except) {
        System.out.println("ERROR: Integer expected instead of " + args[i]);
        return printUsage();
      } catch (ArrayIndexOutOfBoundsException except) {
        System.out.println("ERROR: Required parameter missing from " +
            args[i-1]);
        return printUsage(); // exits
      }
    }

    // Set user-supplied (possibly default) job configs
    jobConf.setNumReduceTasks(num_reduces);

    jobConf.setInputFormat(inputFormatClass);
    jobConf.setOutputFormat(outputFormatClass);

    jobConf.setOutputKeyClass(outputKeyClass);
    jobConf.setOutputValueClass(outputValueClass);

    // Make sure there are exactly 2 parameters left.
    if (otherArgs.size() != 2) {
      System.out.println("ERROR: Wrong number of parameters: " +
          otherArgs.size() + " instead of 2.");
      return printUsage();
    }
    FileInputFormat.setInputPaths(jobConf, otherArgs.get(0));
    FileOutputFormat.setOutputPath(jobConf, new Path(otherArgs.get(1)));

    if (sampler != null) {
      System.out.println("Sampling input to effect total-order sort...");
      jobConf.setPartitionerClass(TotalOrderPartitioner.class);
      Path inputDir = FileInputFormat.getInputPaths(jobConf)[0];
      inputDir = inputDir.makeQualified(inputDir.getFileSystem(jobConf));
      Path partitionFile = new Path(inputDir, "_sortPartitioning");
      TotalOrderPartitioner.setPartitionFile(jobConf, partitionFile);
      InputSampler.<K,V>writePartitionFile(jobConf, sampler);
      URI partitionUri = new URI(partitionFile.toString() +
                                 "#" + "_sortPartitioning");
      DistributedCache.addCacheFile(partitionUri, jobConf);
      DistributedCache.createSymlink(jobConf);
    }

    System.out.println("Running on " +
        cluster.getTaskTrackers() +
        " nodes to sort from " + 
        FileInputFormat.getInputPaths(jobConf)[0] + " into " +
        FileOutputFormat.getOutputPath(jobConf) +
        " with " + num_reduces + " reduces.");
    Date startTime = new Date();
    System.out.println("Job started: " + startTime);
    jobResult = JobClient.runJob(jobConf);
    Date end_time = new Date();
    System.out.println("Job ended: " + end_time);
    System.out.println("The job took " + 
        (end_time.getTime() - startTime.getTime()) /1000 + " seconds.");
    return 0;
  }
263481
function runBenchmark(benchmark, environments) {
  let benchmarkName;
  const benches = environments.map(environment => {
    const module = require(path.join(environment.distPath, benchmark))
    benchmarkName = module.name;
    return new Benchmark(environment.revision, module.measure);
  });

  console.log('⏱️   ' + benchmarkName);
  for (let i = 0; i < benches.length; ++i) {
    benches[i].run({ async: false });
    process.stdout.write('  ' + cyan(i + 1) + ' tests completed.\u000D');
  }
  console.log('\n');

  beautifyBenchmark(benches);
  console.log('');
}
1112004
public static void main(String[] args) throws InterruptedException {
		final ExecutorService executorService = Executors.newFixedThreadPool(1000);
		BenchmarkUtils.run(1, 2,
			// low contention - single thread
			new BenchmarkUtils.Task("1") {
				@Override
				public void perform() throws Exception {
					new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute();
				}
			},
			// medium contention
			new BenchmarkUtils.Task("CPU") {
				@Override
				public void perform() throws Exception {
					new MultithreadedTester(TOTAL_TASK_RUNS, AVAILABLE_PROCESSORS, executorService).execute();
				}
			},
			// High contention
			new BenchmarkUtils.Task("400") {
				@Override
				public void perform() throws Exception {
					new MultithreadedTester(TOTAL_TASK_RUNS, 400, executorService).execute();
				}
			}
		);
		executorService.shutdown();

		// we're not using Benchmark results here this time, so we have to extract them on our own
		StopwatchSample sampleLo = SimonManager.getStopwatch("MT-1").sample();
		StopwatchSample sampleCpu = SimonManager.getStopwatch("MT-" + AVAILABLE_PROCESSORS).sample();
		StopwatchSample sampleHi = SimonManager.getStopwatch("MT-400").sample();

		System.out.println("\nsampleLo = " + sampleLo);
		System.out.println("sampleCpu = " + sampleCpu);
		System.out.println("sampleHi = " + sampleHi);

		System.out.println("\nGoogle Chart avg:\n" +
			GoogleChartImageGenerator.barChart("MultithreadedContention", SimonUnit.NANOSECOND,
				sampleLo,
				sampleCpu,
				sampleHi));
		System.out.println("\nGoogle Chart avg/min/max:\n" +
			GoogleChartImageGenerator.barChart("MultithreadedContention", SimonUnit.NANOSECOND, true,
				sampleLo,
				sampleCpu,
				sampleHi));
	}
263623
public static void main(String[] args) throws Exception {

		// ---- print some usage help ----

		System.out.println("Usage with built-in data generator: StateMachineExample [--error-rate <probability-of-invalid-transition>] [--sleep <sleep-per-record-in-ms>]");
		System.out.println("Usage with Kafka: StateMachineExample --kafka-topic <topic> [--brokers <brokers>]");
		System.out.println("Options for both the above setups: ");
		System.out.println("\t[--backend <file|rocks>]");
		System.out.println("\t[--checkpoint-dir <filepath>]");
		System.out.println("\t[--async-checkpoints <true|false>]");
		System.out.println("\t[--incremental-checkpoints <true|false>]");
		System.out.println("\t[--output <filepath> OR null for stdout]");
		System.out.println();

		// ---- determine whether to use the built-in source, or read from Kafka ----

		final SourceFunction<Event> source;
		final ParameterTool params = ParameterTool.fromArgs(args);

		if (params.has("kafka-topic")) {
			// set up the Kafka reader
			String kafkaTopic = params.get("kafka-topic");
			String brokers = params.get("brokers", "localhost:9092");

			System.out.printf("Reading from kafka topic %s @ %s\n", kafkaTopic, brokers);
			System.out.println();

			Properties kafkaProps = new Properties();
			kafkaProps.setProperty("bootstrap.servers", brokers);

			FlinkKafkaConsumer010<Event> kafka = new FlinkKafkaConsumer010<>(kafkaTopic, new EventDeSerializer(), kafkaProps);
			kafka.setStartFromLatest();
			kafka.setCommitOffsetsOnCheckpoints(false);
			source = kafka;
		}
		else {
			double errorRate = params.getDouble("error-rate", 0.0);
			int sleep = params.getInt("sleep", 1);

			System.out.printf("Using standalone source with error rate %f and sleep delay %s millis\n", errorRate, sleep);
			System.out.println();

			source = new EventsGeneratorSource(errorRate, sleep);
		}

		// ---- main program ----

		// create the environment to create streams and configure execution
		final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		env.enableCheckpointing(2000L);

		final String stateBackend = params.get("backend", "memory");
		if ("file".equals(stateBackend)) {
			final String checkpointDir = params.get("checkpoint-dir");
			boolean asyncCheckpoints = params.getBoolean("async-checkpoints", false);
			env.setStateBackend(new FsStateBackend(checkpointDir, asyncCheckpoints));
		} else if ("rocks".equals(stateBackend)) {
			final String checkpointDir = params.get("checkpoint-dir");
			boolean incrementalCheckpoints = params.getBoolean("incremental-checkpoints", false);
			env.setStateBackend(new RocksDBStateBackend(checkpointDir, incrementalCheckpoints));
		}

		final String outputFile = params.get("output");

		// make parameters available in the web interface
		env.getConfig().setGlobalJobParameters(params);

		DataStream<Event> events = env.addSource(source);

		DataStream<Alert> alerts = events
				// partition on the address to make sure equal addresses
				// end up in the same state machine flatMap function
				.keyBy(Event::sourceAddress)

				// the function that evaluates the state machine over the sequence of events
				.flatMap(new StateMachineMapper());

		// output the alerts to std-out
		if (outputFile == null) {
			alerts.print();
		} else {
			alerts
				.writeAsText(outputFile, FileSystem.WriteMode.OVERWRITE)
				.setParallelism(1);
		}

		// trigger program execution
		env.execute("State machine job");
	}
1220988
function Benchmarked(options) {
  if (!(this instanceof Benchmarked)) {
    return new Benchmarked(options);
  }
  Emitter.call(this);
  this.options = Object.assign({}, options);
  this.results = [];
  this.defaults(this);
}
434380
public static void main(final String[] args) {

    try {

      final Configuration commandLineConf = parseCommandLine(args);
      final Injector injector = Tang.Factory.getTang().newInjector(commandLineConf);

      final boolean isLocal = injector.getNamedInstance(Local.class);
      final int numEvaluators = injector.getNamedInstance(NumEvaluators.class);
      final int numTasks = injector.getNamedInstance(NumTasks.class);
      final int delay = injector.getNamedInstance(Delay.class);
      final int jobNum = injector.getNamedInstance(JobId.class);

      final String jobId = String.format("pool.e_%d.a_%d.d_%d.%d",
          numEvaluators, numTasks, delay, jobNum < 0 ? System.currentTimeMillis() : jobNum);

      // Timeout: delay + 6 extra seconds per Task per Evaluator + 2 minutes to allocate each Evaluator:
      final int timeout = numTasks * (delay + 6) * 1000 / numEvaluators + numEvaluators * 120000;

      final Configuration runtimeConfig = getClientConfiguration(commandLineConf, isLocal);
      LOG.log(Level.INFO, "TIME: Start Client {0} with timeout {1} sec. Configuration:\n--\n{2}--",
          new Object[] {jobId, timeout / 1000, Configurations.toString(runtimeConfig, true)});

      final Configuration driverConfig = DriverConfiguration.CONF
          .set(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getClassLocation(JobDriver.class))
          .set(DriverConfiguration.DRIVER_IDENTIFIER, jobId)
          .set(DriverConfiguration.ON_DRIVER_STARTED, JobDriver.StartHandler.class)
          .set(DriverConfiguration.ON_DRIVER_STOP, JobDriver.StopHandler.class)
          .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, JobDriver.AllocatedEvaluatorHandler.class)
          .set(DriverConfiguration.ON_CONTEXT_ACTIVE, JobDriver.ActiveContextHandler.class)
          .set(DriverConfiguration.ON_TASK_RUNNING, JobDriver.RunningTaskHandler.class)
          .set(DriverConfiguration.ON_TASK_COMPLETED, JobDriver.CompletedTaskHandler.class)
          .set(DriverConfiguration.ON_EVALUATOR_COMPLETED, JobDriver.CompletedEvaluatorHandler.class)
          .build();

      final Configuration submittedConfiguration = Tang.Factory.getTang()
          .newConfigurationBuilder(driverConfig, commandLineConf).build();

      DriverLauncher.getLauncher(runtimeConfig).run(submittedConfiguration, timeout);

      LOG.log(Level.INFO, "TIME: Stop Client {0}", jobId);

    } catch (final BindException | InjectionException | IOException ex) {
      LOG.log(Level.SEVERE, "Job configuration error", ex);
    }
  }
1208796
static public void main (String[] args) throws Exception {
		if (args.length == 0) {
			String commandLine = "-f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s " // For developement only (fork 0, short runs).
			// + "-bs 2500000 ArrayBenchmark" //
			// + "-rf csv FieldSerializerBenchmark.field FieldSerializerBenchmark.tagged" //
			// + "FieldSerializerBenchmark.tagged" //
			;
			System.out.println(commandLine);
			args = commandLine.split(" ");
		}
		Main.main(args);
	}
716493
public static void main(String[] args) {
		try {
			JarRunner runner = new JarRunner(args);
			runner.runIfConfigured();
		} catch (NumberFormatException e) {
			System.err.println("Could not parse number " + e.getMessage());
			System.exit(1);
		} catch (RuntimeException e) {
			System.err.println(e.getMessage());
			System.exit(1);
		}
	}
807133
private int run(String[] args) throws Exception {
    Configuration conf = new Configuration();
    String numMaps =  new GenericOptionsParser(conf, args).getRemainingArgs()[0];
    conf.set(MRJobConfig.NUM_MAPS, numMaps);
    createHdfsFilesystem(conf);

    Job job = Job.getInstance(conf, "MapReduceIntegrationChecker");
    job.setJarByClass(MapReduceIntegrationChecker.class);
    job.setMapperClass(CheckerMapper.class);
    job.setCombinerClass(CheckerReducer.class);
    job.setReducerClass(CheckerReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);
    job.setInputFormatClass(EmptyInputFormat.class);
    FileOutputFormat.setOutputPath(job, mOutputFilePath);

    try {
      if (!job.waitForCompletion(true)) {
        return 1;
      }
      Status resultStatus = generateReport();
      return resultStatus.equals(Status.SUCCESS) ? 0
          : (resultStatus.equals(Status.FAIL_TO_FIND_CLASS) ? 2 : 1);
    } finally {
      if (mFileSystem.exists(mOutputFilePath)) {
        mFileSystem.delete(mOutputFilePath, true);
      }
      mFileSystem.close();
    }
  }
196869
public static void main(final String[] args) {
        LookAndFeelManager.get().init();

        final Injector injector = Guice.createInjector(new DCModuleImpl());

        // run a small job
        final AnalysisJobBuilder ajb = injector.getInstance(AnalysisJobBuilder.class);
        final Datastore ds = injector.getInstance(DatastoreCatalog.class).getDatastore("orderdb");
        final DatastoreConnection con = ds.openConnection();
        final SchemaNavigator sn = con.getSchemaNavigator();
        ajb.setDatastore(ds);
        ajb.addSourceColumns(sn.convertToTable("PUBLIC.CUSTOMERS").getColumns());

        final AnalyzerComponentBuilder<ValueDistributionAnalyzer> singleValueDist =
                ajb.addAnalyzer(ValueDistributionAnalyzer.class);
        singleValueDist.addInputColumn(ajb.getSourceColumnByName("PUBLIC.CUSTOMERS.ADDRESSLINE2"));

        final AnalyzerComponentBuilder<ValueDistributionAnalyzer> groupedValueDist =
                ajb.addAnalyzer(ValueDistributionAnalyzer.class);
        groupedValueDist.addInputColumn(ajb.getSourceColumnByName("PUBLIC.CUSTOMERS.CITY"));
        groupedValueDist.setConfiguredProperty("Group column", ajb.getSourceColumnByName("PUBLIC.CUSTOMERS.COUNTRY"));

        final ResultWindow resultWindow = injector.getInstance(ResultWindow.class);
        resultWindow.setVisible(true);
        resultWindow.startAnalysis();
    }
1193454
async function run() {
  await benchmark(
    () => map(f => f(), createPromiseFuncs()),
    'Map (concurrency: 3)'
  );
  await benchmark(
    () => mapWithOptions(f => f(), { concurrency: 1 }, createPromiseFuncs()),
    'Map (concurrency: 1)'
  );
  await benchmark(
    () => mapSeries(f => f(), createPromiseFuncs()),
    'Map series'
  );
}
994245
public static void main(String[] args){

    // -- STRESS TEST THREADS --
    Runnable[] tasks = new Runnable[1000];
    for(int i=0; i<tasks.length; i++){
      final int fI = i;
      tasks[i] = new Runnable(){
        public void run(){
          startTrack("Runnable " + fI);
          log(Thread.currentThread().getId());
          log("message " + fI + ".1");
          log("message " + fI + ".2");
          log("message " + fI + ".3");
          log(FORCE,"message " + fI + ".4");
          log("message " + fI + ".5");
          forceTrack("Runnable " + fI + ".1");
          endTrack("Runnable " + fI + ".1");
          forceTrack("Runnable " + fI + ".2");
          log("a message");
          endTrack("Runnable " + fI + ".2");
          forceTrack("Runnable " + fI + ".3");
          log("a message");
          log(FORCE,"A forced message");
          endTrack("Runnable " + fI + ".3");
          endTrack("Runnable " + fI);
        }
      };
    }
    startTrack("Wrapper");
    for(int i=0; i<100; i++){
      Util.threadAndRun(new ArrayIterable(tasks), 100);
    }
    endTrack("Wrapper");
    System.exit(1);
    
    
    forceTrack("Track 1");
    log("tag", ERR, "hello world");
    startTrack("Hidden");
    startTrack("Subhidden");
    endTrack("Subhidden");
    endTrack("Hidden");
    startTrack(FORCE, "Shown");
    startTrack(FORCE,"Subshown");
    endTrack("Subshown");
    endTrack("Shown");
    log("^shown should have appeared above");
    startTrack("Track 1.1");
    log(WARN, "some", "something in 1.1");
    log("some",ERR,"something in 1.1");
    log(FORCE,"some",WARN,"something in 1.1");
    log(WARN,FORCE,"some","something in 1.1");
    logf("format string %s then int %d", "hello", 7);
    endTrack("Track 1.1");
    startTrack();
    log("In an anonymous track");
    endTrack();
    endTrack("Track 1");
    log("outside of a track");
    log("these","channels","should","be","in",DBG,"alphabetical","order", "a log item with lots of channels");
    log("these","channels","should","be","in",DBG,"alphabetical","order", "a log item\nthat spans\nmultiple\nlines");
    log(DBG,"a last log item");
    log(ERR,null);

    //--Repeated Records
    RedwoodConfiguration.current().collapseExact().apply();
    //(simple case)
    forceTrack("Strict Equality");
    for(int i=0; i<100; i++){ log("this is a message"); }
    endTrack("Strict Equality");
    //(in-track change)
    forceTrack("Change");
    for(int i=0; i<10; i++){ log("this is a message"); }
    for(int i=0; i<10; i++){ log("this is a another message"); }
    for(int i=0; i<10; i++){ log("this is a third message"); }
    for(int i=0; i<5; i++){ log("this is a fourth message"); }
    log(FORCE,"this is a fourth message");
    for(int i=0; i<5; i++){ log("this is a fourth message"); }
    log("^middle 'fourth message' was forced");
    endTrack("Change");
    //(suppress tracks)
    forceTrack("Repeated Tracks");
    for(int i=0; i<100; i++){ startTrack("Track type 1"); log("a message"); endTrack("Track type 1"); }
    for(int i=0; i<100; i++){ startTrack("Track type 2"); log("a message"); endTrack("Track type 2"); }
    for(int i=0; i<100; i++){ startTrack("Track type 3"); log("a message"); endTrack("Track type 3"); }
    startTrack("Track type 3"); startTrack("nested"); log(FORCE,"this should show up"); endTrack("nested"); endTrack("Track type 3");
    for(int i=0; i<5; i++){ startTrack("Track type 3"); log(FORCE,"this should show up"); endTrack("Track type 3"); }
    log(WARN,"The log message 'this should show up' should show up 6 (5+1) times above");
    endTrack("Repeated Tracks");
    //(tracks with invisible things)
    Redwood.hideOnlyChannels(DBG);
    forceTrack("Hidden Subtracks");
    for(int i=0; i<100; i++){
      startTrack("Only has debug messages");
      log(DBG,"You shouldn't see me");
      endTrack("Only has debug messages");
    }
    log("You shouldn't see any other messages or 'skipped tracks' here");
    endTrack("Hidden Subtracks");
    //(fuzzy repeats)
    RedwoodConfiguration.standard().apply();
    RedwoodConfiguration.current().collapseApproximate().apply();
    forceTrack("Fuzzy Equality");
    for(int i=0; i<100; i++){ log("iter " + i + " ended with value " + (-34587292534.0+Math.sqrt(i)*3000000000.0)); }
    endTrack("Fuzzy Equality");
    forceTrack("Fuzzy Equality (timing)");
    for(int i=0; i<100; i++){
      log("iter " + i + " ended with value " + (-34587292534.0+Math.sqrt(i)*3000000000.0));
      try {
        Thread.sleep(50);
      } catch (InterruptedException e) { }
    }
    endTrack("Fuzzy Equality (timing)");

    //--Util Helper
    Util.log("hello world");
    Util.log(DBG, "hello world");
    Util.debug("hello world");
    Util.debug("atag", "hello world");

    //--Show Name at Track Finish
    Redwood.getHandler(ConsoleHandler.class).minLineCountForTrackNameReminder = 5;
    startTrack("Long Track");
    for(int i=0; i<10; i++){ log(FORCE,"contents of long track"); }
    endTrack("Long TracK");
    startTrack("Long Track");
    startTrack("But really this is the long one");
    try {
      Thread.sleep(3000);
    } catch (InterruptedException e) { }
    for(int i=0; i<10; i++){ log(FORCE,"contents of long track"); }
    endTrack("But really this is the long one");
    endTrack("Long TracK");
    Redwood.getHandler(ConsoleHandler.class).minLineCountForTrackNameReminder = 50;

    //--Multithreading
    ExecutorService exec = Executors.newFixedThreadPool(10);
    startThreads("name");
    for(int i=0; i<50; i++){
      final int theI = i;
      exec.execute(new Runnable(){
        public void run() {
          startTrack("Thread " + theI + " (" + Thread.currentThread().getId() + ")");
          for(int time=0; time<5; time++){
            log("tick " + time + " from " + theI + " (" + Thread.currentThread().getId() + ")");
            try {
              Thread.sleep(50);
            } catch (Exception e) {}
          }
          endTrack("Thread " + theI + " (" + Thread.currentThread().getId() + ")");
          finishThread();
        }
      });

    }
    exec.shutdown();
    try {
      exec.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
    } catch (InterruptedException e) {}
    endThreads("name");

    //--System Streams
    Redwood.captureSystemStreams(true, true);
    System.out.println("Hello World");
    System.err.println("This is an error!");

    //--Neat Exit
    RedwoodConfiguration.standard().collapseExact().apply();
    //(on close)
    for(int i=0; i<100; i++){
//      startTrack();
      log("stuff!");
//      endTrack();
    }
    Util.exit(0);
    //(on exception)
    System.out.println("I'm going to exception soon (on purpose)");
    RedwoodConfiguration.current().neatExit().apply();
    startTrack("I should close");
    log(FORCE,"so I'm nonempty...");
    try {
      Thread.sleep(3000);
    } catch (InterruptedException e) { }
		throw new IllegalArgumentException();
  }