equal
deleted
inserted
replaced
178 |
178 |
179 #ifdef _DEBUG |
179 #ifdef _DEBUG |
180 iLogger = CGOomLogger::NewL(iWs, iFs); |
180 iLogger = CGOomLogger::NewL(iWs, iFs); |
181 #endif |
181 #endif |
182 |
182 |
|
183 GetFreeMemory(); //update the total memory |
|
184 |
183 // Get the thresholds based on the current foreground app and the config |
185 // Get the thresholds based on the current foreground app and the config |
184 RefreshThresholds(); |
186 RefreshThresholds(); |
185 |
187 |
186 iWservEventReceiver = new(ELeave) CWservEventReceiver(*this, iWs); |
188 iWservEventReceiver = new(ELeave) CWservEventReceiver(*this, iWs); |
187 iWservEventReceiver->ConstructL(); |
189 iWservEventReceiver->ConstructL(); |
522 #ifdef USE_ASYNCYH_NOTIFICATIONS |
524 #ifdef USE_ASYNCYH_NOTIFICATIONS |
523 |
525 |
524 // if allocation should fail, threshold should not naturally be set |
526 // if allocation should fail, threshold should not naturally be set |
525 if (!iMemAllocationsGrowing) |
527 if (!iMemAllocationsGrowing) |
526 { |
528 { |
527 TRAP_IGNORE(iMemAllocationsGrowing = CreateThresholdCrossedThreadL(*this, EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK, iLowThreshold)) |
529 TRAP_IGNORE(iMemAllocationsGrowing = CreateThresholdCrossedThreadL(*this, EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK, iLowThreshold, iTotalMem)) |
528 origLow = iLowThreshold; // do not reset |
530 origLow = iLowThreshold; // do not reset |
529 } |
531 } |
530 if (!iMemAllocationsGoingDown) |
532 if (!iMemAllocationsGoingDown) |
531 { |
533 { |
532 TRAP_IGNORE(iMemAllocationsGoingDown = CreateThresholdCrossedThreadL(*this, EGL_PROF_TOTAL_MEMORY_USAGE_LT_NOK, iGoodThreshold)) |
534 TRAP_IGNORE(iMemAllocationsGoingDown = CreateThresholdCrossedThreadL(*this, EGL_PROF_TOTAL_MEMORY_USAGE_LT_NOK, iGoodThreshold, iTotalMem)) |
533 origGood = iGoodThreshold; // do not reset |
535 origGood = iGoodThreshold; // do not reset |
534 } |
536 } |
535 |
537 |
536 TBool releaseClient = ETrue; |
538 TBool releaseClient = ETrue; |
537 |
539 |
641 return 0; |
643 return 0; |
642 } |
644 } |
643 EGLint data_count; |
645 EGLint data_count; |
644 EGLint* prof_data; |
646 EGLint* prof_data; |
645 TInt i(0); |
647 TInt i(0); |
646 TInt totalMem(0); |
648 |
647 TInt totalUsed(0); |
649 TInt totalUsed(0); |
648 EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
650 EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
649 |
651 |
650 /* Find out how much profiling data is available */ |
652 /* Find out how much profiling data is available */ |
651 eglQueryProfilingData(dpy, EGL_PROF_QUERY_GLOBAL_BIT_NOK | EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, |
653 eglQueryProfilingData(dpy, EGL_PROF_QUERY_GLOBAL_BIT_NOK | EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, |
687 |
689 |
688 break; |
690 break; |
689 } |
691 } |
690 case EGL_PROF_TOTAL_MEMORY_NOK: |
692 case EGL_PROF_TOTAL_MEMORY_NOK: |
691 { |
693 { |
692 totalMem = prof_data[i++]; |
694 iTotalMem = prof_data[i++]; |
693 TRACES1("EGL_NOK_resource_profiling - total Mem: %d", totalMem); |
695 TRACES1("EGL_NOK_resource_profiling - total Mem: %d", iTotalMem); |
694 break; |
696 break; |
695 } |
697 } |
696 case EGL_PROF_PROCESS_ID_NOK: |
698 case EGL_PROF_PROCESS_ID_NOK: |
697 { |
699 { |
698 if (sizeof(EGLNativeProcessIdTypeNOK) == 8) |
700 if (sizeof(EGLNativeProcessIdTypeNOK) == 8) |
705 } |
707 } |
706 break; |
708 break; |
707 } |
709 } |
708 case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK: |
710 case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK: |
709 { |
711 { |
710 TUint mem = prof_data[i]; |
712 TRACES1("Private memory Usage by app is %d", prof_data[i]); |
711 TRACES1("Private memory Usage by app is %d", mem); |
|
712 break; |
713 break; |
713 } |
714 } |
714 case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK: |
715 case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK: |
715 { |
716 { |
716 TUint mem = prof_data[i]; |
717 TRACES1("Shared memory Usage by app is %d", prof_data[i]); |
717 TRACES1("Shared memory Usage by app is %d", mem); |
|
718 break; |
718 break; |
719 } |
719 } |
720 default: |
720 default: |
721 { |
721 { |
722 i++; |
722 i++; |
727 |
727 |
728 /* Free allocated memory */ |
728 /* Free allocated memory */ |
729 User::Free(prof_data); |
729 User::Free(prof_data); |
730 |
730 |
731 |
731 |
732 if ((totalMem-totalUsed) < 0) |
732 if ((iTotalMem-totalUsed) < 0) |
733 { |
733 { |
734 return 0; |
734 return 0; |
735 } |
735 } |
736 return totalMem - totalUsed; |
736 return iTotalMem - totalUsed; |
737 } |
737 } |
738 |
738 |
739 TBool CMemoryMonitor::DoPostponedMemoryGood() |
739 TBool CMemoryMonitor::DoPostponedMemoryGood() |
740 { |
740 { |
741 FUNC_LOG; |
741 FUNC_LOG; |