java类org.openjdk.jmh.annotations.Setup的实例源码

VarBitMetricStoreBenchmark.java 文件源码 项目:yuvi 阅读 22 收藏 0 点赞 0 评论 0
@Setup
public void setup() {
  try {
    load();
  } catch (IOException e) {
    e.printStackTrace();
  }
}
ChunkManagerQueryBenchmark.java 文件源码 项目:yuvi 阅读 21 收藏 0 点赞 0 评论 0
@Setup(Level.Trial)
public void setup() {
  ChunkManager chunkManager = new ChunkManager("test", 1_000_000);
  metricWriter = new FileMetricWriter(filePath, chunkManager);
  metricWriter.start();
  // Convert all data to offHeap
  chunkManager.toOffHeapChunkMap();
}
ChunkQueryBenchmark.java 文件源码 项目:yuvi 阅读 21 收藏 0 点赞 0 评论 0
@Setup(Level.Trial)
public void setup() {
  chunkStore = new ChunkImpl(
      new MetricsAndTagStoreImpl(new InvertedIndexTagStore(1_000_000, 1_000_000), new VarBitMetricStore()),
      null);

  try (Stream<String> lines = Files.lines(filePath, Charset.defaultCharset())) {
    lines.forEachOrdered(line -> {
      try {
        String[] words = line.split(" ");
        String metricName = words[1];
        if (metricName != null && !metricName.isEmpty()) {
          if (counts.containsKey(metricName)) {
            counts.put(metricName, counts.get(metricName) + 1);
          } else {
            counts.put(metricName, 1);
          }

          MetricUtils.parseAndAddOpenTsdbMetric(line, chunkStore);
        }
      } catch (Exception e) {
        System.err.println("Error ingesting metric: " + e.getMessage());
        e.printStackTrace();
      }
    });
  } catch (Exception e) {
    e.printStackTrace();
  }
}
InvertedIndexTagStoreBenchmark.java 文件源码 项目:yuvi 阅读 18 收藏 0 点赞 0 评论 0
@Setup(Level.Invocation)
public void setup() {
  switch (msType) {
    case "InvertedIndexTagStore":
      int initialMapSize = 10000;
      ms = new InvertedIndexTagStore(initialMapSize, initialMapSize);
      metrics = new ArrayList();
      for (int i = 0; i < initialMapSize; i++) {
        metrics.add(randomMetric(numMetrics, numKeys, numValues));
      }
      break;
    default:
      throw new RuntimeException("invalid msType: " + msType);
  }
}
HashBenchmark.java 文件源码 项目:core-ng-demo-project 阅读 19 收藏 0 点赞 0 评论 0
@Setup
public void setup() {
    values.add("abcdefghigklmnopqrstuvwxyz012345679");
    values.add("ABCDEFGHIGKLMNOPQRSTUVWXYZ012345679");
    values.add("012345679ABCDEFGHIGKLMNOPQRSTUVWXYZ");
    values.add("012345679abcdefghigklmnopqrstuvwxyz");
    values.add("012345679abcdefghigkLMNOPQRSTUvwxyz");
    values.add("012345679ABCDEFGHIGKlmnopqrstuVWXYZ");
}
URIEncodingBenchmark.java 文件源码 项目:core-ng-demo-project 阅读 76 收藏 0 点赞 0 评论 0
@Setup
public void setup() {
    pathSegments.add("path1");
    pathSegments.add("path2");
    pathSegments.add("path3");
    pathSegments.add("value1 value2");
    pathSegments.add("value1+value2");
    pathSegments.add("value1/value2");
    pathSegments.add("/value1");
    pathSegments.add("utf-8-✓");
    pathSegments.add("value1?value2");
}
StringsSplitBenchmark.java 文件源码 项目:core-ng-demo-project 阅读 18 收藏 0 点赞 0 评论 0
@Setup
public void setup() {
    texts.add("path1/path2/path3");
    texts.add("path1/path2/path3/");
    texts.add("/path1/path2/path3");
    texts.add("/long-0123456789-path1/long-0123456789-path2/long-0123456789-path3");
}
ASCIIToUpperCaseBenchmark.java 文件源码 项目:core-ng-demo-project 阅读 17 收藏 0 点赞 0 评论 0
@Setup
public void setup() {
    values.add("abcdefghigklmnopqrstuvwxyz012345679");
    values.add("ABCDEFGHIGKLMNOPQRSTUVWXYZ012345679");
    values.add("012345679ABCDEFGHIGKLMNOPQRSTUVWXYZ");
    values.add("012345679abcdefghigklmnopqrstuvwxyz");
    values.add("012345679abcdefghigkLMNOPQRSTUvwxyz");
    values.add("012345679ABCDEFGHIGKlmnopqrstuVWXYZ");
}
HTMLTemplateBenchmark.java 文件源码 项目:core-ng-demo-project 阅读 20 收藏 0 点赞 0 评论 0
@Setup
public void setup() {
    model = JSON.fromJSON(FilterUIView.class, ClasspathResources.text("template-test/filter.json"));

    Properties messages = new Properties();
    messages.load("template-test/plp_es_GT.properties");
    HTMLTemplateBuilder builder = new HTMLTemplateBuilder(new StringTemplateSource("filter", ClasspathResources.text("template-test/filter.html")), FilterUIView.class);
    builder.message = messages::get;
    template = builder.build();
}
RecordBatchIterationBenchmark.java 文件源码 项目:kafka-0.11.0.0-src-with-comment 阅读 17 收藏 0 点赞 0 评论 0
@Setup
public void init() {
    bufferSupplier = BufferSupplier.create();
    singleBatchBuffer = createBatch(1);

    batchBuffers = new ByteBuffer[batchCount];
    batchSizes = new int[batchCount];
    for (int i = 0; i < batchCount; ++i) {
        int size = random.nextInt(maxBatchSize) + 1;
        batchBuffers[i] = createBatch(size);
        batchSizes[i] = size;
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号