|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // UTrace Performance Tests Kernel-Side Timer. |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file te_uptkerneltimer.h |
|
21 @internalTechnology |
|
22 @prototype |
|
23 */ |
|
24 |
|
25 #ifndef TE_UPTKERNELTIMER_H_ |
|
26 #define TE_UPTKERNELTIMER_H_ |
|
27 |
|
28 #include <kern_priv.h> |
|
29 #include <kernel.h> |
|
30 #include <platform.h> |
|
31 |
|
32 class TKernelTimer |
|
33 { |
|
34 public: |
|
35 TKernelTimer(); |
|
36 ~TKernelTimer(); |
|
37 TInt StartBackgroundTimer(); |
|
38 TUint32 FinalTime(); |
|
39 TBool IsTimerExpired(){return iTimerExpired;}; |
|
40 void IncreaseCount(){iCount++;}; |
|
41 TUint32 FinalCount(){return iFinalCount;}; |
|
42 /** |
|
43 * This is used by the NTimer when the timer expires. |
|
44 */ |
|
45 static void FinishTiming(TKernelTimer* aSelf); |
|
46 private: |
|
47 void WaitForNextTick(); |
|
48 private: |
|
49 //This is all about the timer and timing a trace call... |
|
50 //should refactor into its own class, but it's so small so far it doesnt matter too much |
|
51 //This is used to set up a timer such that we can measure how long a trace call takes |
|
52 NTimer iTimer; |
|
53 //For the timer to work we need a volatile member that we can change the status of when the timer has expired |
|
54 volatile TBool iTimerExpired; |
|
55 //We count how many times we could make a call to trace before the timer expires |
|
56 volatile TUint32 iCount; |
|
57 //Because the iCount can be increased before we knew that the timer had expired we make sure |
|
58 //that we keep the last iCount as it was when the timer expired. So iFinalCount has the |
|
59 //exact count and iCount may have the corect count or may have been increased while the timer expired. |
|
60 TUint32 iFinalCount; |
|
61 }; |
|
62 |
|
63 |
|
64 |
|
65 #endif /*TE_UPTKERNELTIMER_H_*/ |
|
66 |
|
67 |