[video output=day258 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Fixing Profiling Across Code Reloads" vod_platform=youtube id=UxV5GFeCEAc annotator=Miblo] [0:39][handmade.prj: Move the .prj files from the code to the root directory] [1:11][Recap and set the stage for the day] [2:38][Run the game, do a hot-reload and note that the profile is busted] [3:48][Explain the debug collation situation in terms of multithreadedness] [8:45][Consider how to potentially solve the problem] [12:19][win32_handmade.cpp: Flush all the queues, do FrameEnd and then finally do the hot-reload] [14:58][Run the game, attempt to hot-reload, and hang] [15:54][Debugger: Investigate what's going on here] [17:52][Explain the bug: Upon hot-reloading, we go back through the collation code because there was no collation code to call] [19:07][win32_handmade.cpp: Try loading the game code multiple times during collation] [21:43][Run the game and try hot-reloading] [22:21]["How about you actually check to see if it's loaded, Muratori!"][quote 440] [22:34][win32_handmade.cpp: Fix the LoadTry loop] [23:03][Run the game and try that one more time] [23:32][Debugger: Investigate what's going on] [24:45][Blame it on the code][quote 441] [26:21][handmade_cutscene.h: Introduce struct cutscene and enum cutscene_id] [29:26][Run the game and find that we're not safe across reloads in the cutscene mode] [30:29][Debugger: Break on Win32UnloadGameCode and inspect the GlobalDebugTable] [34:00][A thought][quote 442] [34:24][win32_handmade.cpp: Disable the EventRecording while we reload] [39:18][win32_handmade.cpp: Enable the EventRecording initially] [39:51][Run the game and...] [40:23][Admire the lovely profiler][quote 443] [40:55][build.bat: Switch to -O2 and see how the profiler fares] [41:56][Happy puppy][quote 445] [42:03][Q&A][:speech] [42:40][@erafo][Not sure if this was asked before but is it worth to use static_cast instead of a C-style cast that does static_cast, dynamic_cast and reinterpret_cast, if you know that you only need the first?] [43:32][Demo: C-style cast] [48:19][Demo: C++ dynamic_cast] [51:29][@cubercaleb][How exactly did they mess up casting in C++?] [53:21][@novynn][dynamic_cast will return 0 if it fails] [53:39][@evraire][Is the debug view for bitmaps working again?] [54:15][@rooster441][For string manipulation, is there a library worth to use in C/C++? I could do it with Python but I'd like to use C] [54:57][@deepmist][You are spending a lot of time on debug tools before you need them. Is it going to be worth it?] [58:07][@cubercaleb][Speaking of string libraries, what kinds of things do you think should be in a good string library?] [59:36][@insobot][@expixel: Hand banana hero. You rock] [59:40][Andrew Chronister: "Insobot is a national treasure"][quote 444] [1:00:01][@cubercaleb][Does using VirtualAlloc and reserving a lot of memory upfront count?] [1:01:16][@cubercaleb][Well I meant using MEM_RESERVE then MEM_COMMIT so that you can append quickly without the copy] [1:01:40][Go eat dinner][:speech] [1:02:24][Promote Martins Mozeiko][:speech] [1:03:05][Mention HandmadeCon 2016][:speech] [1:03:46][Promote 4coder][:speech] [/video]