home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 720 / PDF090B4-SorceCode / pdf / profile.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  2.2 KB  |  115 lines

  1. // PROFILE.cpp
  2. //
  3. // Profiling functions for MARM
  4. //
  5. // Copyright (c) 1999 Sander van der Wal
  6. //
  7. // $Id: profile.cpp 1.1 2000-09-17 13:39:35+02 svdwal Exp svdwal $
  8.  
  9. #include "PROFILE.H"
  10.  
  11. #include <e32test.h>
  12.  
  13. #ifdef TRACE
  14.  
  15. static const char* const names[] = {
  16. #ifdef PROFILE_NAME_00
  17.       PROFILE_NAME_00
  18. #endif
  19. #ifdef PROFILE_NAME_01
  20.     , PROFILE_NAME_01
  21. #endif
  22. #ifdef PROFILE_NAME_02
  23.     , PROFILE_NAME_02
  24. #endif
  25. #ifdef PROFILE_NAME_03
  26.     , PROFILE_NAME_03
  27. #endif
  28. #ifdef PROFILE_NAME_04
  29.     , PROFILE_NAME_04
  30. #endif
  31. #ifdef PROFILE_NAME_05
  32.     , PROFILE_NAME_05
  33. #endif
  34. #ifdef PROFILE_NAME_06
  35.     , PROFILE_NAME_06
  36. #endif
  37. #ifdef PROFILE_NAME_07
  38.     , PROFILE_NAME_07
  39. #endif
  40. #ifdef PROFILE_NAME_08
  41.     , PROFILE_NAME_08
  42. #endif
  43. #ifdef PROFILE_NAME_09
  44.     , PROFILE_NAME_09
  45. #endif
  46. #ifdef PROFILE_NAME_10
  47.     , PROFILE_NAME_10
  48. #endif
  49. #ifdef PROFILE_NAME_11
  50.     , PROFILE_NAME_11
  51. #endif
  52. #ifdef PROFILE_NAME_12
  53.     , PROFILE_NAME_12
  54. #endif
  55. #ifdef PROFILE_NAME_13
  56.     , PROFILE_NAME_13
  57. #endif
  58. #ifdef PROFILE_NAME_14
  59.     , PROFILE_NAME_14
  60. #endif
  61. #ifdef PROFILE_NAME_15
  62.     , PROFILE_NAME_15
  63. #endif
  64. #ifdef PROFILE_NAME_16
  65.     , PROFILE_NAME_16
  66. #endif
  67. #ifdef PROFILE_NAME_17
  68.     , PROFILE_NAME_17
  69. #endif
  70. #ifdef PROFILE_NAME_18
  71.     , PROFILE_NAME_18
  72. #endif
  73. #ifdef PROFILE_NAME_19
  74.     , PROFILE_NAME_19
  75. #endif
  76. #ifdef PROFILE_NAME_20
  77.     , PROFILE_NAME_20
  78. #endif
  79. #ifdef PROFILE_NAME_21
  80.     , PROFILE_NAME_21
  81. #endif
  82. };
  83.  
  84.  
  85. //
  86. // get the results
  87. // This code does it one bin at a time, but you could get the whole lot as:
  88. // TProfile result[20];   RDebug::ProfileResult( &result, 0, 20 );
  89.  
  90. void __profile_dump()
  91. {
  92.   RTest test(_L("Profile of Pdf"));
  93.   
  94.   TProfile result; // iTime, iCount
  95.     TBuf<64> resultBuf;
  96.     
  97.   // Totals
  98.   test.Start(      _L("Name                           |       Time |      Count"));
  99.   resultBuf.Format(_L("-------------------------------|------------|-----------"));
  100.     test.Next(resultBuf);
  101.     
  102.   // Max 64 parts
  103.   for (TInt i = 0; i<= PROFILE_MAX; i++) {
  104.       RDebug::ProfileResult(&result, i, 1);
  105.       resultBuf.Format(_L("%-30s | % 10D | % 10D"), names[i], result.iTime, result.iCount);
  106.       test.Next(resultBuf);
  107.   }
  108.  
  109.   test.End();
  110.     test.Close();
  111. }
  112.  
  113.  
  114. #endif
  115.