Playback speed
Share post
Share post at current time

Paid episode

The full episode is only available to paid subscribers of Computer, Enhance!

Q&A #25 (2023-09-04)

Answers to questions from the last Q&A thread.

In each Q&A video, I answer questions from the comments on the previous Q&A video, which can be from any part of the course. Transcripts are not available for Q&A videos due to length. I do produce closed captions for them, but Substack still has not enabled closed captions on videos :(

Questions addressed in this video:

  • [00:19] “How would you go about measuring memory usage of your program (peak, average, etc)? Is it possible to link memory usage to specific functions in some way?”

  • [05:17] “In my work, I cannot go for the single translation unit option using the __COUNTER__ macro to figure out the anchor index in the profile sample array because our code base is huge and consists of multiple libraries built as different translation units. What would you recommend for a similar C/C++ profiler that cannot be built as a unity build/single translation unit and still retain the ‘inject profile sample by one-line macro’ ease of use?”

  • [09:23] “I noticed that the ‘Max:’ line of each read tester function - fread, _read, and ReadFile - are the same. The 104 listing shows that the code is reusing the tester on each iteration so each tester function seems to be updating the Min and Avg but not the Max. Is that an intentional choice? I was surprised we're not resetting the Max between passes so that we can see what the Max would be on repeat runs.”

  • [11:57] “Why do you say using thread local storage has an overhead when compared to using something else for a profiler global pointer? Can you explain why is that the case for your profiler?”

  • [14:33] “How do you handle numerical precision in contexts where this is a critical requirement (e.g. engineering, accounting, finance, etc.)?”

The full video is for paid subscribers

Programming Courses
A series of courses on programming topics.