diff options
author | chai <chaifix@163.com> | 2019-12-04 00:07:32 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-12-04 00:07:32 +0800 |
commit | 2e82e2ddd0852b8063a3d6645366f53ee844e273 (patch) | |
tree | 41ec10760f2d2c9f1f782a918f48e1287da2a4b4 /src/util |
+init
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/assert.h | 9 | ||||
-rw-r--r-- | src/util/time.c | 5 | ||||
-rw-r--r-- | src/util/time.h | 24 | ||||
-rw-r--r-- | src/util/type.h | 7 |
4 files changed, 45 insertions, 0 deletions
diff --git a/src/util/assert.h b/src/util/assert.h new file mode 100644 index 0000000..563e991 --- /dev/null +++ b/src/util/assert.h @@ -0,0 +1,9 @@ +#ifndef _SOFTSHADEROOM_ASSERT_H_ +#define _SOFTSHADEROOM_ASSERT_H_ + +#include <assert.h> + +#define ssr_assert assert + + +#endif
\ No newline at end of file diff --git a/src/util/time.c b/src/util/time.c new file mode 100644 index 0000000..5bfc936 --- /dev/null +++ b/src/util/time.c @@ -0,0 +1,5 @@ +#include "time.h" + +clock_t sharedTick; + +const char* sharedTickHint; diff --git a/src/util/time.h b/src/util/time.h new file mode 100644 index 0000000..6b850b4 --- /dev/null +++ b/src/util/time.h @@ -0,0 +1,24 @@ +#ifndef _SOFTSHADEROOM_TIME_H_ +#define _SOFTSHADEROOM_TIME_H_ + +#include <time.h> +#include "assert.h" + +extern clock_t sharedTick; +extern const char* sharedTickHint; + +#define TIME_STAMP(hint) \ +ssr_assert(!sharedTickHint);\ +sharedTickHint = hint;\ +sharedTick = clock();{ +#define TIME_STAMP_END \ +}\ +sharedTick= clock()-sharedTick;\ +printf("%s : %.10fs %ldtick\n", sharedTickHint, sharedTick / (double)CLOCKS_PER_SEC, sharedTick);\ +sharedTickHint = 0; +#define TIME_STAMP_i(hint, i)\ +TIME_STAMP(hint);}\ +for(int _i = 0; _i < i; ++_i){ +#define TIME_STAMP_1000000(hint) TIME_STAMP_i(hint, 1000000) + +#endif
\ No newline at end of file diff --git a/src/util/type.h b/src/util/type.h new file mode 100644 index 0000000..709cb32 --- /dev/null +++ b/src/util/type.h @@ -0,0 +1,7 @@ +#ifndef _SOFTSHADEROOM_TYPE_H_ +#define _SOFTSHADEROOM_TYPE_H_ + +typedef unsigned int uint; +typedef int bool; + +#endif
\ No newline at end of file |