FrontPage|FindPage|TitleIndex|RecentChanges|RSS Run Time
 

½ÇÇà½Ã°£ ÃøÁ¤ #


?TRunTime Class #

#include <stdio.h>
#include <string.h> 
#include <time.h>
#include <sys/time.h>

class TRunTime {
private :
    struct timeval t_start;
    char *id;
public:
    TRunTime(const char *lid) { id = new char[strlen(lid)]; strcpy(id,lid); gettimeofday(&t_start, NULL);};
   ~TRunTime(){
       unsigned result;

       struct timeval t_end;
       gettimeofday(&t_end, NULL);

       result = 1000000L * (t_end.tv_sec - t_start.tv_sec) + t_end.tv_usec - t_start.tv_usec;
       fprintf(stdout, "TRUNTIME CLASS - elapsed time for %s  : %u.%06us\n", id, result/1000000, result%1000000);

       delete []id;
    };
};


last modified 2007-01-11 11:46:42
EditText|FindPage|DeletePage|LikePages|