77
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Main classes for Out of Memory Monitor.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "oomoutofmemorywatcher.h"
|
|
19 |
#include "oommemorymonitor.h"
|
|
20 |
#include "OomTraces.h"
|
|
21 |
#include <u32hal.h>
|
|
22 |
|
|
23 |
#include "diclog.h"
|
|
24 |
#include "globaldata.h"
|
|
25 |
|
|
26 |
COutOfMemoryWatcher* COutOfMemoryWatcher::NewL(CMemoryMonitor& aMonitor, TInt aLowRamThreshold, TInt aGoodRamThreshold, TBool aSwapUsageMonitored, TInt aLowSwapThreshold, TInt aGoodSwapThreshold)
|
|
27 |
{
|
|
28 |
FUNC_LOG;
|
|
29 |
|
|
30 |
COutOfMemoryWatcher* self = new (ELeave) COutOfMemoryWatcher(aMonitor, aSwapUsageMonitored);
|
|
31 |
CleanupStack::PushL(self);
|
|
32 |
self->ConstructL(aLowRamThreshold, aGoodRamThreshold, aLowSwapThreshold, aGoodSwapThreshold);
|
|
33 |
CleanupStack::Pop(self);
|
|
34 |
return self;
|
|
35 |
}
|
|
36 |
|
|
37 |
COutOfMemoryWatcher::~COutOfMemoryWatcher()
|
|
38 |
{
|
|
39 |
|
|
40 |
}
|
|
41 |
|
|
42 |
COutOfMemoryWatcher::COutOfMemoryWatcher(CMemoryMonitor& aMonitor, TBool aSwapUsageMonitored)
|
|
43 |
: CActive(CActive::EPriorityStandard),
|
|
44 |
iMemoryMonitor(aMonitor),
|
|
45 |
iSwapUsageMonitored(aSwapUsageMonitored)
|
|
46 |
{
|
|
47 |
|
|
48 |
}
|
|
49 |
|
|
50 |
void COutOfMemoryWatcher::ConstructL(TInt aLowRamThreshold, TInt aGoodRamThreshold, TInt aLowSwapThreshold, TInt aGoodSwapThreshold)
|
|
51 |
{
|
|
52 |
|
|
53 |
}
|
|
54 |
|
|
55 |
void COutOfMemoryWatcher::UpdateThresholds(TInt aLowRamThreshold, TInt aGoodRamThreshold, TInt aLowSwapThreshold, TInt aGoodSwapThreshold)
|
|
56 |
{
|
|
57 |
DicLog::WriteIntLog(TUid::Uid(0x0009),aLowRamThreshold);
|
|
58 |
DicLog::WriteIntLog(TUid::Uid(0x0010),aGoodRamThreshold);
|
|
59 |
DicLog::WriteIntLog(TUid::Uid(0x0011),aLowSwapThreshold);
|
|
60 |
DicLog::WriteIntLog(TUid::Uid(0x0012),aGoodSwapThreshold);
|
|
61 |
}
|
|
62 |
|
|
63 |
void COutOfMemoryWatcher::Start()
|
|
64 |
{
|
|
65 |
TBuf<KIntValue7> buf(KOutOfMemoryWatcherStart);
|
|
66 |
DicLog::WriteLog(TUid::Uid(0x0002), buf);
|
|
67 |
}
|
|
68 |
|
|
69 |
void COutOfMemoryWatcher::DoCancel()
|
|
70 |
{
|
|
71 |
|
|
72 |
}
|
|
73 |
|
|
74 |
void COutOfMemoryWatcher::RunL()
|
|
75 |
{
|
|
76 |
|
|
77 |
}
|