Persistence Rules | Client Performance Guide | Performance API

Performance API

The Performance API provides methods to run benchmarks for different methods. The benchmark in a method is started with the PerformanceLog.methodStarted(Object object) method. To end the benchmark use the PerformanceLog.methodFinished(Object object, String name) method and to finally output the string use the PerformanceLog.print(); method.

Example:

     Object perfLogTag = PerformanceLog.methodStarted(this);
     // Coding
     .
     .
     PerformanceLog.methodFinished(perfLogTag, "Performance trace for method myPackage.deleteEntry");
     PerformanceLog.print();
   

To enable the performance tracing in the MI, you have to set the performance trace property to true. The properties are set in the <ME_Home>/settings/MobileEngine.config file.

Example:

	 MobileEngine.Trace.PerformanceLog.Enabled=true

You have to restart the MI so that the changes in the MobileEngine.config file take effect.

When the performance log is enabled, the <ME_Home>/log/performance.log file is created. Whenever your application calls the PerformanceLog calls, an entry in the <ME_Home>/log/performance.log file is generated. The <ME_Home>/log/performance.log file has following content:

  # time=Thu Dec 11 09:43:31 CET 2003
  #
  #Line: total(netto) #     delta( used) # class@name
  #======================================================
      0:
      1:
      2:        0( 0) #     48( 1741552) # 1(0) null@FileTransactionManager.register(EntityFactory)
      3:      80( 80) # 169144( 1488584) # 0(0) persistenceexample3.PersistenceExample@init()
      4:
      5:
      6:        0( 0) #   8136( 1414456) # 5(4) com.sap.ip.me.persist.newfileio.ObjectTable@search(.....
      7:        0( 0) #  39640( 1470728) # 8(7) com.sap.ip.me.persist.newfileio.ObjectTable@sort values
      8:      10( 10) #  48760( 1472976) # 7(6) com.sap.ip.me.persist.newfileio.ObjectTable@sort values by orders
      9:        0( 0) #    112( 1475424) # 9(6) com.sap.ip.me.persist.newfileio.ObjectTable@get sorted values
     10:       10( 0) #  60768( 1477680) # 6(4) com.sap.ip.me.persist.newfileio.ObjectTable@get(.....
     11:       10( 0) #  83664( 1489872) # 4(3) com.sap.ip.me.persist.newfileio.ObjectTable@get(final Query query0)
     12:       10( 0) #  86072( 1492208) # 3(2) null@FileTransactionManager.get(Query, TreeOptionType)
     13:      30( 20) # -73656( 1506776) # 2(1) persistenceexample3.PersistenceExample@doHandleEvent:
     14:      50( 50) # 393712( 1902768) # 10(1) persistenceexample3.PersistenceExample@/jsp/menu.jsp
     15:       80( 0) # 350792( 1906416) # 1(0) persistenceexample3.PersistenceExample@doGet
     16:       80( 0) # 357048( 1908600) # 0(0) persistenceexample3.PersistenceExample@service()
 

Decription of the columns:

total Time consumed in milliseconds. The calculated time includes the execution of all methods also displayed in the performance log file.
(netto) Time consumed in milliseconds without the time consumed by the call of other methods.
delta Memory consumption in Bytes that have been used (or released when i is a negative value) between the call of the PerformanceLog.methodStarted(Object object) method and the PerformanceLog.methodFinished(Object object, String name).
used Actual memory in use, in Bytes.
class Classes that have called the PerformanceLog.
name String that has been passed on to the method PerformanceLog.methodFinished(Object object, String name).