C语言计算程序运行时间

#include<stdio.h>
#include<stdlib.h>
#include "time.h"  

int main( void )  
{  
    long    i = 1000000000L;  
    
    clock_t start_time, end_time;  
    double  duration_time;  
    start_time=clock();  

    while( i-- )  ;

    end_time = clock();  
    duration_time = (double)(end_time-start_time) / CLOCKS_PER_SEC;  
    printf( "duration: %lf seconds\n", duration_time );     

 

C语言如何计算程序运行时间;如何获得C程序运行时间;C语言统计算法运行时间

posted @ 2013-07-13 08:26  emanlee  阅读(2203)  评论(0编辑  收藏  举报