[video output=day255 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Building a Profile Tree" vod_platform=youtube id=6Ym-Nq1g7-s annotator=Miblo]
[0:11][Set the stage for the day]
[0:32][Problem #1: No fast way to get out the profiling information for the previous frame]
[1:06][Problem #2: In order to print out the profile view we need some concept of the nesting of calls inside one another]
[4:01][Blackboard: Profile Queries]
[6:43][Hype the new version of 4coder]
[7:52][handmade_debug.cpp: Enable the profiler]
[8:12][Run the game and hit an InvalidCodePath as we overflow the PushBuffer of the renderer]
[14:25][handmade_debug.cpp: Disable the profiler]
[15:02][handmade_debug.h: Add StoredEventCount, ProfileBlockCount and DataBlockCount to debug_frame]
[16:32][handmade_debug.cpp: Increment these values in StoreEvent and CollateDebugRecords]
[17:37][handmade_debug.cpp: Print out these values]
[18:45][Run the game and see what those numbers look like]
[21:40][Consider how to process this data]
[24:31][handmade_debug.h: Introduce debug_profile_node]
[30:01][handmade_debug.cpp: Make DrawProfileIn take a debug_profile_node and work through how to use it]
[39:15][handmade_debug.cpp: Make the DrawProfileIn call in DEBUGDrawElement take RootProfileNode]
[43:55][handmade_debug.h: Use debug_stored_events in debug_profile_node]
[47:25][Be Mr Cheesy - Mr Cheesepants, Cheese man][quote 430]
[48:03][handmade_debug.cpp: Set debug_stored_event *Node to the result of StoreEvent (via *StoredEvent) and then immediately rewrite it]
[59:54][Run the game and see that we're never adding anything to the RootProfileNode]
[1:00:34][handmade_debug.cpp: Conditionally set the ParentEvent in BeginBlock]
[1:05:21][handmade_debug.cpp: Setup the children in BeginBlock]
[1:06:35][Debugger: Step into DrawProfileIn and inspect the RootEvent]
[1:08:06][handmade_debug.cpp: Correctly set the Node's Duration]
[1:10:48][Run the game and admire the bizarre results]
[1:11:11][Q&A][:speech]
[1:11:51][@insobot][Need to find a whole os is that we get a taste again... For some! Implementing merge?]
[1:12:00][@grumpygiant256][Will the day-counter overflow tomorrow, or will The Variable provide more bits for us?]
[1:12:17][@desuused][How are you going to celebrate Handmade Hero episode 0xFF?]
[1:13:23][@cubercaleb][Soon enough we will need 10 bits to store the day counter!]
[1:14:40][@cubercaleb][We may even need 11 bits!]
[1:15:00][@guitarm87][How long will it take me to get your "flow" of coding? 40 years?]
[1:15:24][@fartasanelk][What kind of data is the profiler intended to display?]
[1:16:26][@ravicavus][Do you know what the total line count is at?]
[1:16:55][@cubercaleb][Will you be able to turn on / off profiling for certain functions with the debug UI?]
[1:17:36][@theinternetftw][ A big part of the slow startup for me is that the ModeArena is cleared to zero by default at the moment. That's about 256MB]
[1:18:39][win32_handmade.cpp: Set GlobalRenderingType to software]
[1:20:07][Run the game and witness a very slow fade]
[1:21:11][build.bat: Stop linking with opengl32.lib]
[1:22:02][win32_handmade.cpp: Switch back to OpenGL and witness a longer startup]
[1:22:48][Wind down, wrap it up][:speech]
[1:23:47][Anticipate new 4coder][:speech]
[/video]
