|
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 // ost Performance Tests ost Call. |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file te_perftracetester.cpp |
|
21 @internalTechnology |
|
22 @prototype |
|
23 */ |
|
24 |
|
25 |
|
26 #include <opensystemtrace.h> |
|
27 #ifndef __KERNEL_MODE__ |
|
28 #include <e32base.h> //for cleanupstack |
|
29 #endif |
|
30 #include "te_perftracetester.h" |
|
31 #include "te_instrumentationpoints.h" |
|
32 #include "te_perfcacheflush.h" |
|
33 #include "te_d32perfdrv.h" |
|
34 #include "timer/te_perfusertimer.h" |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 TInt TUptTraceTester::SendTraceL(const TApiRunConfig& aApiRunConfig, TApiRunResults& aApiRunResults) //pass the configuration here |
|
40 { |
|
41 TInt error = KErrNone; |
|
42 if(TUptTraceCalls::IsKernelTrace(aApiRunConfig.iApiId)) |
|
43 { |
|
44 #ifndef __KERNEL_MODE__ |
|
45 RUptUTrace utracedriver; |
|
46 //update with test on whether compiled of not!! |
|
47 error = utracedriver.Open(); |
|
48 if(!error) |
|
49 { |
|
50 error = utracedriver.TestUptUtrace(aApiRunConfig, aApiRunResults); |
|
51 } |
|
52 utracedriver.Close(); |
|
53 #endif |
|
54 } |
|
55 else |
|
56 { |
|
57 //it's a user side trace, call it directly |
|
58 error = TUptTraceCalls::DoSendTraceL(aApiRunConfig, aApiRunResults); |
|
59 } |
|
60 return error; |
|
61 } |
|
62 |
|
63 TInt TUptTraceTester::TimeTraceL(const TApiRunConfig& aApiRunConfig, TApiRunResults& aApiRunResults) //pass the configuration here |
|
64 { |
|
65 TInt error = KErrNone; |
|
66 TUint32 callResults[KNumberOfTraceCallIterations]; |
|
67 for(TInt i = 0; i < KNumberOfTraceCallIterations; i++) |
|
68 { |
|
69 error = TimeTraceCall(aApiRunConfig, aApiRunResults); |
|
70 callResults[i] = aApiRunResults.iApiTraceTime; |
|
71 } |
|
72 TUint32 total = 0; |
|
73 for(TInt i = 0; i < KNumberOfTraceCallIterations; i++) |
|
74 total += callResults[i]; |
|
75 aApiRunResults.iApiTraceTime = total / KNumberOfTraceCallIterations; //average |
|
76 return error; |
|
77 } |
|
78 |
|
79 TInt TUptTraceTester::TimeTraceCall(const TApiRunConfig& aApiRunConfig, TApiRunResults& aApiRunResults) |
|
80 { |
|
81 TInt error = KErrNone; |
|
82 if(TUptTraceCalls::IsKernelTrace(aApiRunConfig.iApiId)) |
|
83 { |
|
84 RUptUTrace utracedriver; |
|
85 error = utracedriver.Open(); |
|
86 if(!error) |
|
87 { |
|
88 error = utracedriver.TimeUptUtrace(aApiRunConfig, aApiRunResults); |
|
89 } |
|
90 utracedriver.Close(); |
|
91 } |
|
92 else |
|
93 { |
|
94 error = TimeUsersideTraceCalls(aApiRunConfig, aApiRunResults); |
|
95 } |
|
96 |
|
97 return error; |
|
98 } |
|
99 |
|
100 TInt TUptTraceTester::TimeUsersideTraceCalls(const TApiRunConfig& aApiRunConfig, TApiRunResults& aApiRunResults) //pass the configuration here |
|
101 { |
|
102 aApiRunResults.iTimeCount = 0; |
|
103 CUptTimer timer; |
|
104 TInt error = timer.StartBackgroundTimer(); |
|
105 if(!error) |
|
106 { |
|
107 while(!timer.IsTimerExpired()) |
|
108 { |
|
109 if(aApiRunConfig.iDoFlush) //i.e. if we want the non-cache results |
|
110 Te_Flush_The_Cache(); //ignoring error? //will be KErrNotSupported for winscw in any case |
|
111 error = TUptTraceTester::SendTraceL(aApiRunConfig, aApiRunResults); |
|
112 |
|
113 timer.IncreaseCount(); |
|
114 } |
|
115 aApiRunResults.iApiTraceTime = timer.FinalTime(); |
|
116 aApiRunResults.iTimeCount = timer.FinalCount(); |
|
117 } |
|
118 |
|
119 return error; |
|
120 } |
|
121 |
|
122 |
|
123 TInt TUptTraceTester::GenerateEvpDataField(const TInt aDataSize, TInt8* aData) |
|
124 { |
|
125 TInt err=KErrNone; |
|
126 |
|
127 for(TInt i=0;i<aDataSize/8;i++) |
|
128 { |
|
129 *aData=0x00; |
|
130 aData++; |
|
131 } |
|
132 for(TInt i=0;i<aDataSize/8;i++) |
|
133 aData--; |
|
134 return err; |
|
135 } |
|
136 |
|
137 |
|
138 //eof |