- private void runIterate(int size, int[] fuzz, String method) {
- long duration = addAndIterate(size, fuzz, fSegStore);
-
- outputResults(duration, method);
- }
-
- private long addAndIterate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store) {
- long start = System.nanoTime();
- populate(size, fuzz, store);
- iterate(store);
- long end = System.nanoTime();
- return end - start;
- }
-
- private void runIterateAddIterate(int size, int[] fuzz, String method) {
- long duration = runIterateAddIterate(size, fuzz, fSegStore);
- outputResults(duration, method);
- }
-
- private static long runIterateAddIterate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store) {
- store.clear();
- long start = System.nanoTime();
- for (int i = 0; i < 50000; i++) {
- long startTime = i + fuzz[i % size];
- store.add(new BasicSegment(startTime, startTime + 10));
- }
- iterate(store);
- for (int i = 50000; i < 100000; i++) {
- long startTime = i + fuzz[i % size];
- store.add(new BasicSegment(startTime, startTime + 10));
+ private void insertIterTwice(int size, int[] fuzz, String distributionName) {
+ PerformanceMeter pMinsertion1 = fPerf.createPerformanceMeter(distributionName + " First Insertion: " + fName);
+ PerformanceMeter pMiterate1 = fPerf.createPerformanceMeter(distributionName + " First Iteration: " + fName);
+ PerformanceMeter pMinsertion2 = fPerf.createPerformanceMeter(distributionName + " Second Insertion: " + fName);
+ PerformanceMeter pMiterate2 = fPerf.createPerformanceMeter(distributionName + " Second Iteration: " + fName);
+
+ for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) {
+ fSegStore.clear();
+
+ System.gc();
+ pMinsertion1.start();
+ populate(size, fuzz, fSegStore, 0, getSegmentStoreSize() / 2);
+ pMinsertion1.stop();
+
+ System.gc();
+ pMiterate1.start();
+ iterate(fSegStore);
+ pMiterate1.stop();
+
+ System.gc();
+ pMinsertion2.start();
+ populate(size, fuzz, fSegStore, getSegmentStoreSize() / 2 + 1, getSegmentStoreSize());
+ pMinsertion2.stop();
+
+ System.gc();
+ pMiterate2.start();
+ iterate(fSegStore);
+ pMiterate2.stop();