Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Printf Function vs. C/C++ Logging: Debugging Techniques, Performance and Concurrency

Undo via YouTube

Overview

Coursera Plus Monthly Sale: All Certificates & Courses 40% Off!
This 14-minute video from Undo's WatchPoint series explores printf debugging techniques, performance considerations, and concurrency challenges in C/C++ programming. Dive deep into why printf debugging should be a last resort, especially when dealing with race conditions and "Heisenbugs" where adding print statements makes problems disappear. Compare performance benchmarks across various logging methods, from basic printf functions to file-based logging and C++ streams. Learn how traditional logging methods struggle with thread synchronization, requiring mutexes that impact performance. Discover more efficient alternatives like spdlog and the L3 lightweight logging library, which can achieve speeds as fast as 1 nanosecond per log entry using atomic operations and memory mapping techniques. The video covers essential concepts including race conditions, mutex locks, atomic operations, and non-blocking logging strategies for multithreaded applications. Follow along with timestamps that guide you through each topic, from basic performance benchmarking to advanced optimization techniques for multi-core systems. For developers looking to improve debugging efficiency while maintaining application performance, this tutorial provides practical insights and solutions for C/C++ logging challenges.

Syllabus

0:00 – Introduction to printf debugging
2:00 – Performance benchmarking of printf
4:00 – Using file-based logging for better performance
6:00 – Testing spdlog and its limitations
8:00 – Non-blocking logging using atomic operations
10:00 – Introduction to L3 and improvements
12:00 – Comparing L3 with traditional methods
14:00 – Conclusion and next steps for optimizing multithreaded logging

Taught by

Undo

Reviews

Start your review of Printf Function vs. C/C++ Logging: Debugging Techniques, Performance and Concurrency

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.