#include <time.h>

int delay(int time)
{
int i,j; for(i =0;i<time;i++)
for(j=0;j<10000;j++)
;
} int main()
{
struct timespec start_1, end_1;
unsigned long long diff; clock_gettime(CLOCK_REALTIME, &start_1); delay(10); // UUT unit under test clock_gettime(CLOCK_REALTIME, &end_1); diff = 1000000000 * (end_1.tv_sec - start_1.tv_sec) + (end_1.tv_nsec - start_1.tv_nsec);
printf("the difference is %lld nano seconds\n",diff); return 0;
}

reference : too much

measure time program的更多相关文章

  1. Java性能提示(全)

    http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...

  2. [EMSE'17] A Correlation Study between Automated Program Repair and Test-Suite Metrics

    Basic Information Authors: Jooyong Yi, Shin Hwei Tan, Sergey Mechtaev, Marcel Böhme, Abhik Roychoudh ...

  3. Official Program for CVPR 2015

    From:  http://www.pamitc.org/cvpr15/program.php Official Program for CVPR 2015 Monday, June 8 8:30am ...

  4. [project euler] program 4

    上一次接触 project euler 还是2011年的事情,做了前三道题,后来被第四题卡住了,前面几题的代码也没有保留下来. 今天试着暴力破解了一下,代码如下: (我大概是第 172,719 个解出 ...

  5. Solved: “Cannot execute a program. The command being executed was \roslyn\csc.exe”

    When you publish your ASP.NET project to a hosting account such as GoDaddy, you may run into the iss ...

  6. 关于The C compiler "arm-none-eabi-gcc" is not able to compile a simple test program. 的错误自省...

    在 GCC ARM Embedded https://launchpad.net/gcc-arm-embedded/ 上面下载了个arm-none-eabi-gcc 用cmake 编译时 #指定C交叉 ...

  7. c中使用gets() 提示warning: this program uses gets(), which is unsafe.

    今天在C代码中使用gets()时提示“warning: this program uses gets(), which is unsafe.”,然后这个程序还能运行,无聊的我开始查阅资料,为啥gets ...

  8. Android measure过程分析

    作为一名Android开发人员,我们都知道一个View从无到有,会经历3个阶段: 1. measure/测量阶段,也就是确定某个view大小的过程: 2. layout/布局阶段,也就是确定其左上右下 ...

  9. Unable to load R3 module D:\Program Files\Oracle\VirtualBox/VBoxDD.DLL (VBoxDD): GetLastError=1790 (VERR_UNRESOLVED_ERROR).

    Unable to load R3 module D:\Program Files\Oracle\VirtualBox/VBoxDD.DLL (VBoxDD): GetLastError=1790 ( ...

随机推荐

  1. Java IO学习--RandomAccessFile

    1.什么是 随机访问文件流 RandomAccessFile 这个类在很多资料上翻译成中文都是:随机访问文件,在中文里,随机是具有不确定的含义,指一会访问这里,一会访问那里的意思.如果以这种语义来解释 ...

  2. [USACO18DEC]Cowpatibility(容斥 or bitset优化暴力)

    题面 题意: 给出n个五元组(一个五元组的五个数互不相同),我们称两个五元组不和谐,当且仅当任意元素都不相同,求有多少对五元组不和谐. \(Solution:\) 很容易想到 Ans = 总共对数-和 ...

  3. js阻止冒泡事件和默认事件的方法

    阻止默认事件 function stopDeFault(e){ if(e&&e.preventDefault){//非IE e.preventDefault(); }else{//IE ...

  4. struts标签中的select

    <!-- Struts下拉列表标签: name="deptId" 下拉列表标签的名称(服务器根据这个名称获取选择的项的实际的值value值) headerKey 默认选择项的 ...

  5. vb常用函数一览表

    常用内部函数 数学函数 函数 功能 示例 结果 说明 Abs(x) 绝对值 Abs(-50.3) 50.3   Exp(x) 自然指数 Exp(2) e^2 e(自然对数的底)的某次方 Fix(x) ...

  6. [Leetcode] Reorder list 重排链表

    Given a singly linked list L: L 0→L 1→…→L n-1→L n,reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→… You ...

  7. 洛谷 [SDOI2015]约数个数和 解题报告

    [SDOI2015]约数个数和 题目描述 设\(d(x)\)为\(x\)的约数个数,给定\(N,M\),求$ \sum\limits^N_{i=1}\sum\limits^M_{j=1}d(ij)$ ...

  8. MSSQL事务在C#程序端的使用

    拼接成一条SQL执行 优点:简单,容易看懂: 缺点:某些场合,涉及的业务较多,在同一SQL处理显得太冗长,复杂,不利于解耦. 使用细节 在方法之间传递参数,确保多个方法中的SQL都是使用同一个事务的( ...

  9. BZOJ day2_plus

    大半夜的刷b站,好爽啊... 突破十九题 1008105110591088117911911192143218761951196821402242243824562463276128184720

  10. How to setup Active Directory (AD) In Windows Server 2016

    Windows Server 2016 is the newest server operating system released by Microsoft in October 12th, 201 ...