bogoMIPS 值正在改变 [英] bogoMIPS value is changing

查看:42
本文介绍了bogoMIPS 值正在改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读我的三星 Galaxy (sgh-i897) 上的 cpuinfo 文件来检索 bogoMIPS 值.刚刚学习如何解释这些信息.

I have been reading the cpuinfo file on my Samsung Galaxy (sgh-i897) to retrive the bogoMIPS value. And just now learning how to interpret such information.

最初我在加载线程的主要活动下执行此操作,并且始终获得 997.59 的值.然后我将文件读取方法移到服务中,因为直到很久以后我才在 UI 中需要它.执行此操作后,我读取的值变得非常不同,并且似乎随着每个应用程序的启动而变化,速度总是慢得多,例如在 300 到 500 范围内.

Initially I did this under the main activity in a loading thread, and ALWAYS got a value of 997.59. I then moved the file reading method into a Service since I didn't need it in the UI until much later anyways. Once I did this, the value I read became quite different, and seems to change for each application start, always much slower, like in the 300 to 500 range.

我的问题是:

  1. Android OS/Linux 是否会导致测量 bogoMIPS 值并定期修改 cpuinfo 文件?

  1. Does the Android OS / Linux cause a measurement of the bogoMIPS value and modify the cpuinfo file periodically?

如果是这样,有没有一种程序化的方式来强制它?

If so, is there a programatic way to force it?

为什么它会根据我是从服务读取文件还是从主活动线程读取文件而有所不同?

Why would it vary depending on if I am reading the file from a Service verses the main activity thread?

归根结底,如果想要最正确的数字,是否最好直接编写我们自己的计时循环以在我们需要的时候自己获取它?(假设它一直在变化,因为 cpu 负载,无论如何?)

Ultimately, if one wants the most correct number is it best to simply write our own timing loops to get it ourselves at the moment we need it? (assuming it's changing, due to cpu load, all the time anyhow?)

推荐答案

简短回答:如果您不破解内核,请不要使用 BogoMIPS.

Short answer: don't bother with BogoMIPS if you're not hacking the kernel.

操作系统内核执行的大多数任务都涉及等待硬件,或者最近在其他处理器内核上运行的进程.内核有多种方法可以在不同的时间尺度上等待.在最短的时间内,它通常只是绕圈子跑",在技术上更称为忙等待循环".

Most tasks performed by an operating system kernel involve waiting for hardware, or more recently, processes running on other processor cores. The kernel has various methods to wait on different time scales. For the shortest periods of time, it will often simply 'run around in circles', more technically known as a "busy wait loop".

BogoMIPS 基准测试只是一个繁忙的等待循环.内核运行这样的循环,使用非常可靠的挂钟对其计时,并确定运行繁忙的等待循环需要多长时间才能等待特定的时间.

The BogoMIPS benchmark is just a busy wait loop. The kernel runs such a loop it, times it using a pretty reliable wall clock, and determines how long it needs to run a busy wait loop to wait for a specific amount of time.

当计算机(在本例中为智能手机)不执行大量工作时,它很少需要非常快的处理器.当操作系统注意到它可以使用低于最大频率的频率时,它可能会将处理器降低到较低的频率.这是操作系统可以减少能源使用(与电池供电的计算机相关)和热量产生(与几乎所有事物相关)的方法之一.

When a computer (smartphone, in this case) isn't performing a lot of work, it rarely has much need for a very fast processor. When the operating system notices it can do with less than the maximum frequency, it may throttle down the processor to a lower frequency. This is one of the ways the OS can reduce energy usage (relevant for battery-powered computers) and heat production (relevant for pretty much everything).

当然,当最大频率降低时,BogoMIPS 基准测试的结果不再相关,因为忙等待循环中的每次迭代都会花费更长的时间.内核将重新运行基准测试并更新 BogoMIPS 值,因此忙等待仍然是短时间等待的可靠方式.

Of course, when the maximum frequency is lowered, the result of a BogoMIPS benchmark isn't relevant anymore, because every iteration in a busy wait loop will take longer. The kernel will rerun the benchmark and update the BogoMIPS value, so that busy waiting remains a reliable way of waiting for short periods of time.

当处理需求增加时,类似的事情成立,处理器需要再次节流.

Something similar holds when the need for processing rises, and the processor needs to be throttled up again.

除非您正在破解内核中处理时序的某些部分,否则您不应该被 BogoMIPS 值所困扰.事实上,您应该使用任何 BogoMIPS 值.可能有一些方法可以使用 Android SDK 或使用 /sys 文件系统提供的信息来确定当前的 CPU 频率.

Unless you are hacking some part of the kernel that deals with timing, you shouldn't be bothered by the BogoMIPS value. In fact, you should use anything but the BogoMIPS value. There might be some way to determine the current CPU frequency using the Android SDK, or using information provided by /sys filesystem.

这篇关于bogoMIPS 值正在改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆