timer.c File Reference


Detailed Description

Timing module implementation.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <oski/common.h>
#include <oski/timer.h>
#include <oski/config.h>
#include "cycle.h"
#include <time.h>

Data Structures

struct  tagBebop_timerstruct_t
 Stores 'stop-watch' timer data. More...

Defines

#define TIMER_DESC   "ANSI C clock() routine"

Typedefs

typedef clock_t rawtime_t
typedef tagBebop_timerstruct_t oski_timerstruct_t
 Stores 'stop-watch' timer data.

Functions

static rawtime_t getrawtime (void)
static double elapsed (rawtime_t t1, rawtime_t t0)
double oski_GetTimerSecsPerTick ()
 Get the current calibration factor.
static size_t strlen_ignore_spaces (const char *s)
void oski_CalibrateTimer (oski_timer_t timer)
 Initialize timer.
oski_timer_t oski_CreateTimer (void)
 Allocate a new timer.
void oski_DestroyTimer (oski_timer_t timer)
 Free previously allocated timer.
const char * oski_GetTimerDesc (oski_timer_t timer)
 Get a short string description of the timer being used.
void oski_RestartTimer (oski_timer_t timer)
 Start virtual stopwatch.
void oski_StopTimer (oski_timer_t timer)
 Stop virtual stopwatch.
double oski_ReadElapsedTime (oski_timer_t timer)
 Check virtual stopwatch and return elapsed time, in seconds, since the last call to either oski_RestartTimer() or oski_StopTimer(), whichever happened most recently.

Variables

static double g_seconds_per_tick = -1
 Multiplicative factor converting ticks to seconds.


Function Documentation

void oski_CalibrateTimer oski_timer_t  timer  ) 
 

Initialize timer.

An application should call this at least once during its start-up to cache calibration results.

double oski_ReadElapsedTime oski_timer_t  timer  ) 
 

Check virtual stopwatch and return elapsed time, in seconds, since the last call to either oski_RestartTimer() or oski_StopTimer(), whichever happened most recently.

Note:
If the caller has never restarted this timer, then the results are garbage.


Generated on Wed Sep 19 16:41:23 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6