手臂裸机系统上的CPU使用率量度 [英] CPU usage measurment on arm bare metal system

查看:204
本文介绍了手臂裸机系统上的CPU使用率量度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个的ARM Cortex M4 评估电路板,它的一个裸机应用程序无需任何操作系统运行就可以了。

I am working on a ARM cortex M4 evaluation board, its a bare metal application without any operating system running on it.

现在我想衡量 CPU 指定进程/算法的使用,这将是这样做的最佳方式?

Now I want to measure CPU usage of a given process/algorithm , what would be the best way to do so?

我应该实现一个操作系统来衡量 CPU有此类需求的功能使用情况如何?

Should i implement an operating system to measure the CPU usage that have the functionality for such demand?

推荐答案

这个问题的答案几乎本身。什么是你的裸机应用程序做时,它是不是在这个过程/算法?测量的一个或另一个或两者。如果您有没有完全在这个算法占用CPU裸机的应用程序,那么你已经有了一个操作系统的范围内,你正在管理该应用/功能的时间。您可以在相对循环使用一个多种方法,从一个简单的计数器来一个定时器看每圈有多少数量时,算法越来越时间段VS不行。你可以简单地时间算法本身,等等。

The question almost answers itself. What is your bare metal application doing when it is not in that process/algorithm? Measure one or the other or both. If you have a bare metal application that is not completely consuming the cpu in this algorithm, then you already have an operating system to the extent that you are managing this application/function's time. You can use a number of methods from a simple counter in a loop relative to a timer to see how many counts per loop when the algorithm is getting time slices vs not. You can simply time the algorithm itself, etc.

我认为当你说你的CPU意味着整个系统的性能在很大程度上都在你的code和它在谈论什么依赖。如果从闪存上取决于你可能会烧毁处理器周期只是等待指令或数据的时钟速率的Cortex-M4运行(并且可以很容易得到的处理器性能的错误概念的一个算法时,它不是算法烧时钟)。缓存面膜/操纵其性能,如果你不小心,并意识到自己在做什么可以很容易极大地影响性能。作为一个C ++质疑你的编译器起着性能有很大的作用,以及当然你code,可以很容易使code运行快几倍或更慢最小的变化在命令行或code

I assume when you say CPU you mean the whole system as your performance is heavily dependent both on your code and what it is talking to. If running from flash on a cortex-m4 depending on the clock rate you may be burning processor cycles just waiting for instructions or data (and can very easily get the wrong notion of processor performance for an algorithm when it isnt the algorithm burning clocks). The caches mask/manipulate that performance and can easily greatly affect the performance if you are not careful and aware of what they are doing. Being a C++ question your compiler plays a large role in performance as well as your code of course, can very easily make the code run several times faster or slower with minimal changes to the command line or code.

如果该算法是ISR的一部分,那么处理器进入,否则睡觉,你可以使用GPIO引脚和范围techinique来感受的运行VS睡眠比例。

If the algorithm is part of an isr then the processor goes to sleep otherwise, you can use the gpio pin and scope techinique to get a feel for the running vs sleeping ratio.

这篇关于手臂裸机系统上的CPU使用率量度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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