When working on improving existing code, there is always the question of how to measure results. There are numerous ways to do this, for example, visually assessing improvements, getting feedback from users, using the code profiler and/or trace parser, and various other methods.
In this recipe, we will discuss how to measure the code execution time using a very simple method, just by temporarily adding a few lines of code. In this way, the execution time of the old code can be compared with that of the new one in order to show whether any improvements were made.
- In the solution, add a new runnable class and write the following code snippet:
class PktGetExecutaiontime { /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { int start...