phonebookengines/VirtualPhonebook/inc/VPbkProfile.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  VirtualPhonebook profiling support.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VPBKPROFILE_H
       
    20 #define VPBKPROFILE_H
       
    21 
       
    22 #include <e32def.h>
       
    23 #include <e32std.h>
       
    24 #include "VPbkConfig.hrh"
       
    25 
       
    26 /**
       
    27  * VirtualPhonebook profiling implementation.
       
    28  *
       
    29  */
       
    30 #ifdef VPBK_ENABLE_PROFILE
       
    31 
       
    32     /* profiling implementation */
       
    33     #define VPBK_PROFILE_START(aBin) \
       
    34         VPbkProfile::TVPbkProfiling::GlobalL()->StartProfile(aBin);
       
    35 
       
    36     #define VPBK_PROFILE_END(aBin) \
       
    37         VPbkProfile::TVPbkProfiling::GlobalL()->EndProfile(aBin);
       
    38 
       
    39     /// Needs VPBK_ENABLE_DEBUG_LOGGER
       
    40     #define VPBK_PROFILE_DISPLAY(aBin)
       
    41     #define VPBK_PROFILE_RESET(aBin)
       
    42     #define VPBK_PROFILE_DELETE() \
       
    43         delete VPbkProfile::TVPbkProfiling::GlobalL()
       
    44 
       
    45 #else // VPBK_ENABLE_PROFILE
       
    46 
       
    47     /* Profiling not enabled - empty implementation */
       
    48     #define VPBK_PROFILE_START(aBin)
       
    49     #define VPBK_PROFILE_END(aBin)
       
    50     #define VPBK_PROFILE_DISPLAY(aBin)
       
    51     #define VPBK_PROFILE_RESET(aBin)
       
    52     #define VPBK_PROFILE_DELETE()
       
    53 
       
    54 #endif // VPBK_ENABLE_PROFILE
       
    55 
       
    56 
       
    57 namespace VPbkProfile {
       
    58 
       
    59     // CONSTANTS
       
    60     enum TVPbkProfileBin
       
    61         {       
       
    62         /////////////////////////////////////////////////////////////////////
       
    63         // Composite view's mapping
       
    64         /////////////////////////////////////////////////////////////////////
       
    65         ECompositeContactViewMapping = 1,        
       
    66         
       
    67         EOrderedCompositeViewMapping,// = 2,
       
    68                                 
       
    69         ESortedCompositeViewMapping,// = 3        
       
    70         
       
    71         EFilteredSortedCompositeViewMapping, // = 4     
       
    72         
       
    73         /////////////////////////////////////////////////////////////////////
       
    74         // Finds
       
    75         /////////////////////////////////////////////////////////////////////
       
    76         ECntModelFind,// = 5
       
    77         ECntModelRefine,// = 6
       
    78         ESimStoreFind,// = 7
       
    79         ESimStoreRefine,// = 8
       
    80                 
       
    81         EEndProfileBins = 9
       
    82         };
       
    83 
       
    84 
       
    85 /**
       
    86  * Utility class for VirtualPhonebook profiling.
       
    87  */
       
    88 class TVPbkProfiling
       
    89     {
       
    90     public: // Interface
       
    91 
       
    92         /**
       
    93          * Returns the global shared object of this class.
       
    94          * Creates the object if it does not exist.
       
    95          *
       
    96          * @return  Instance of this class.
       
    97          */
       
    98         IMPORT_C static TVPbkProfiling* GlobalL();
       
    99 
       
   100         /**
       
   101          * Destructor.
       
   102          */
       
   103         IMPORT_C ~TVPbkProfiling();
       
   104 
       
   105         /**
       
   106          * Starts profiling.
       
   107          *
       
   108          * @param aBin  Integer identifying the profile.
       
   109          */
       
   110         IMPORT_C void StartProfile(
       
   111                 TInt aBin );
       
   112 
       
   113         /**
       
   114          * Ends profiling.
       
   115          *
       
   116          * @param aBin  Integer identifying the profile.
       
   117          */
       
   118         IMPORT_C void EndProfile(
       
   119                 TInt aBin ) const;
       
   120 
       
   121     private: // Implementation
       
   122         TVPbkProfiling();
       
   123 
       
   124     private:
       
   125         /// Own: Flat C array
       
   126         TTime iProfileArray[EEndProfileBins];
       
   127     };
       
   128 
       
   129 }  // namespace VPbkProfile
       
   130 
       
   131 #endif // VPBKPROFILE_H
       
   132 
       
   133 // End of File