什么是整整"时钟节拍"在Android的CPU占用率的情况下?节拍、时钟、情况下、占用率

由网友(你走我不留)分享简介:我目前工作在Android的一个项目。我想每一个进程的CPU使用总量。所以我使用的/ proc / PID / STAT的内容。我称之为this回答得到的统计资料。现在我把所有的UTIME,STIME等,问题是赫兹的价值。回答说,这是每秒时钟滴答数。我甚至浏览了很多后,没有得到时钟滴答的确切含义。这是一个时钟节拍,并...

我目前工作在Android的一个项目。我想每一个进程的CPU使用总量。所以我使用的/ proc / PID / STAT的内容。我称之为this回答得到的统计资料。现在我把所有的UTIME,STIME等,问题是赫兹的价值。 回答说,这是每秒时钟滴答数。我甚至浏览了很多后,没有得到时钟滴答的确切含义。这是一个时钟节拍,并且它的处理器的频率?而回答说,我们可以得到时钟滴答使用

I am currently working on a project in Android. I want to get the total cpu usage of each and every process. So i am using the contents of "/proc/pid/stat". I referred this answer to get the stats. Now i got all the utime, stime etc., The problem is with the value of "Hertz". The answer says that it is the number of clock ticks per second. I don't get the exact meaning of clock tick even after browsing a lot. What is a clock tick and is it the frequency of the processor? And the answer says that we can get the clock ticks using

的sysconf(_SC_CLK_TCK)

sysconf(_SC_CLK_TCK)

我不知道如何在Android中使用Linux命令获取时钟滴答。我用Google搜索它,我无法找到它。请帮助我。这将是更有益的,如果没有此时钟周期的一个例子。

I don't know how to use this linux command in Android to get the clock ticks. I have googled it and i couldn't find it. Pls help me with this. And it would be more helpful if there is an example for this clock tick.

推荐答案

100是在Linux上设置默认值。它似乎是在Android中不变,显示的 sysconf.c 源文件中 - 的 goo.gl/C5yubg

100 is the default value set on Linux. And it appears to be unchanged in Android as shown in the sysconf.c source file - goo.gl/C5yubg

如果你看行167,这是的sysconf(_SC_CLK_TCK)将retrun:

If you see line 167, this is what sysconf(_SC_CLK_TCK) will retrun:

案例_SC_CLK_TCK:返回SYSTEM_CLK_TCK;

SYSTEM_CLK_TCK 定义为 100

阅读全文

相关推荐

最新文章