equal
deleted
inserted
replaced
28 _LIT(KGoomAsyncWaitThreadName,"goom_asy"); |
28 _LIT(KGoomAsyncWaitThreadName,"goom_asy"); |
29 |
29 |
30 NONSHARABLE_CLASS(CGoomThresholdCrossed): public CActive |
30 NONSHARABLE_CLASS(CGoomThresholdCrossed): public CActive |
31 { |
31 { |
32 public: |
32 public: |
33 CGoomThresholdCrossed(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold) |
33 CGoomThresholdCrossed(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold, TInt aTotalMem) |
34 :CActive(CActive::EPriorityHigh), |
34 :CActive(CActive::EPriorityHigh), |
35 iMarkerState(KErrNotFound), |
35 iMarkerState(KErrNotFound), |
36 iActiveThreshold(aThreshold), |
36 iActiveThreshold(aThreshold), |
37 iAction(aAction), |
37 iAction(aAction), |
38 iThread(RThread().Id()), |
38 iThread(RThread().Id()), |
39 iMonitor(aMonitor) |
39 iMonitor(aMonitor), |
|
40 iTotalMem(aTotalMem) |
40 { |
41 { |
41 FUNC_LOG; |
42 FUNC_LOG; |
42 CActiveScheduler::Add(this); |
43 CActiveScheduler::Add(this); |
43 iSema.CreateLocal(); |
44 iSema.CreateLocal(); |
44 iStop.CreateLocal(); |
45 iStop.CreateLocal(); |
143 |
144 |
144 while(!iCancelled) |
145 while(!iCancelled) |
145 { |
146 { |
146 iStop.Wait(); |
147 iStop.Wait(); |
147 iStop.Signal(); |
148 iStop.Signal(); |
148 TUint usedThreshold = Min(iActiveThreshold,32*1024*1024) ; |
149 TUint usedThreshold = Min(iActiveThreshold,iTotalMem) ; |
149 TUint action = iAction; |
150 TUint action = iAction; |
150 const EGLint sync_attribs[] = |
151 const EGLint sync_attribs[] = |
151 { |
152 { |
152 EGL_SYNC_CONDITION_KHR, action, |
153 EGL_SYNC_CONDITION_KHR, action, |
153 EGL_PROF_MEMORY_USAGE_THRESHOLD_NOK, 32*1024*1024-usedThreshold, |
154 EGL_PROF_MEMORY_USAGE_THRESHOLD_NOK, iTotalMem-usedThreshold, |
154 EGL_NONE |
155 EGL_NONE |
155 }; |
156 }; |
156 |
157 |
157 /* Create a resource profiling sync */ |
158 /* Create a resource profiling sync */ |
158 iMarker = eglCreateSync_fptr(iDpy, |
159 iMarker = eglCreateSync_fptr(iDpy, |
281 CMemoryMonitor& iMonitor; |
282 CMemoryMonitor& iMonitor; |
282 TBuf<16> iThreadName; |
283 TBuf<16> iThreadName; |
283 EGLDisplay iDpy; |
284 EGLDisplay iDpy; |
284 TBool iPaused; |
285 TBool iPaused; |
285 RCriticalSection iStop; |
286 RCriticalSection iStop; |
|
287 TInt iTotalMem; |
286 }; |
288 }; |
287 |
289 |
288 // --------------------------------------------------------------------------- |
290 // --------------------------------------------------------------------------- |
289 // Entry point into the new thread |
291 // Entry point into the new thread |
290 // --------------------------------------------------------------------------- |
292 // --------------------------------------------------------------------------- |
304 |
306 |
305 delete trapCleanup; |
307 delete trapCleanup; |
306 return err; |
308 return err; |
307 } |
309 } |
308 |
310 |
309 CGoomThresholdCrossed* CreateThresholdCrossedThreadL(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold) |
311 CGoomThresholdCrossed* CreateThresholdCrossedThreadL(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold, TInt aTotalMem) |
310 { |
312 { |
311 FUNC_LOG; |
313 FUNC_LOG; |
312 CGoomThresholdCrossed* ao = new (ELeave) CGoomThresholdCrossed(aMonitor, aAction, aThreshold); |
314 CGoomThresholdCrossed* ao = new (ELeave) CGoomThresholdCrossed(aMonitor, aAction, aThreshold, aTotalMem); |
313 CleanupStack::PushL(ao); |
315 CleanupStack::PushL(ao); |
314 RThread syncThread; |
316 RThread syncThread; |
315 |
317 |
316 User::LeaveIfError(syncThread.Create( |
318 User::LeaveIfError(syncThread.Create( |
317 ao->ThreadName(), |
319 ao->ThreadName(), |