|
1 // Copyright (c) 2006-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 the License "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 // Functions for test and analysis of demand paging. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @publishedPartner |
|
22 @publishedPartner |
|
23 @test |
|
24 */ |
|
25 class DPTest |
|
26 { |
|
27 public: |
|
28 /** |
|
29 The attributes of the demand paging system. |
|
30 */ |
|
31 enum TAttributes |
|
32 { |
|
33 /** |
|
34 The ROM is being demand paged. |
|
35 */ |
|
36 ERomPaging = 1<<0, |
|
37 |
|
38 /** |
|
39 Individual executable files can be demand paged. |
|
40 */ |
|
41 ECodePaging = 1<<1, |
|
42 |
|
43 /** |
|
44 User RAM can be demand paged. |
|
45 */ |
|
46 EDataPaging = 1<<2 |
|
47 }; |
|
48 |
|
49 /** |
|
50 Return the attributes of the demand paging system. |
|
51 This is a bitfield consisting of values from enum TAttributes |
|
52 */ |
|
53 IMPORT_C static TUint32 Attributes(); |
|
54 |
|
55 /** |
|
56 Evict the contents of the virtual memory cache and reduce it to its minimum size. |
|
57 |
|
58 @return KErrNone, if successful; otherwise one of the other system wide error codes. |
|
59 |
|
60 @capability WriteDeviceData |
|
61 */ |
|
62 IMPORT_C static TInt FlushCache(); |
|
63 |
|
64 /** |
|
65 Change the minimum and maximum RAM sizes used for the virtual memory cache. |
|
66 |
|
67 These values may be silently restricted to platforn specific limits. |
|
68 If required, GetCacheSize can be used to verify sizes actually applied to the system. |
|
69 |
|
70 If there is not enough memory to set the specified cache size then KErrNoMemory is |
|
71 returned, however the cache size may still have been modified in an attempt to |
|
72 service the request. |
|
73 |
|
74 @param aMinSize Minimum size for cache in bytes. |
|
75 @param aMaxSize Maximum size for cache in bytes. |
|
76 Using zero for this value will restore cache sizes to the |
|
77 initial values used after boot. |
|
78 |
|
79 @return KErrNone, if successful; |
|
80 KErrNoMemory if the is not enough memory; |
|
81 KErrArgument if aMinSize>aMaxSize |
|
82 otherwise one of the other system wide error codes. |
|
83 |
|
84 @capability WriteDeviceData |
|
85 */ |
|
86 IMPORT_C static TInt SetCacheSize(TUint aMinSize,TUint aMaxSize); |
|
87 |
|
88 /** |
|
89 Get the current values of the RAM sizes used for the virtual memory cache. |
|
90 |
|
91 @param[out] aMinSize Minimum size for cache in bytes. |
|
92 @param[out] aMaxSize Maximum size for cache in bytes. |
|
93 @param[out] aCurrentSize The current size for cache in bytes. |
|
94 This may be greater than aMaxSize. |
|
95 |
|
96 @return KErrNone, if successful; otherwise one of the other system wide error codes. |
|
97 */ |
|
98 IMPORT_C static TInt CacheSize(TUint& aMinSize,TUint& aMaxSize,TUint& aCurrentSize); |
|
99 |
|
100 /** |
|
101 Paging event information. |
|
102 */ |
|
103 struct TEventInfo |
|
104 { |
|
105 /** |
|
106 The total number of page faults which have occurred. |
|
107 */ |
|
108 TUint64 iPageFaultCount; |
|
109 |
|
110 /** |
|
111 The total number of page faults which resulted in reading a page |
|
112 from storage media. |
|
113 */ |
|
114 TUint64 iPageInReadCount; |
|
115 }; |
|
116 |
|
117 /** |
|
118 Get paging event information. |
|
119 |
|
120 @param[out] aInfo A descriptor to hold the returned information. |
|
121 The contents of the descriptor are in the form of a #TEventInfo object. |
|
122 |
|
123 @return KErrNone, if successful; otherwise one of the other system wide error codes. |
|
124 */ |
|
125 IMPORT_C static TInt EventInfo(TDes8& aInfo); |
|
126 }; |
|
127 |
|
128 |