Initial import
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/_to_be_added@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// ------------------------------------------------------------
|
||||
// tictoc.c
|
||||
//
|
||||
// Utility to measure timing
|
||||
//
|
||||
// 10.03.2005, J.Ahrensfeld
|
||||
// ------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <sys/time.h>
|
||||
#include "tictoc.h"
|
||||
|
||||
// ------------------------------------------------------------
|
||||
void Tic(struct _tictoc_t *pObj)
|
||||
{
|
||||
gettimeofday(&pObj->s, &pObj->tz);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
void Toc(struct _tictoc_t *pObj)
|
||||
{
|
||||
gettimeofday(&pObj->e, &pObj->tz);
|
||||
printf("Operation takes %f milliseconds.\n", (double)((pObj->e.tv_sec - pObj->s.tv_sec)*1000) + (double)(pObj->e.tv_usec - pObj->s.tv_usec)/1000);
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
Reference in New Issue
Block a user