#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. LeetCode - 35. Search Insert Position(48ms)

    Given a sorted array and a target value, return the index if the target is found. If not, return the ...

  2. cartographer 安装修改

    装置:VLP16+IMU+单板机 目的:利用传感器数据,实现real time 的建模 结果:失败,但之前的步骤都正常,出问题的地方可能是imu出错. 稍后附上 launch文件,lua文件,urdf ...

  3. 望岳物业APP开发过程

    望岳物业APP开发过程 1.望岳组员们讨论决定了做的项目及模块功能. 2.物业管理APP图标设计以及写项目的ER图,主要功能流程图. 3.项目体系结构设计和界面设计. 4.了解物业APP的几个功能,然 ...

  4. C#-WinForm控制输入框只接受数字输入

    背景 给导师上一节c#编写数据库应用程序的课,模拟ATM自助取款机的功能写了个winForm程序,关于金额的输入肯定是数字,因此避免输入格式不正确的数字带来异常,直接在输入时进行校验. 封装函数 C# ...

  5. epc笔记

    http://wenku.baidu.com/view/5e921520dd36a32d7375812a.html 1.  先注册, EPC注册EPS业务或non-EPS服务 ?? HSS做什么? 2 ...

  6. [洛谷P1278]单词游戏

    题目大意:给一个有$n(n\leqslant16)$个单词的字典,求单词接龙的最大长度 题解:发现$n$很小,可以状压,令$f_{i,j}$表示选的数的状态为$i$,最后一个字母是$j$的最大长度. ...

  7. [Leetcode] Best time to buy and sell stock 买卖股票的最佳时机

    Say you have an array for which the i th element is the price of a given stock on day i. If you were ...

  8. [学习笔记]最小割之最小点权覆盖&&最大点权独立集

    最小点权覆盖 给出一个二分图,每个点有一个非负点权 要求选出一些点构成一个覆盖,问点权最小是多少 建模: S到左部点,容量为点权 右部点到T,容量为点权 左部点到右部点的边,容量inf 求最小割即可. ...

  9. 【TMD模拟赛】黄金拼图 Cao

    正解:Cao 据说这样的题是用来骗丛林生物上树的...... 这样的题除了考观察力之外还.........我们发现他异或了opt,恩,就这样,用离线推答案..... #include <cstd ...

  10. [COGS 2089.] 平凡的测试数据 带权并查集

    差点就撸上LCT了....... 带权并查集就是在并查集的基础上稍作修改,我的用穿址实现的有人用记录原父亲来实现. #include<cstdio> #define N 300010 us ...