3 void __static_init() {}
4 #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
5 void __static_init_late() {}
6 #define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_late)
7 void __static_init_precache() {}
8 #define static_init_precache() CALL_ACCUMULATED_FUNCTION(__static_init_precache)
10 #define shutdownhooks() CALL_ACCUMULATED_FUNCTION(__shutdown)
12 #define GETTIME_REALTIME 1
14 float(int tmr) _gettime = #67;
16 float(int tmr) _gettime = #519;
20 void profile(string s)
22 static float g_starttime;
23 float rt = _gettime(GETTIME_REALTIME);
24 if (!g_starttime) g_starttime = rt;
25 LOG_TRACEF("[%f] %s", rt - g_starttime, s);
28 #define _STATIC_INIT(where, func) \
29 [[accumulate]] void _static_##func() { profile(#func); } \
30 ACCUMULATE_FUNCTION(where, _static_##func) \
33 #define STATIC_INIT(func) _STATIC_INIT(__static_init, func)
34 #define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init_late, func##_late)
35 #define PRECACHE(func) _STATIC_INIT(__static_init_precache, func##_precache)
36 #define SHUTDOWN(func) _STATIC_INIT(__shutdown, func##_shutdown)