From 6b1fcde7af64ca81079dffe1d62096228693b5d6 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 21 Aug 2011 00:28:52 -0600 Subject: Don't dynamically allocate timers. --- libdimension/dimension/scene.h | 4 ++-- libdimension/dimension/timer.h | 18 +++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'libdimension/dimension') diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h index 2f659e9..c35f91f 100644 --- a/libdimension/dimension/scene.h +++ b/libdimension/dimension/scene.h @@ -76,8 +76,8 @@ typedef struct dmnsn_scene { unsigned int nthreads; /** Timers. */ - dmnsn_timer *bounding_timer; - dmnsn_timer *render_timer; + dmnsn_timer bounding_timer; + dmnsn_timer render_timer; bool initialized; /**< @internal Whether the scene is initialized. */ } dmnsn_scene; diff --git a/libdimension/dimension/timer.h b/libdimension/dimension/timer.h index bd72a90..6bffce6 100644 --- a/libdimension/dimension/timer.h +++ b/libdimension/dimension/timer.h @@ -28,8 +28,6 @@ typedef struct dmnsn_timer { double real; /**< Wall-clock time. */ double user; /**< Time spent executing. */ double system; /**< Time spent waiting for the system. */ - - dmnsn_refcount refcount; /**< @internal Reference count. */ } dmnsn_timer; /** A standard format string for timers. */ @@ -41,22 +39,16 @@ typedef struct dmnsn_timer { * @endcode * will print something like "1.00s (user: 0.99s; system: 0.01s)". */ -#define DMNSN_TIMER_PRINTF(t) (t)->real, (t)->user, (t)->system +#define DMNSN_TIMER_PRINTF(t) (t).real, (t).user, (t).system /** - * Create a new timer. Timing starts right before this function returns. - * @return A new timer object. + * Start a timer. The values of an unfinished timer are undefined. + * @param[in,out] timer The timer to start. */ -dmnsn_timer *dmnsn_new_timer(void); +void dmnsn_start_timer(dmnsn_timer *timer); /** * Finish timing. The members of the timer struct will now contain timing data. * @param[in,out] timer The timer to stop. */ -void dmnsn_complete_timer(dmnsn_timer *timer); - -/** - * Delete a timer. - * @param[in,out] timer The timer to delete. - */ -void dmnsn_delete_timer(dmnsn_timer *timer); +void dmnsn_stop_timer(dmnsn_timer *timer); -- cgit v1.2.3