Ignore:
Timestamp:
Jul 7, 2021, 11:56:29 AM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
47e413b
Parents:
acb38ce9
Message:

Updated the Java exception benchmarks to provide some warm-up. Does not appear to change results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/ThrowOther.java

    racb38ce9 r11d4fa5  
    2424        }
    2525
    26         public static void main(String[] args) {
    27                 int times = 1;
    28                 int total_frames = 1;
    29                 if (0 < args.length) {
    30                         times = Integer.parseInt(args[0]);
    31                 }
    32                 if (1 < args.length) {
    33                         total_frames = Integer.parseInt(args[1]);
    34                 }
    35 
     26        private static long loop(int times, int total_frames) {
    3627                long startTime = System.nanoTime();
    3728                for (int count = 0 ; count < times ; ++count) {
     
    4536                }
    4637                long endTime = System.nanoTime();
    47                 System.out.println("Run-Time (ns) " + (endTime - startTime));
     38                return endTime - startTime;
     39        }
     40
     41        public static void main(String[] args) {
     42                int times = 1;
     43                int total_frames = 1;
     44                if (0 < args.length) {
     45                        times = Integer.parseInt(args[0]);
     46                }
     47                if (1 < args.length) {
     48                        total_frames = Integer.parseInt(args[1]);
     49                }
     50
     51                // Warm-Up:
     52                loop(1000, total_frames);
     53
     54                long time = loop(times, total_frames);
     55                System.out.println("Run-Time (ns): " + time);
    4856        }
    4957}
Note: See TracChangeset for help on using the changeset viewer.