zoukankan      html  css  js  c++  java
  • linux timing profile

    double getUnixTime(void)
    {
        struct timespec tv;
    
        if(clock_gettime(CLOCK_REALTIME, &tv) != 0) return 0;
    
        return (((double) tv.tv_sec) + (double) (tv.tv_nsec / 1000000000.0));
    }
    
    double start_time = getUnixTime();
    double stop_time, difference;
    
    algorithm();
    
    stop_time = getUnixTime();
    difference = stop_time - start_time;
    printf("elipsed time :%lf s",difference);

    g++ t.c++ -lrt

    gprof 

    gprof -b -p astart gmon.out >&tmp.txt

       @ gprof hello gmon.out -p 得到每个函数占用的执行时间
           @ gprof hello gmon.out -q 得到call graph,包含了每个函数的调用关系,调用次数,执行时间等信息。
           @ gprof hello gmon.out -A 得到一个带注释的“源代码清单”,它会注释源码,指出每个函数的执行次数。这需要在编译的时候增加 -g选项。

    http://www.thegeekstuff.com/2012/08/gprof-tutorial/

  • 相关阅读:
    VHDL硬件描述语言(三)——基本数据对象和数据类型
    VHDL硬件描述语言(二)——子程序
    VHDL硬件描述语言(一)——基本结构
    C#类
    C#基本语法
    C#的简单数据类型
    C#与.NET
    ARP
    IPv6
    以太网
  • 原文地址:https://www.cnblogs.com/huashiyiqike/p/3879127.html
Copyright © 2011-2022 走看看