Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
user_config.h
1 /*******************************************************************************
2  * Copyright 2019 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files(the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions :
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  ******************************************************************************/
22 
39 // CPU INTRINSICS
40 
47 #if defined(GTS_HAS_CUSTOM_CPU_INTRINSICS_WRAPPERS) || defined(DOXYGEN_DOCUMENTING)
48 
56 #define GTS_PAUSE() #error "Replace with custom definition"
57 
67 #define GTS_RDTSC() #error "Replace with custom definition"
68 
76 #define GTS_MEMORY_FENCE() #error "Replace with custom definition"
77 
85 #define GTS_SPECULATION_FENCE() #error "Replace with custom definition"
86 
96 #define GTS_MSB_SCAN(bitSet) #error "Replace with custom definition"
97 
107 #define GTS_MSB_SCAN64(bitSet) #error "Replace with custom definition"
108 
109 #endif
110  // end of CpuIntrinsicsWrapper
112 
115 // C MEMORY WRAPPERS
116 
123 #if defined(GTS_HAS_CUSTOM_DYNAMIC_MEMORY_WRAPPERS) || defined(DOXYGEN_DOCUMENTING)
124 
136 #define GTS_MALLOC(size) #error "Replace with custom definition"
137 
147 #define GTS_FREE(ptr) #error "Replace with custom definition"
148 
162 #define GTS_ALIGNED_MALLOC(size, alignment) #error "Replace with custom definition"
163 
173 #define GTS_ALIGNED_FREE(ptr) #error "Replace with custom definition"
174 
175 #endif
176  // end of CMemoryWrapper
178 
181 // OS MEMORY WRAPPERS
182 
189 #if defined(GTS_HAS_CUSTOM_OS_MEMORY_WRAPPERS) || defined(DOXYGEN_DOCUMENTING)
190 
198 #define GTS_GET_OS_ALLOCATION_GRULARITY() #error "Replace with custom definition"
199 
207 #define GTS_GET_OS_PAGE_SIZE() #error "Replace with custom definition"
208 
217 #define GTS_GET_OS_LARGE_PAGE_SIZE() #error "Replace with custom definition"
218 
226 #define GTS_ENABLE_LARGE_PAGE_SUPPORT() #error "Replace with custom definition"
227 
239 #define GTS_OS_HEAP_ALLOCATE(size) #error "Replace with custom definition"
240 
250 #define GTS_OS_HEAP_FREE(ptr) #error "Replace with custom definition"
251 
270 #define GTS_OS_VIRTUAL_ALLOCATE(ptr, size, commit, largePage) #error "Replace with custom definition"
271 
286 #define GTS_OS_VIRTUAL_COMMIT(ptr, size) #error "Replace with custom definition"
287 
301 #define GTS_OS_VIRTUAL_DECOMMIT(ptr, size) #error "Replace with custom definition"
302 
316 #define GTS_OS_VIRTUAL_FREE(ptr, size)
317 
318 #endif
319  // end of OsMemoryWrapper
321 
324 // OS THREAD WRAPPERS
325 
332 #if defined(GTS_HAS_CUSTOM_THREAD_WRAPPERS) || defined(DOXYGEN_DOCUMENTING)
333 
334 #define GTS_CONTEXT_SWITCH_CYCLES #error "Replace with custom definition"
335 #define GTS_THREAD_AFFINITY_ALL #error "Replace with custom definition"
336 
337 #define GTS_THREAD_PRIORITY_HIGHEST #error "Replace with custom definition"
338 #define GTS_THREAD_PRIORITY_ABOVE_NORMAL #error "Replace with custom definition"
339 #define GTS_THREAD_PRIORITY_NORMAL #error "Replace with custom definition"
340 #define GTS_THREAD_PRIORITY_BELOW_NORMAL #error "Replace with custom definition"
341 #define GTS_THREAD_PRIORITY_BELOW_LOWEST #error "Replace with custom definition"
342 
343 #define GTS_THREAD_HANDLE_TYPE #error "Replace with custom definition"
344 #define GTS_THREAD_ID_TYPE #error "Replace with custom definition"
345 
346 #define GTS_THREAD_FUNCTION_DECL(name) #error "Replace with custom definition"
347 #define GTS_THREAD_FUNCTION_DEFN(cls, name) #error "Replace with custom definition"
348 
369 #define GTS_THREAD_AFFINITY_SET_TYPE #error "Replace with custom definition"
370 
390 #define GTS_CREATE_THREAD(threadHandle, tid, func, arg, stackSize) #error "Replace with custom definition"
391 
403 #define GTS_JOIN_THREAD(threadHandle) #error "Replace with custom definition"
404 
416 #define GTS_DESTROY_THREAD(threadHandle) #error "Replace with custom definition"
417 
433 #define GTS_SET_THREAD_GROUP_AFFINITY(threadHandle, groupId, affinitySet) #error "Replace with custom definition"
434 
448 #define GTS_SET_THREAD_PRIORITY(tid, priority) #error "Replace with custom definition"
449 
459 #define GTS_SET_THIS_THREAD_NAME(name) #error "Replace with custom definition"
460 
468 #define GTS_GET_THIS_THREAD_ID() #error "Replace with custom definition"
469 
477 #define GTS_GET_THIS_THREAD() #error "Replace with custom definition"
478 
492 #define GTS_SET_THIS_THREAD_GROUP_AFFINITY(groupId, affinitySet) #error "Replace with custom definition"
493 
505 #define GTS_SET_THREAD_PRIORITY(priority) #error "Replace with custom definition"
506 
514 #define GTS_YIELD_THREAD() #error "Replace with custom definition"
515 
525 #define GTS_THREAD_SLEEP(milliseconds) #error "Replace with custom definition"
526 
534 #define GTS_GET_HARDWARE_THREAD_COUNT() #error "Replace with custom definition"
535 
547 #define GTS_GET_CURRENT_PROCESSOR_ID(socketId, hwTid) #error "Replace with custom definition"
548 
551 // CPU TOPOLOGY
552 
578 #define GTS_CPU_CORE_INFO #error "Replace with custom definition"
579 
602 #define GTS_SOCKET_CORE_INFO #error "Replace with custom definition"
603 
629 #define GTS_NUMA_NODE_CORE_INFO #error "Replace with custom definition"
630 
670 #define GTS_PROCESSOR_GROUP_INFO #error "Replace with custom definition"
671 
694 #define GTS_SYSTEM_TOPOLOGY #error "Replace with custom definition"
695 
696 #endif
697  // end of OsThreadWrapper
699 
702 // OS EVENT WRAPPERS
703 
710 #if defined(GTS_HAS_CUSTOM_EVENT_WRAPPERS) || defined(DOXYGEN_DOCUMENTING)
711 
712 #define GTS_WAIT_FOREVER #error "Replace with custom definition"
713 #define GTS_EVENT_HANDLE_TYPE #error "Replace with custom definition"
714 
726 #define GTS_CREATE_EVENT(eventHandle) #error "Replace with custom definition"
727 
739 #define GTS_DESTROY_EVENT(eventHandle) #error "Replace with custom definition"
740 
754 #define GTS_WAIT_FOR_EVENT(eventHandle, waitForever) #error "Replace with custom definition"
755 
767 #define GTS_SIGNAL_EVENT(eventHandle) #error "Replace with custom definition"
768 
780 #define GTS_RESET_EVENT(eventHandle) #error "Replace with custom definition"
781 
782 #endif
783  // end of OsEventWrapper
785 
788 // ATOMICS
789 
796 #if defined(GTS_HAS_CUSTOM_ATOMICS_WRAPPERS) || defined(DOXYGEN_DOCUMENTING)
797 
798 // See: https://en.cppreference.com/w/cpp/atomic/memory_order
799 #define GTS_MEMORY_ORDER_RELAXED #error "Replace with custom definition"
800 #define GTS_MEMORY_ORDER_CONSUME #error "Replace with custom definition"
801 #define GTS_MEMORY_ORDER_ACQUIRE #error "Replace with custom definition"
802 #define GTS_MEMORY_ORDER_RELEASE #error "Replace with custom definition"
803 #define GTS_MEMORY_ORDER_ACQ_REL #error "Replace with custom definition"
804 #define GTS_MEMORY_ORDER_SEQ_CST #error "Replace with custom definition"
805 
807 #define GTS_ATOMIC_TYPE #error "Replace with custom definition"
808 
820 #define GTS_ATOMIC_LOAD(a, memoryOrder) #error "Replace with custom definition"
821 
831 #define GTS_ATOMIC_STORE(a, value, memoryOrder) #error "Replace with custom definition"
832 
844 #define GTS_ATOMIC_FETCH_ADD(a, inc, memoryOrder) #error "Replace with custom definition"
845 
857 #define GTS_ATOMIC_FETCH_AND(a, rhs, memoryOrder) #error "Replace with custom definition"
858 
870 #define GTS_ATOMIC_FETCH_OR(a, rhs, memoryOrder) #error "Replace with custom definition"
871 
883 #define GTS_ATOMIC_EXCHANGE(a, value, memoryOrder) #error "Replace with custom definition"
884 
898 #define GTS_ATOMIC_COMPARE_EXCHANGE_WEAK(a, expected, value, xchgMemoryOrder, loadMemoryOrder) #error "Replace with custom definition"
899 
913 #define GTS_ATOMIC_COMPARE_EXCHANGE_STRONG(a, expected, value, xchgMemoryOrder, loadMemoryOrder) #error "Replace with custom definition"
914 
915 #endif
916  // end of AtomicsWrapper
918 
921 // ASSERT
922 
929 #if defined(GTS_HAS_CUSTOM_ASSERT_WRAPPER) || defined(DOXYGEN_DOCUMENTING)
930 
945 #GTS_CUSTOM_ASSERT(expression, file, line) #error "Replace with custom definition or nothing."
946 
947 #endif
948  // end of AssertWrapper
950 
953 // TRACING
954 
961 #if defined(GTS_HAS_CUSTOM_TRACE_WRAPPER) || defined(DOXYGEN_DOCUMENTING)
962 
963 #include "gts/analysis/TraceCaptureMask.h"
964 #include "gts/analysis/TraceColors.h"
965 
966 #define GTS_TRACE_INIT #error "Replace with custom definition"
967 
968 #define GTS_TRACE_DUMP(filename) #error "Replace with custom definition or nothing."
969 
970 #define GTS_TRACE_NAME_THREAD(captureMask, tid, fmt, ...) #error "Replace with custom definition or nothing."
971 
972 #define GTS_TRACE_SET_CAPTURE_MASK(captureMask) #error "Replace with custom definition or nothing."
973 
974 #define GTS_TRACE_FRAME_MARK(captureMask) #error "Replace with custom definition or nothing."
975 
976 #define GTS_TRACE_SCOPED_ZONE(captureMask, color, fmt, ...) #error "Replace with custom definition or nothing."
977 #define GTS_TRACE_SCOPED_ZONE_P0(captureMask, color, txt) #error "Replace with custom definition or nothing."
978 #define GTS_TRACE_SCOPED_ZONE_P1(captureMask, color, txt, param1) #error "Replace with custom definition or nothing."
979 #define GTS_TRACE_SCOPED_ZONE_P2(captureMask, color, txt, param1, param2) #error "Replace with custom definition or nothing."
980 #define GTS_TRACE_SCOPED_ZONE_P3(captureMask, color, txt, param1, param2, param3) #error "Replace with custom definition or nothing."
981 
982 #define GTS_TRACE_ZONE_MARKER(captureMask, color, fmt, ...) #error "Replace with custom definition or nothing."
983 #define GTS_TRACE_ZONE_MARKER_P0(captureMask, color, txt) #error "Replace with custom definition or nothing."
984 #define GTS_TRACE_ZONE_MARKER_P1(captureMask, color, txt, param1) #error "Replace with custom definition or nothing."
985 #define GTS_TRACE_ZONE_MARKER_P2(captureMask, color, txt, param1, param2) #error "Replace with custom definition or nothing."
986 #define GTS_TRACE_ZONE_MARKER_P3(captureMask, color, txt, param1, param2, param3) #error "Replace with custom definition or nothing."
987 
988 #define GTS_TRACE_PLOT(captureMask, val, txt) #error "Replace with custom definition or nothing."
989 
990 #define GTS_TRACE_ALLOC(captureMask, ptr, size, fmt, ...) #error "Replace with custom definition or nothing."
991 #define GTS_TRACE_FREE(captureMask, ptr, fmt, ...) #error "Replace with custom definition or nothing."
992 
993 #define GTS_TRACE_MUTEX(type, varname) #error "Replace with custom definition or nothing."
994 #define GTS_TRACE_MUTEX_TYPE(type) #error "Replace with custom definition or nothing."
995 #define GTS_TRACE_WAIT_FOR_LOCK_START(captureMask, pLock, fmt, ...) #error "Replace with custom definition or nothing."
996 #define GTS_TRACE_WAIT_FOR_END(captureMask) #error "Replace with custom definition or nothing."
997 #define GTS_TRACE_LOCK_ACQUIRED(captureMask, pLock, fmt, ...) #error "Replace with custom definition or nothing."
998 #define GTS_TRACE_LOCK_RELEASED(captureMask, pLock) #error "Replace with custom definition or nothing."
999 
1000 #endif
1001  // end of TracingWrapper
1003  // end of Config