Android 屏幕关闭时会降低下载速率吗?

发布于 2024-12-07 13:04:58 字数 479 浏览 4 评论 0原文

我观察到,如果在 屏幕上使用 wget,我可以更快地下载文件 应用程序, 获取屏幕昏暗唤醒锁定而不是在没有此操作的情况下执行相同操作应用程序和 屏幕关闭。我下载了完全相同的文件(从我的 apache Web 服务器),当我在应用程序上使用屏幕时,时间几乎快了两倍。为了下载该文件,我使用了 wget 的移植版本。这是我的问题:

当屏幕关闭时,Android 会降低下载速率吗?

或者由于应用程序上的屏幕获取唤醒锁,强制CPU始终处于开启状态,因此下载过程花费了更多的CPU周期..我有点困惑..

I observed that I can download a file faster if I use wget with the screen on application,
that acquires a screen dim wake lock than doing the same without this application and
having the screen turned off.. I downloaded exactly the same file (from my apache web server) and the time is almost two times faster when I used the screen on application. To download the file I use a ported versions of wget.. And here is my question:

Does Android lower the download rate when the screen turns off?

Or due to the fact that the screen on app acquires a wake lock, forces the CPU to be always on, so more CPU cycles are spent for the download process.. I am a little bit confused..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋心╮凉 2024-12-14 13:04:58

简短的回答是,Android 有时会在屏幕关闭时降低下载速率。根据此 Android 错误报告(由 90 位用户加星标),

即使将“Wifi 睡眠策略”设置为“从不”,某些 Android 设备上的 WiFi 似乎也会在屏幕关闭时进入省电模式(又名 PSP 模式)。

PSP 模式显然会导致 wifi 设备进入睡眠状态,但会定期唤醒并要求其接入点在设备睡眠时传送发送到该设备的数据包。这必然会导致额外的“尖峰”网络延迟。这种额外的延迟意味着某些面向网络的应用程序在屏幕关闭时会遇到问题。

这或多或少与您所描述的行为相关。此问题仅影响部分手机,并非所有手机,并且仅影响部分 Android 版本。我建议你访问上面的错误报告,这个问题有很长的讨论。

如何解决这个问题

Android 2.3 至少有一个解决方法:您需要获取 WIFI_MODE_HIGH_PERF 锁定

在此 Wi-Fi 锁定模式下,Wi-Fi 将与 WIFI_MODE_FULL 模式一样保持活动状态,但即使设备屏幕关闭,它也会以高性能运行,具有最小的数据包丢失和低数据包延迟。此模式会消耗更多电量,因此仅应在需要此类活动连接时使用。

Android 中的 CPU 时钟缩放

Android 基于 Linux 内核,并使用 CPUFreq Governors< /a> 调整 CPU 频率以节省电池。确切的政策和频率因供应商而异,并且可能会发生变化。还有实用程序可让您调整这些政策,但它们都需要 root 的手机。通常,Android 手机会在屏幕关闭时降低 CPU 频率并使用“省电”调节器。

但是,我不认为手机上的网络流量受 CPU 限制。也就是说,即使处于省电安全模式,网络吞吐量也是瓶颈,而不是 CPU 速度。

Short answer is yes, Android sometimes does lower the download rate when the screen turns off. According to this Android bug report (starred by 90 users),

It seems that, even with "Wifi Sleep Policy" set to "Never", the wifi on some Android devices will enter Power Save mode (a.k.a. PSP mode) when the screen turns off.

PSP mode apparently causes the wifi device to sleep, but wake up periodically and ask its access point to deliver packets that were addressed to to the device while it was asleep. This necessarily causes additional, "spiky" network latency. This additional latency means that some network-oriented applications experience problems when the screen turns off.

This more or less correlates with the behavior you're describing. This issue affects only some phones, not all, and only some versions of Android. I suggest you visit the bug report above, there is a long discussion of this issue.

How to solve this issue

There is a workaround for Android 2.3 at least: You need to acquire WIFI_MODE_HIGH_PERF lock:

In this Wi-Fi lock mode, Wi-Fi will be kept active as in mode WIFI_MODE_FULL but it operates at high performance with minimum packet loss and low packet latency even when the device screen is off. This mode will consume more power and hence should be used only when there is a need for such an active connection.

CPU clock scaling in Android

Android is based on Linux kernel, and uses CPUFreq Governors to adjust CPU frequency to conserve the battery. Exact policies and frequencies vary from vendor to vendor and are subject to change. There are also utilities that let you adjust these policies, but they all require rooted phone. Usually, Android phones lower CPU frequency and use "powersave" governor when the screen is turned off.

However, I don't think network traffic on a phone is CPU-bound. That is, even when in power-safe mode, network throughput is a bottleneck, not CPU speed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文