7.7. Threads trace Tool
A tool to trace thread execution using the New POSIX Threads Library (NPTL) with as few intrusions as possible is available through an open-source project called NPTL trace tool. The tool, designed to help developers of multithreaded applications, can generate a trace that describes the behavior of threads and provide help needed to understand complex situations such as race conditions, deadlocks, and lock contentions.
The trace tool starts when the application to be traced starts executing and stops as soon as the application stops. The trace produced can be viewed in text or graphical format. As of this writing, the tool is available only as a beta version (0.8.1). It currently traces 15 of the most common POSIX thread routines and four objects. Platforms currently supported by the trace tool are the IA32, IA64, and PowerPC architecture.
The tool requires the user to download the glibc source and apply several patches to the NPTL library. These patches are included in the NPTL TRace tool distribution and add the necessary trace hooks needed to trace thread execution. Although the tool is in its early stages of development, it shows how the open-source community contributes to the advancement of Linux.