Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/PIL_time.h')
-rw-r--r--source/blender/blenlib/PIL_time.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h
index 6cb4cf6ffcf..82869035d50 100644
--- a/source/blender/blenlib/PIL_time.h
+++ b/source/blender/blenlib/PIL_time.h
@@ -29,6 +29,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+/** \file blender/blenlib/PIL_time.h
+ * \ingroup bli
+ */
+
#ifndef PIL_TIME_H
#define PIL_TIME_H
@@ -51,9 +56,29 @@ double PIL_check_seconds_timer (void);
*/
void PIL_sleep_ms (int ms);
+/** Utility defines for timing.
+ * requires BLI_utildefines.h for 'AT'
+ * TIMEIT_VALUE returns the time since TIMEIT_START was called.
+ */
+#define TIMEIT_START(var) \
+{ \
+ double _timeit_##var= PIL_check_seconds_timer(); \
+ printf("time start (" #var "): " AT "\n"); \
+ fflush(stdout); \
+ { \
+
+
+#define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var)
+
+
+#define TIMEIT_END(var) \
+ } \
+ printf("time end (" #var "): %.6f" " " AT "\n", TIMEIT_VALUE(var)); \
+ fflush(stdout); \
+} \
+
#ifdef __cplusplus
}
#endif
-#endif
-
+#endif /* !PIL_TIME_H */