bogoMIPS值被改变 [英] bogoMIPS value is changing

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

问题描述

我一直在阅读我的三星Galaxy(SGH-I897)的cpuinfo的文件,以检索的bogoMIPS值。而刚才学习如何跨preT这样的信息。

起初,我这样做是下一个线程负载的主要活动中,始终得到了997.59的值。然后我移动的文件读取方法为服务,因为我并不需要它的用户界面,直到很久以后反正。一旦我这样做,我读出的值变成了完全不同的,似乎改变为每个应用程序的开始,总是要慢得多,就像在300至500的范围内。

我的问题是:

  1. 难道是Android OS / LINUX导致bogoMIPS值的测定,并定期修改cpuinfo的文件吗?

  2. 如果是这样,有一个程序化的方式,迫使它?

  3. 取决于如果我从服务读取文件经文的主要活动线程为什么会发生变化?

  4. 最后,如果一个人想在最正确的数量是它最好只是写我们自己的时间循环得到它自己在我们需要它的那一刻? (假设它是不断变化的,由于CPU负载,所有的时间无论如何?)

解决方案

简短的回答:不BogoMIPS打扰,如果你不盗号内核

这是什么BogoMIPS东西?

由操作系统内核中执行

大多数任务需要等待硬件,或者更近,流程上的其它处理器内核上运行。内核有各种方法来等待不同的时间尺度。为了在最短的时间段,它通常会简单地奔波在圈子',更在技术上被称为忙等待循环。

该BogoMIPS基准只是一个忙等循环。所述内核运行这样一个循环,用一个pretty的可靠挂钟它倍,并确定它需要运行一个忙等待循环以等待一个特定的时间量多长时间。

为什么会出现BogoMIPS值的变化?

当一个计算机(智能电话,在这种情况下)是不进行大量的工作,它很少有很多需要一个非常快的处理器。当操作系统注意到它可以与小于最大频率做,它可以在处理器节流降低到较低的频率。这样就大大的操作系统可以减少能源使用量(相关的电池供​​电的计算机)和产热(相关pretty的每样东西)之一。

当然,当最大频率降低,一BogoMIPS基准的结果是不相关的了,因为在忙等待循环的每一次迭代将需要更长的时间。内核将重新运行基准并更新BogoMIPS价值,让忙等待仍然是等待很短的时间一个可靠的方法。

类似的东西保存时需要进行加工出来时,处理器需要而节流再次

我应该如何使用这个BogoMIPS值?

除非你是黑客,随着时间处理内核的某些部分,你不应该由BogoMIPS值困扰。事实上,你应该使用什么但是的BogoMIPS值。可能有一些方式使用Android SDK,或者使用通过 / SYS 文件系统提供的信息来确定当前的CPU频率。

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.

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.

My questions are:

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

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

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

  4. 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?)

解决方案

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

What is this BogoMIPS thing?

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".

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.

Why does the BogoMIPS value change?

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).

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.

How should I use this BogoMIPS value?

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天全站免登陆