Download presentation
Presentation is loading. Please wait.
Published byBetty Cox Modified over 8 years ago
6
94% of apps peak at <150MB. 92% of apps average at <100MB. Component usage (ballpark) 512MB Phone 1GB Tablet 2GB Desktop Total physical51210242048 Paging level200 1600 71212243648 BSP, OS, drivers, services425 OEM/MO service agents2240 VOIP or Background audio6680 VPN10 20 523555525 Foreground App185390900 Back-stack, Task completion, BG tasks, More FG apps42792223
7
Task type Memory Cap MBLifetimeCPU Block in Batt-Sav Default Background Task1630 sec10%Y Long-Running Bluetooth16∞10%Y Extended Execution15010 min10%Y Background Audio Playback25∞10%N VOIP Active Call66∞70%N Modern Foreground App185∞70%N Example: 512MB device
8
Task typePriority Foreground App2 VOIP2 Background Audio2 VPN2 Background Transfer2 or 6* Bluetooth3 CachedFileUpdater/ShareDataPackage Task3 or 6* Task Completion4 Geofence-triggered Task5 Default Background Tasks6 App in the backstack7
9
Example: Background Audio Agent Sensor resources ResourceAllowed? Microphone Camera Proximity Gyro Compass Accelerometer Vibrator Push SpeechSynthesis SpeechRecognition Audio InterruptiveUI
11
NetworkInformation.NetworkStatusChanged += OnNetworkStatusChanged; Battery.AggregateBattery.ReportUpdated += OnBatteryReportUpdated; ; bool isGyro = Gyrometer.GetDefault() != null; bool isAccelero = Accelerometer.GetDefault() != null; bool isCompass = Compass.GetDefault() != null; MediaCapture mediaCapture = new MediaCapture(); bool isCamera = mediaCapture != null; BatteryReport batteryReport = Battery.AggregateBattery.GetReport(); if (batteryReport.Status != BatteryStatus.NotPresent) { int charge = (int)batteryReport.RemainingCapacityInMilliwattHours; } ConnectionProfile profile = NetworkInformation.GetInternetConnectionProfile(); ConnectionCost cost = profile.GetConnectionCost(); if (cost.Roaming || cost.OverDataLimit) ; // prompt for user opt-in. else if (cost.ApproachingDataLimit) ; // throttle behavior.
12
MemoryManager.AppMemoryUsageIncreased += OnAppMemoryUsageIncreased; MemoryManager.AppMemoryUsageDecreased += OnAppMemoryUsageDecreased; ulong usageLimit = MemoryManager.AppMemoryUsageLimit; ulong usage = MemoryManager.AppMemoryUsage; ulong headroom = usageLimit - usage; AppMemoryReport appReport = MemoryManager.GetAppMemoryReport(); ulong privateCommit = appReport.PrivateCommitUsage; ulong peakPrivate = appReport.PeakPrivateCommitUsage; ulong totalCommit = appReport.TotalCommitUsage; ulong commitLimit = appReport.TotalCommitLimit; ProcessMemoryReport processReport = MemoryManager.GetProcessMemoryReport(); ulong privateSet = processReport.PrivateWorkingSetUsage; ulong totalSet = processReport.TotalWorkingSetUsage;
13
BackgroundEnergyManager.RecentEnergyUsageIncreased += OnRecentEnergyUsageIncreased; BackgroundEnergyManager.RecentEnergyUsageReturnedToLow += OnRecentEnergyUsageReturnedToLow; uint usage = BackgroundEnergyManager.RecentEnergyUsage; uint usageLevel = BackgroundEnergyManager.RecentEnergyUsageLevel; if (usageLevel == BackgroundEnergyManager.NearTerminationUsageLevel) ;// Get ready to be terminated. else if (usageLevel == BackgroundEnergyManager.ExcessiveUsageLevel) ;// Throttle back urgently. else if (usageLevel == BackgroundEnergyManager.MaxAcceptableUsageLevel) ;// On the wall of shame. else if (usageLevel == BackgroundEnergyManager.NearMaxAcceptableUsageLevel) ;// Approaching the wall of shame. else if (usageLevel == BackgroundEnergyManager.LowUsageLevel) ;// Good citizen.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.