summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-08-21 00:28:52 -0600
committerTavian Barnes <tavianator@gmail.com>2011-08-21 13:18:28 -0600
commit6b1fcde7af64ca81079dffe1d62096228693b5d6 (patch)
tree2600ece91b5179105a572d79b60a6fc07e82c0a7 /libdimension/dimension
parent4f9a96f6cdee4cf234bde7fdafd0be0f5b6b808e (diff)
downloaddimension-6b1fcde7af64ca81079dffe1d62096228693b5d6.tar.xz
Don't dynamically allocate timers.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/scene.h4
-rw-r--r--libdimension/dimension/timer.h18
2 files changed, 7 insertions, 15 deletions
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);