kerneltest/e32utils/demandpaging/dptest.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 //
       
    15 
       
    16 #include <e32svr.h>
       
    17 #include <u32hal.h>
       
    18 #include "u32std.h"
       
    19 #include "dptest.h"
       
    20 
       
    21 EXPORT_C TUint32 DPTest::Attributes()
       
    22 	{
       
    23 	TUint32 mma = (TUint32)UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL);
       
    24 	TUint32 attr = 0;
       
    25 	if(mma&EMemModelAttrRomPaging)
       
    26 		attr |= ERomPaging;
       
    27 	if(mma&EMemModelAttrCodePaging)
       
    28 		attr |= ECodePaging;
       
    29 	if(mma&EMemModelAttrDataPaging)
       
    30 		attr |= EDataPaging;
       
    31 	return attr;
       
    32 	}
       
    33 
       
    34 
       
    35 EXPORT_C TInt DPTest::FlushCache()
       
    36 	{
       
    37 	return UserSvr::HalFunction(EHalGroupVM,EVMHalFlushCache,0,0);
       
    38 	}
       
    39 
       
    40 EXPORT_C TInt DPTest::SetCacheSize(TUint aMinSize,TUint aMaxSize)
       
    41 	{
       
    42 	return UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)aMinSize,(TAny*)aMaxSize);
       
    43 	}
       
    44 
       
    45 EXPORT_C TInt DPTest::CacheSize(TUint& aMinSize,TUint& aMaxSize,TUint& aCurrentSize)
       
    46 	{
       
    47 	SVMCacheInfo info;
       
    48 	TInt r = UserSvr::HalFunction(EHalGroupVM,EVMHalGetCacheSize,&info,0);
       
    49 	if(r!=KErrNone)
       
    50 		return r;
       
    51 	aMinSize = info.iMinSize;
       
    52 	aMaxSize = info.iMaxSize;
       
    53 	aCurrentSize = info.iCurrentSize;
       
    54 	return KErrNone;
       
    55 	}
       
    56 
       
    57 EXPORT_C TInt DPTest::EventInfo(TDes8& aInfo)
       
    58 	{
       
    59 	TPckgBuf<TEventInfo> infoBuf;
       
    60 	TInt r = UserSvr::HalFunction(EHalGroupVM,EVMHalGetEventInfo,&infoBuf,0);
       
    61 	if(r!=KErrNone)
       
    62 		return r;
       
    63 	TEventInfo info;
       
    64 	info.iPageFaultCount = infoBuf().iPageFaultCount;
       
    65 	info.iPageInReadCount = infoBuf().iPageInReadCount;
       
    66 	TUint len = aInfo.MaxLength();
       
    67 	aInfo.FillZ(len);
       
    68 	if(len>sizeof(info))
       
    69 		len = sizeof(info);
       
    70 	aInfo.Copy((TUint8*)&info,len);
       
    71 	return KErrNone;
       
    72 	}