TA的每日心情 | 难过 2017-4-18 09:57 |
---|
签到天数: 7 天 连续签到: 1 天 [LV.3]偶尔看看II
|
系列阅读:https://jingyan.eeboard.com/category/53
如果你的应用设计有低功耗的需求,又或者你需要更快的运行速度处理更多的数据和算法,那么你会想到要更改CPU运行主频,关键如何改呢。
在https://derekmolloy.ie/changing-the-beaglebone-cpu-... 这里能找到答案 ,而我也会将我的实验经过分享如下。
1.查看当前BBB CPU的状态信息,很明显下图倒数第二行,当前运行频率是300MHZ
当然你若没有cpufrequtils应用软件 ,那么你需要安装一下这个软件包
2. 试试更改CPU up_threshold值吧
3.用上一篇分享的软件包https://github.com/derekmolloy/boneCV中的boneCVtiming 举个例子
/* boneCVtiming.cpp
*
* www.derekmolloy.ie
*
* provided that source code redistributions retain this notice.
*
* This software is provided AS IS and it comes with no warranties of any type.
*/
#include<iostream>
#include<opencv2/opencv.hpp>
#include<time.h>
using namespace std;
using namespace cv;
int main()
{
Mat frame, edges;
struct timespec start, end;
clock_gettime( CLOCK_REALTIME, &start );
int frames=10;
for(int i=0; i<frames; i++){
capture >> frame;
if(frame.empty()){
cout << "Failed to capture an image" << endl;
return -1;
}
cvtColor(frame, edges, CV_BGR2GRAY);
Canny(edges, edges, 0, 30, 3);
}
clock_gettime( CLOCK_REALTIME, &end );
double difference = (end.tv_sec - start.tv_sec) + (double)(end.tv_nsec - sta
rt.tv_nsec)/1000000000.0d;
cout << "It took " << difference << " seconds to process " << frames << " fr
ames" << endl;
cout << "Capturing and processing " << frames/difference << " frames per sec
ond " << endl;
imwrite("edges.png", edges);
imwrite("capture.png", frame);
return 0;
}
4.当前300MHZ运行情况:10帧耗时10.9s
5. 更改当前主频为800MHZ,实际可调频率分成四挡: 300 -> 600 -> 800 ->1000
6. 再次运行同样的程序,前800MHZ运行情况:10帧耗时2.6s
操作就是这样爽快,你是否已经找到方向了。
根据derek的分享,感兴趣的话还能试试在/etc/init.d/cpufrequtils 这个文件里面修改。 |
|