Java Code Examples for com.google.caliper.platform.Platform

Following code examples demonstrate how to use com.google.caliper.platform.Platformfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.google.caliper.platform.Platformand various code implementation of this class.

  @Provides
  static Platform providePlatform(
      Optional<DalvikPlatform> optionalDalvikPlatform,
      Provider<JvmPlatform> jvmPlatformProvider) {
    if (optionalDalvikPlatform.isPresent()) {
      return optionalDalvikPlatform.get();
    } else {
      return jvmPlatformProvider.get();
    }
  } 


  @Provides
  static ImmutableSet<VirtualMachine> provideVirtualMachines(
      CaliperOptions options,
      CaliperConfig config,
      Platform platform)
      throws InvalidConfigurationException {
    ImmutableSet<String> vmNames = options.vmNames();
    ImmutableSet.Builder<VirtualMachine> builder = ImmutableSet.builder();
    if (vmNames.isEmpty()) {
      builder.add(new VirtualMachine("default", config.getDefaultVmConfig(platform)));
    } else {
      for (String vmName : vmNames) {
        VmConfig vmConfig = config.getVmConfig(platform, vmName);
        builder.add(new VirtualMachine(vmName, vmConfig));
      }
    }
    return builder.build();
  } 

Advertisement
Javadoc
An abstraction of the platform within which caliper (both the scheduler and the actual workers) will

run.

Read More
Advertisement