Handmade Hero»Episode Guide
Fast Thread ID Retrieval
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:36Recap and plan for today
0:36Recap and plan for today
0:36Recap and plan for today
2:52On the benefits of having a nice inline profiling systemα
2:52On the benefits of having a nice inline profiling systemα
2:52On the benefits of having a nice inline profiling systemα
5:10The profiling system is only slow in the collation phase, and that is acceptable
5:10The profiling system is only slow in the collation phase, and that is acceptable
5:10The profiling system is only slow in the collation phase, and that is acceptable
6:45Limitations of the current implementation of the profiling system:
6:45Limitations of the current implementation of the profiling system:
6:45Limitations of the current implementation of the profiling system:
7:481) It is possible for the profiler to read bogus data under extremely improbable conditions
7:481) It is possible for the profiler to read bogus data under extremely improbable conditions
7:481) It is possible for the profiler to read bogus data under extremely improbable conditions
10:402) The debug records are not stamped with core and thread indices
10:402) The debug records are not stamped with core and thread indices
10:402) The debug records are not stamped with core and thread indices
11:00The core indices are not that important...
11:00The core indices are not that important...
11:00The core indices are not that important...
11:39... thread indices, on the other hand, are crucial
11:39... thread indices, on the other hand, are crucial
11:39... thread indices, on the other hand, are crucial
13:33Two options to disambiguate between threads:
13:33Two options to disambiguate between threads:
13:33Two options to disambiguate between threads:
13:371) Getting a thread index
13:371) Getting a thread index
13:371) Getting a thread index
14:322) Generating unique IDs with an atomic operation to pair our begin and end timed blocks
14:322) Generating unique IDs with an atomic operation to pair our begin and end timed blocks
14:322) Generating unique IDs with an atomic operation to pair our begin and end timed blocks
15:36Can we find out the thread index with a simple function call?
15:36Can we find out the thread index with a simple function call?
15:36Can we find out the thread index with a simple function call?
16:24How does GetCurrentThreadId work?
16:24How does GetCurrentThreadId work?
16:24How does GetCurrentThreadId work?
18:18It looks like GetCurrentThreadId only issues a couple of instructions to get the thread ID back
18:18It looks like GetCurrentThreadId only issues a couple of instructions to get the thread ID back
18:18It looks like GetCurrentThreadId only issues a couple of instructions to get the thread ID back
19:27Thread local storage
19:27Thread local storage
19:27Thread local storage
20:59Segmented addressing
20:59Segmented addressing
20:59Segmented addressing
23:47Is there some intrinsic that allows us to replicate GetCurrentThreadId's behavior?
23:47Is there some intrinsic that allows us to replicate GetCurrentThreadId's behavior?
23:47Is there some intrinsic that allows us to replicate GetCurrentThreadId's behavior?
26:45Yes, _readgsqword
26:45Yes, _readgsqword
26:45Yes, _readgsqword
27:40Replicating the behaviour of GetCurrentThreadId
27:40Replicating the behaviour of GetCurrentThreadId
27:40Replicating the behaviour of GetCurrentThreadId
27:48Debugger: Step in there after the jumpβ
27:48Debugger: Step in there after the jumpβ
27:48Debugger: Step in there after the jumpβ
29:51Testing our version
29:51Testing our version
29:51Testing our version
30:43It works!
30:43It works!
30:43It works!
31:23Recording the thread ID inside RecordDebugEvent
31:23Recording the thread ID inside RecordDebugEvent
31:23Recording the thread ID inside RecordDebugEvent
32:20Abstracting GetThreadId on the platform layer
32:20Abstracting GetThreadId on the platform layer
32:20Abstracting GetThreadId on the platform layer
35:55Unifying the timer counters of platform and game layers
35:55Unifying the timer counters of platform and game layers
35:55Unifying the timer counters of platform and game layers
36:58Exposing the debug system to the platform layer
36:58Exposing the debug system to the platform layer
36:58Exposing the debug system to the platform layer
40:28How do we find the locations of the debug structures?
40:28How do we find the locations of the debug structures?
40:28How do we find the locations of the debug structures?
41:35We could store them on the platform layer side...
41:35We could store them on the platform layer side...
41:35We could store them on the platform layer side...
42:09...or we could leave the debug arrays on the DLL side and use DLL binding to patch their addresses
42:09...or we could leave the debug arrays on the DLL side and use DLL binding to patch their addresses
42:09...or we could leave the debug arrays on the DLL side and use DLL binding to patch their addresses
42:54DLL binding with _declspec(ddlimport)
42:54DLL binding with _declspec(ddlimport)
42:54DLL binding with _declspec(ddlimport)
44:26Consolidating the debug structs into a single struct (debug_table)
44:26Consolidating the debug structs into a single struct (debug_table)
44:26Consolidating the debug structs into a single struct (debug_table)
48:40Using the TRANSLATION_UNIT_INDEX preprocessor symbol instead of RecordArrayIndexConstant
48:40Using the TRANSLATION_UNIT_INDEX preprocessor symbol instead of RecordArrayIndexConstant
48:40Using the TRANSLATION_UNIT_INDEX preprocessor symbol instead of RecordArrayIndexConstant
49:11Accessing only the debug_table from inside the debug-related routines
49:11Accessing only the debug_table from inside the debug-related routines
49:11Accessing only the debug_table from inside the debug-related routines
57:45Moving the necessary intrinsics to the platform layer
57:45Moving the necessary intrinsics to the platform layer
57:45Moving the necessary intrinsics to the platform layer
58:46Testing. There's a bug
58:46Testing. There's a bug
58:46Testing. There's a bug
1:00:42Getting rid of GlobalDebugEventArray
1:00:42Getting rid of GlobalDebugEventArray
1:00:42Getting rid of GlobalDebugEventArray
1:01:10And... we're back!
1:01:10And... we're back!
1:01:10And... we're back!
1:01:50Q&A
🗩
1:01:50Q&A
🗩
1:01:50Q&A
🗩
1:02:38elxenoaizd What do you think is an effective way to get better at assembly? Go over a book / tutorial? Read the code disassembly in VS? Mike Acton can look at a piece of code for a couple of seconds and estimate how many cycles it takes and what the assembly code for it is. I'd like to reach that level one day
🗪
1:02:38elxenoaizd What do you think is an effective way to get better at assembly? Go over a book / tutorial? Read the code disassembly in VS? Mike Acton can look at a piece of code for a couple of seconds and estimate how many cycles it takes and what the assembly code for it is. I'd like to reach that level one day
🗪
1:02:38elxenoaizd What do you think is an effective way to get better at assembly? Go over a book / tutorial? Read the code disassembly in VS? Mike Acton can look at a piece of code for a couple of seconds and estimate how many cycles it takes and what the assembly code for it is. I'd like to reach that level one day
🗪
1:04:57Pseudonym73 We're actually a pre-recorded laugh track
🗪
1:04:57Pseudonym73 We're actually a pre-recorded laugh track
🗪
1:04:57Pseudonym73 We're actually a pre-recorded laugh track
🗪
1:05:08insofaras How would you deal with switching between multiple APIs in a single application (like software / hardware renderer)? Would it be structured similar to the platform layer?
🗪
1:05:08insofaras How would you deal with switching between multiple APIs in a single application (like software / hardware renderer)? Would it be structured similar to the platform layer?
🗪
1:05:08insofaras How would you deal with switching between multiple APIs in a single application (like software / hardware renderer)? Would it be structured similar to the platform layer?
🗪
1:11:35elxenoaizd Why don't compilers expose API that gives us information about our code (access to the AST, etc.)? Because when we write a top-down parser we're essentially writing something that the compiler already has
🗪
1:11:35elxenoaizd Why don't compilers expose API that gives us information about our code (access to the AST, etc.)? Because when we write a top-down parser we're essentially writing something that the compiler already has
🗪
1:11:35elxenoaizd Why don't compilers expose API that gives us information about our code (access to the AST, etc.)? Because when we write a top-down parser we're essentially writing something that the compiler already has
🗪
1:14:35OriginalName667 Are you still using the software renderer or did you move over to DirectX or OpenGL?
🗪
1:14:35OriginalName667 Are you still using the software renderer or did you move over to DirectX or OpenGL?
🗪
1:14:35OriginalName667 Are you still using the software renderer or did you move over to DirectX or OpenGL?
🗪
1:14:40CaptainKraft At what point does a person become a good programmer? When do you think you became a good programmer?
🗪
1:14:40CaptainKraft At what point does a person become a good programmer? When do you think you became a good programmer?
🗪
1:14:40CaptainKraft At what point does a person become a good programmer? When do you think you became a good programmer?
🗪
1:15:46elxenoaizd How do you handle programmer burnout / depression? Those days when you're just not in the mood to do anything, not productive, you're demotivated, you can barely do any coding, you'd rather do 'anything' else other than what you should be doing
🗪
1:15:46elxenoaizd How do you handle programmer burnout / depression? Those days when you're just not in the mood to do anything, not productive, you're demotivated, you can barely do any coding, you'd rather do 'anything' else other than what you should be doing
🗪
1:15:46elxenoaizd How do you handle programmer burnout / depression? Those days when you're just not in the mood to do anything, not productive, you're demotivated, you can barely do any coding, you'd rather do 'anything' else other than what you should be doing
🗪
1:17:39inliferty Do you really prefer to save two unconditional jumps (so the CPU pipeline won't be flushed at any chance) instead of Compiler & Platform Independence (referring to the GetThreadId part)?
🗪
1:17:39inliferty Do you really prefer to save two unconditional jumps (so the CPU pipeline won't be flushed at any chance) instead of Compiler & Platform Independence (referring to the GetThreadId part)?
🗪
1:17:39inliferty Do you really prefer to save two unconditional jumps (so the CPU pipeline won't be flushed at any chance) instead of Compiler & Platform Independence (referring to the GetThreadId part)?
🗪
1:18:48thegujhack Why are you making an engine instead of a game?
🗪
1:18:48thegujhack Why are you making an engine instead of a game?
🗪
1:18:48thegujhack Why are you making an engine instead of a game?
🗪
1:21:27elxenoaizd Do you think implementing a regex matcher is worth it / useful for meta programming?
🗪
1:21:27elxenoaizd Do you think implementing a regex matcher is worth it / useful for meta programming?
🗪
1:21:27elxenoaizd Do you think implementing a regex matcher is worth it / useful for meta programming?
🗪
1:21:41obiwanus You seem to be pretty unhappy with the quality of modern software. Do you think programmers were better in the past? Is the software you produce always flawless and bugless? Asking seriously, just trying to understand your point more clearly. Thanksγ
🗪
1:21:41obiwanus You seem to be pretty unhappy with the quality of modern software. Do you think programmers were better in the past? Is the software you produce always flawless and bugless? Asking seriously, just trying to understand your point more clearly. Thanksγ
🗪
1:21:41obiwanus You seem to be pretty unhappy with the quality of modern software. Do you think programmers were better in the past? Is the software you produce always flawless and bugless? Asking seriously, just trying to understand your point more clearly. Thanksγ
🗪
1:27:21Wrap it up
🗩
1:27:21Wrap it up
🗩
1:27:21Wrap it up
🗩