查看: 788|回复: 0

[BBB试用之旅8] 如何改变Beaglebone的CPU运行主频

[复制链接]
  • TA的每日心情
    难过
    2017-4-18 09:57
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]偶尔看看II

    发表于 2017-4-7 09:28:47 | 显示全部楼层 |阅读模式
    分享到:
    系列阅读: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 这个文件里面修改。
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-25 23:14 , Processed in 0.109553 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.