Ignore:
Timestamp:
Jul 12, 2021, 1:44:35 PM (4 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
605673f, 9345684
Parents:
cf444b6 (diff), a953c2e3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
doc/theses/andrew_beach_MMath/code
Files:
1 added
20 edited
4 moved

Legend:

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

    rcf444b6 r6ff08d8  
    33class EmptyException extends Exception {}
    44
    5 public class CondMatch {
     5public class CondCatch {
    66        static boolean should_catch = false;
    77
     
    2020        }
    2121
    22         public static void main(String[] args) {
    23                 int times = 1;
    24                 int total_frames = 1;
    25                 if (0 < args.length) {
    26                         times = Integer.parseInt(args[0]);
    27                 }
    28                 if (1 < args.length) {
    29                         total_frames = Integer.parseInt(args[1]);
    30                 }
    31 
     22        private static long loop(int times) {
     23                long startTime = System.nanoTime();
    3224                for (int count = 0 ; count < times ; ++count) {
    3325                        try {
     
    3729                        }
    3830                }
     31                long endTime = System.nanoTime();
     32                return endTime - startTime;
     33        }
     34
     35        public static void main(String[] args) {
     36                int times = 1;
     37                if (0 < args.length) {
     38                        times = Integer.parseInt(args[0]);
     39                }
     40                if (1 < args.length) {
     41                        should_catch = 0 != Integer.parseInt(args[1]);
     42                }
     43
     44                // Warm-Up:
     45                loop(1000);
     46
     47                long time = loop(times);
     48                System.out.println("Run-Time (ns): " + time);
    3949        }
    4050}
  • doc/theses/andrew_beach_MMath/code/CrossCatch.java

    rcf444b6 r6ff08d8  
    44
    55public class CrossCatch {
    6         public static void main(String[] args) {
    7                 int times = 1;
    8                 boolean shouldThrow = false;
    9                 if (0 < args.length) {
    10                         times = Integer.parseInt(args[0]);
    11                 }
     6        private static boolean shouldThrow = false;
    127
     8        private static long loop(int times) {
     9                long startTime = System.nanoTime();
    1310                for (int count = 0 ; count < times ; ++count) {
    1411                        try {
     
    2017                        }
    2118                }
     19                long endTime = System.nanoTime();
     20                return endTime - startTime;
     21        }
     22
     23        public static void main(String[] args) {
     24                int times = 1;
     25                if (0 < args.length) {
     26                        times = Integer.parseInt(args[0]);
     27                }
     28
     29                // Warm-Up:
     30                loop(1000);
     31
     32                long time = loop(times);
     33                System.out.println("Run-Time (ns): " + time);
    2234        }
    2335}
  • doc/theses/andrew_beach_MMath/code/CrossFinally.java

    rcf444b6 r6ff08d8  
    22
    33public class CrossFinally {
    4         public static void main(String[] args) {
    5                 int times = 1;
    6                 boolean shouldThrow = false;
    7                 if (0 < args.length) {
    8                         times = Integer.parseInt(args[0]);
    9                 }
     4        private static boolean shouldThrow = false;
    105
     6        private static long loop(int times) {
     7                long startTime = System.nanoTime();
    118                for (int count = 0 ; count < times ; ++count) {
    129                        try {
     
    1613                        }
    1714                }
     15                long endTime = System.nanoTime();
     16                return endTime - startTime;
     17        }
     18
     19        public static void main(String[] args) {
     20                int times = 1;
     21                if (0 < args.length) {
     22                        times = Integer.parseInt(args[0]);
     23                }
     24
     25                // Warm-Up:
     26                loop(1000);
     27
     28                long time = loop(times);
     29                System.out.println("Run-Time (ns): " + time);
    1830        }
    1931}
  • doc/theses/andrew_beach_MMath/code/ThrowEmpty.java

    rcf444b6 r6ff08d8  
    1212        }
    1313
     14        private static long loop(int times, int total_frames) {
     15                long startTime = System.nanoTime();
     16                for (int count = 0 ; count < times ; ++count) {
     17                        try {
     18                                unwind_empty(total_frames);
     19                        } catch (EmptyException e) {
     20                                // ...
     21                        }
     22                }
     23                long endTime = System.nanoTime();
     24                return endTime - startTime;
     25        }
     26
    1427        public static void main(String[] args) {
    1528                int times = 1;
     
    2235                }
    2336
    24                 for (int count = 0 ; count < times ; ++count) {
    25                         try {
    26                                 unwind_empty(total_frames);
    27                         } catch (EmptyException e) {
    28                                 // ...
    29                         }
    30                 }
     37                // Warm-Up:
     38                loop(1000, total_frames);
     39
     40                long time = loop(times, total_frames);
     41                System.out.println("Run-Time (ns): " + time);
    3142        }
    3243}
  • doc/theses/andrew_beach_MMath/code/ThrowFinally.java

    rcf444b6 r6ff08d8  
    1313        }
    1414
     15        private static long loop(int times, int total_frames) {
     16                long startTime = System.nanoTime();
     17                for (int count = 0 ; count < times ; ++count) {
     18                        try {
     19                                unwind_finally(total_frames);
     20                        } catch (EmptyException e) {
     21                                // ...
     22                        }
     23                }
     24                long endTime = System.nanoTime();
     25                return endTime - startTime;
     26        }
     27
    1528        public static void main(String[] args) {
    1629                int times = 1;
     
    2336                }
    2437
    25                 for (int count = 0 ; count < times ; ++count) {
    26                         try {
    27                                 unwind_finally(total_frames);
    28                         } catch (EmptyException e) {
    29                                 // ...
    30                         }
    31                 }
     38                // Warm-Up:
     39                loop(1000, total_frames);
     40
     41                long time = loop(times, total_frames);
     42                System.out.println("Run-Time (ns): " + time);
    3243        }
    3344}
  • doc/theses/andrew_beach_MMath/code/ThrowOther.java

    rcf444b6 r6ff08d8  
    2424        }
    2525
     26        private static long loop(int times, int total_frames) {
     27                long startTime = System.nanoTime();
     28                for (int count = 0 ; count < times ; ++count) {
     29                        try {
     30                                unwind_other(total_frames);
     31                        } catch (EmptyException e) {
     32                                // ...
     33                        } catch (NotRaisedException e) {
     34                                // ...
     35                        }
     36                }
     37                long endTime = System.nanoTime();
     38                return endTime - startTime;
     39        }
     40
    2641        public static void main(String[] args) {
    2742                int times = 1;
     
    3449                }
    3550
    36                 for (int count = 0 ; count < times ; ++count) {
    37                         try {
    38                                 unwind_other(total_frames);
    39                         } catch (EmptyException e) {
    40                                 // ...
    41                         } catch (NotRaisedException e) {
    42                                 // ...
    43                         }
    44                 }
     51                // Warm-Up:
     52                loop(1000, total_frames);
     53
     54                long time = loop(times, total_frames);
     55                System.out.println("Run-Time (ns): " + time);
    4556        }
    4657}
  • doc/theses/andrew_beach_MMath/code/cond-catch.cfa

    rcf444b6 r6ff08d8  
    11// Conditional Match (or Re-Raise)
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.h>
    46
     
    2325int main(int argc, char * argv[]) {
    2426        unsigned int times = 1;
    25         if (2 < argc) {
     27        if (1 < argc) {
    2628                times = strtol(argv[1], 0p, 10);
    2729        }
     30        if (2 < argc) {
     31                should_catch = strtol(argv[2], 0p, 10);
     32        }
    2833
     34        Time start_time = timeHiRes();
    2935        for (unsigned int count = 0 ; count < times ; ++count) {
    3036                try {
     
    3440                }
    3541        }
     42        Time end_time = timeHiRes();
     43        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    3644}
  • doc/theses/andrew_beach_MMath/code/cond-catch.cpp

    rcf444b6 r6ff08d8  
    11// Conditional Match (or Re-Raise)
     2#include <chrono>
     3#include <cstdlib>
    24#include <exception>
    3 #include <cstdlib>
     5#include <iostream>
     6
     7using namespace std::chrono;
    48
    59struct EmptyException : public std::exception {};
     
    2327int main(int argc, char * argv[]) {
    2428        unsigned int times = 1;
    25         unsigned int total_frames = 1;
    26         if (2 < argc) {
     29        if (1 < argc) {
    2730                times = strtol(argv[1], nullptr, 10);
    2831        }
    29         if (3 < argc) {
    30                 total_frames = strtol(argv[2], nullptr, 10);
     32        if (2 < argc) {
     33                should_catch = strtol(argv[2], nullptr, 10);
    3134        }
    3235
     36        time_point<steady_clock> start_time = steady_clock::now();
    3337    for (unsigned int count = 0 ; count < times ; ++count) {
    3438        try {
     
    3842                }
    3943    }
     44        time_point<steady_clock> end_time = steady_clock::now();
     45        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     46        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    4047}
  • doc/theses/andrew_beach_MMath/code/cond-fixup.cfa

    rcf444b6 r6ff08d8  
    11// Conditional Match (or Re-Raise)
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2325int main(int argc, char * argv[]) {
    2426        unsigned int times = 1;
    25         unsigned int total_frames = 1;
    26         if (2 < argc) {
     27        if (1 < argc) {
    2728                times = strtol(argv[1], 0p, 10);
    2829        }
    29         if (3 < argc) {
    30                 total_frames = strtol(argv[2], 0p, 10);
     30        if (2 < argc) {
     31                should_catch = strtol(argv[2], 0p, 10);
    3132        }
    3233
     34        Time start_time = timeHiRes();
    3335        for (unsigned int count = 0 ; count < times ; ++count) {
    3436                try {
     
    3840                }
    3941        }
     42        Time end_time = timeHiRes();
     43        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    4044}
  • doc/theses/andrew_beach_MMath/code/cross-catch.cfa

    rcf444b6 r6ff08d8  
    11// Cross a Try Statement with a Termination Handler
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    810        unsigned int times = 1;
    911        unsigned int total_frames = 1;
    10         if (2 < argc) {
     12        if (1 < argc) {
    1113                times = strtol(argv[1], 0p, 10);
    1214        }
    13         if (3 < argc) {
     15        if (2 < argc) {
    1416                total_frames = strtol(argv[2], 0p, 10);
    1517        }
    1618
     19        Time start_time = timeHiRes();
    1720        for (unsigned int count = 0 ; count < times ; ++count) {
    1821                try {
     
    2225                }
    2326        }
     27        Time end_time = timeHiRes();
     28        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    2429}
  • doc/theses/andrew_beach_MMath/code/cross-catch.cpp

    rcf444b6 r6ff08d8  
    11// Cross a Try Statement with a Termination Handler
     2#include <chrono>
     3#include <cstdlib>
    24#include <exception>
    3 #include <cstdlib>
     5#include <iostream>
     6
     7using namespace std::chrono;
    48
    59struct NotRaisedException : public std::exception {};
     
    711int main(int argc, char * argv[]) {
    812        unsigned int times = 1;
    9         if (2 < argc) {
     13        if (1 < argc) {
    1014                times = strtol(argv[1], nullptr, 10);
    1115        }
    1216
     17        time_point<steady_clock> start_time = steady_clock::now();
    1318        for (unsigned int count = 0 ; count < times ; ++count) {
    1419                try {
     
    1823                }
    1924        }
     25        time_point<steady_clock> end_time = steady_clock::now();
     26        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     27        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    2028}
  • doc/theses/andrew_beach_MMath/code/cross-finally.cfa

    rcf444b6 r6ff08d8  
    11// Cross a Try Statement With Finally Clause
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    68        unsigned int times = 1;
    79        unsigned int total_frames = 1;
    8         if (2 < argc) {
     10        if (1 < argc) {
    911                times = strtol(argv[1], 0p, 10);
    1012        }
    11         if (3 < argc) {
     13        if (2 < argc) {
    1214                total_frames = strtol(argv[2], 0p, 10);
    1315        }
    1416
     17        Time start_time = timeHiRes();
    1518        for (unsigned int count = 0 ; count < times ; ++count) {
    1619                 try {
     
    2023                }
    2124        }
     25        Time end_time = timeHiRes();
     26        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    2227}
  • doc/theses/andrew_beach_MMath/code/cross-resume.cfa

    rcf444b6 r6ff08d8  
    11// Cross a Try Statement With Finally Clause
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    810        unsigned int times = 1;
    911        unsigned int total_frames = 1;
    10         if (2 < argc) {
     12        if (1 < argc) {
    1113                times = strtol(argv[1], 0p, 10);
    1214        }
    13         if (3 < argc) {
     15        if (2 < argc) {
    1416                total_frames = strtol(argv[2], 0p, 10);
    1517        }
    1618
     19        Time start_time = timeHiRes();
    1720        for (unsigned int count = 0 ; count < times ; ++count) {
    1821                try {
     
    2225                }
    2326        }
     27        Time end_time = timeHiRes();
     28        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    2429}
  • doc/theses/andrew_beach_MMath/code/resume-detor.cfa

    rcf444b6 r6ff08d8  
    11// Throw Across Destructor
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2628        unsigned int times = 1;
    2729        unsigned int total_frames = 1;
    28         if (2 < argc) {
     30        if (1 < argc) {
    2931                times = strtol(argv[1], 0p, 10);
    3032        }
    31         if (3 < argc) {
     33        if (2 < argc) {
    3234                total_frames = strtol(argv[2], 0p, 10);
    3335        }
    3436
     37        Time start_time = timeHiRes();
    3538    for (int count = 0 ; count < times ; ++count) {
    3639        try {
     
    4043        }
    4144    }
     45        Time end_time = timeHiRes();
     46        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    4247}
  • doc/theses/andrew_beach_MMath/code/resume-empty.cfa

    rcf444b6 r6ff08d8  
    11// Resume Across Empty Function
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    911void unwind_empty(unsigned int frames) {
    1012        if (frames) {
    11 
    1213                unwind_empty(frames - 1);
    1314        } else {
     
    1920        unsigned int times = 1;
    2021        unsigned int total_frames = 1;
    21         if (2 < argc) {
     22        if (1 < argc) {
    2223                times = strtol(argv[1], 0p, 10);
    2324        }
    24         if (3 < argc) {
     25        if (2 < argc) {
    2526                total_frames = strtol(argv[2], 0p, 10);
    2627        }
    2728
     29        Time start_time = timeHiRes();
    2830        for (int count = 0 ; count < times ; ++count) {
    2931                try {
     
    3335                }
    3436        }
     37        Time end_time = timeHiRes();
     38        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    3539}
  • doc/theses/andrew_beach_MMath/code/resume-finally.cfa

    rcf444b6 r6ff08d8  
    11// Throw Across Finally
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2224        unsigned int times = 1;
    2325        unsigned int total_frames = 1;
    24         if (2 < argc) {
     26        if (1 < argc) {
    2527                times = strtol(argv[1], 0p, 10);
    2628        }
    27         if (3 < argc) {
     29        if (2 < argc) {
    2830                total_frames = strtol(argv[2], 0p, 10);
    2931        }
    3032
     33        Time start_time = timeHiRes();
    3134        for (int count = 0 ; count < times ; ++count) {
    3235                try {
     
    3639                }
    3740        }
     41        Time end_time = timeHiRes();
     42        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    3843}
  • doc/theses/andrew_beach_MMath/code/resume-other.cfa

    rcf444b6 r6ff08d8  
    11// Resume Across Other Handler
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2426        unsigned int times = 1;
    2527        unsigned int total_frames = 1;
    26         if (2 < argc) {
     28        if (1 < argc) {
    2729                times = strtol(argv[1], 0p, 10);
    2830        }
    29         if (3 < argc) {
     31        if (2 < argc) {
    3032                total_frames = strtol(argv[2], 0p, 10);
    3133        }
    3234
     35        Time start_time = timeHiRes();
    3336        for (int count = 0 ; count < times ; ++count) {
    3437                try {
     
    3841                }
    3942        }
     43        Time end_time = timeHiRes();
     44        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    4045}
  • doc/theses/andrew_beach_MMath/code/throw-detor.cfa

    rcf444b6 r6ff08d8  
    11// Throw Across Destructor
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2527        unsigned int times = 1;
    2628        unsigned int total_frames = 1;
    27         if (2 < argc) {
     29        if (1 < argc) {
    2830                times = strtol(argv[1], 0p, 10);
    2931        }
    30         if (3 < argc) {
     32        if (2 < argc) {
    3133                total_frames = strtol(argv[2], 0p, 10);
    3234        }
    3335
     36        Time start_time = timeHiRes();
    3437        for (int count = 0 ; count < times ; ++count) {
    3538                try {
     
    3942                }
    4043        }
     44        Time end_time = timeHiRes();
     45        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    4146}
  • doc/theses/andrew_beach_MMath/code/throw-detor.cpp

    rcf444b6 r6ff08d8  
    11// Throw Across Destructor
     2#include <chrono>
     3#include <cstdlib>
    24#include <exception>
    3 #include <cstdlib>
     5#include <iostream>
     6
     7using namespace std::chrono;
    48
    59struct EmptyException : public std::exception {};
     
    2125        unsigned int times = 1;
    2226        unsigned int total_frames = 1;
    23         if (2 < argc) {
     27        if (1 < argc) {
    2428                times = strtol(argv[1], nullptr, 10);
    2529        }
    26         if (3 < argc) {
     30        if (2 < argc) {
    2731                total_frames = strtol(argv[2], nullptr, 10);
    2832        }
    2933
     34        time_point<steady_clock> start_time = steady_clock::now();
    3035        for (int count = 0 ; count < times ; ++count) {
    3136                try {
     
    3540                }
    3641        }
     42        time_point<steady_clock> end_time = steady_clock::now();
     43        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     44        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    3745}
  • doc/theses/andrew_beach_MMath/code/throw-empty.cfa

    rcf444b6 r6ff08d8  
    11// Throw Across Empty Function
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    1820        unsigned int times = 1;
    1921        unsigned int total_frames = 1;
    20         if (2 < argc) {
     22        if (1 < argc) {
    2123                times = strtol(argv[1], 0p, 10);
    2224        }
    23         if (3 < argc) {
     25        if (2 < argc) {
    2426                total_frames = strtol(argv[2], 0p, 10);
    2527        }
    2628
     29        Time start_time = timeHiRes();
    2730        for (unsigned int count = 0 ; count < times ; ++count) {
    2831                try {
     
    3235                }
    3336        }
     37        Time end_time = timeHiRes();
     38        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    3439}
  • doc/theses/andrew_beach_MMath/code/throw-empty.cpp

    rcf444b6 r6ff08d8  
    11// Throw Across Empty Function
     2#include <chrono>
     3#include <cstdlib>
    24#include <exception>
    3 #include <cstdlib>
     5#include <iostream>
     6
     7using namespace std::chrono;
    48
    59struct EmptyException : public std::exception {};
     
    1620        unsigned int times = 1;
    1721        unsigned int total_frames = 1;
    18         if (2 < argc) {
     22        if (1 < argc) {
    1923                times = strtol(argv[1], nullptr, 10);
    2024        }
    21         if (3 < argc) {
     25        if (2 < argc) {
    2226                total_frames = strtol(argv[2], nullptr, 10);
    2327        }
    2428
     29        time_point<steady_clock> start_time = steady_clock::now();
    2530        for (unsigned int count = 0 ; count < times ; ++count) {
    2631                try {
     
    3035                }
    3136        }
     37        time_point<steady_clock> end_time = steady_clock::now();
     38        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     39        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    3240}
  • doc/theses/andrew_beach_MMath/code/throw-finally.cfa

    rcf444b6 r6ff08d8  
    11// Throw Across Finally
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2224        unsigned int times = 1;
    2325        unsigned int total_frames = 1;
    24         if (2 < argc) {
     26        if (1 < argc) {
    2527                times = strtol(argv[1], 0p, 10);
    2628        }
    27         if (3 < argc) {
     29        if (2 < argc) {
    2830                total_frames = strtol(argv[2], 0p, 10);
    2931        }
    3032
     33        Time start_time = timeHiRes();
    3134        for (int count = 0 ; count < times ; ++count) {
    3235                try {
     
    3639                }
    3740        }
     41        Time end_time = timeHiRes();
     42        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    3843}
  • doc/theses/andrew_beach_MMath/code/throw-other.cfa

    rcf444b6 r6ff08d8  
    11// Throw Across Other Handler
     2#include <clock.hfa>
    23#include <exception.hfa>
     4#include <fstream.hfa>
    35#include <stdlib.hfa>
    46
     
    2426        unsigned int times = 1;
    2527        unsigned int total_frames = 1;
    26         if (2 < argc) {
     28        if (1 < argc) {
    2729                times = strtol(argv[1], 0p, 10);
    2830        }
    29         if (3 < argc) {
     31        if (2 < argc) {
    3032                total_frames = strtol(argv[2], 0p, 10);
    3133        }
    3234
     35        Time start_time = timeHiRes();
    3336        for (int count = 0 ; count < times ; ++count) {
    3437                try {
     
    3841                }
    3942        }
     43        Time end_time = timeHiRes();
     44        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
    4045}
  • doc/theses/andrew_beach_MMath/code/throw-other.cpp

    rcf444b6 r6ff08d8  
    11// Throw Across Other Handler
     2#include <chrono>
     3#include <cstdlib>
    24#include <exception>
    3 #include <cstdlib>
     5#include <iostream>
     6
     7using namespace std::chrono;
    48
    59struct EmptyException : public std::exception {};
     
    2226        unsigned int times = 1;
    2327        unsigned int total_frames = 1;
    24         if (2 < argc) {
     28        if (1 < argc) {
    2529                times = strtol(argv[1], nullptr, 10);
    2630        }
    27         if (3 < argc) {
     31        if (2 < argc) {
    2832                total_frames = strtol(argv[2], nullptr, 10);
    2933        }
    3034
     35        time_point<steady_clock> start_time = steady_clock::now();
    3136        for (int count = 0 ; count < times ; ++count) {
    3237                try {
     
    3641                }
    3742        }
     43        time_point<steady_clock> end_time = steady_clock::now();
     44        nanoseconds duration = duration_cast<nanoseconds>(end_time - start_time);
     45        std::cout << "Run-Time (ns): " << duration.count() << std::endl;
    3846}
Note: See TracChangeset for help on using the changeset viewer.