コード例 #1
0
  private static void runCpuTest(Set<ITmfTrace> testTraces, String testName, int loop_count) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName + TIME);
    perf.tagAsSummary(pm, TEST_SUMMARY + ':' + testName + TIME, Dimension.CPU_TIME);

    for (int i = 0; i < loop_count; i++) {
      TmfEventMatching traceMatch = new TmfEventMatching(testTraces);

      pm.start();
      traceMatch.matchEvents();
      pm.stop();
    }
    pm.commit();
  }
コード例 #2
0
  /* Benchmark memory used by the algorithm */
  private static void runMemoryTest(Set<ITmfTrace> testTraces, String testName, int loop_count) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName + MEMORY);
    perf.tagAsSummary(pm, TEST_SUMMARY + ':' + testName + MEMORY, Dimension.USED_JAVA_HEAP);

    for (int i = 0; i < loop_count; i++) {
      TmfEventMatching traceMatch = new TmfEventMatching(testTraces);

      System.gc();
      pm.start();
      traceMatch.matchEvents();
      System.gc();
      pm.stop();
    }
    pm.commit();
  }