Improving performance with performance profiling

Now you will use information in the Performance Profile viewer to determine if you can improve performance in the UMTS base station code.

To locate and improve performance issues:

  1. Select the Performance Profile tab.

  2. Within the table, left-click the column title Function Time in order to sort the table by this column.

For this exercise you have sorted by the Function Time - that is, you're looking at functions that take the longest time, overall, to execute. This is isn't the only potential type of bottleneck in an application - for example, perhaps it is the number of times one function calls its descendants that is the problem - but for this exercise, you will look here.

As the developer of this UMTS base station, you would know that the method read_string() takes a fair amount of time to execute - so you won't look here first (although feel free to have a look if you wish). Instead look at the second function in the table.

  1. Select the link for the method checkLog().

A quick look at the source code shows you that the developer has added an inexplicable loop - perhaps a dummy function to act as a "time-waster". Simply comment out the line.

  1. Change the code from

 for (x=1,y=100000;x<=100000;x++) y=y/x;

to

 // for (x=1,y=100000;x<=100000;x++) y=y/x;

  1. Select the menu item File->Save.

  2. Right-click the tab for the source file you have just modified and select Close.

 

You have now eliminated a loop that was adding significant execution time to the checkLog() method.