随着多核/众核处理器技术的快速发展,程序需要越来越多地采用多线程并行技术以提升性能。随着线程个数的增多,线程并行运行过程中相互间同步/互斥及资源竞争关系更加复杂,导致程序性能优化的难度增大。为了使编程人员直观地了解线程的动态运行过程,特别是线程间同步及资源共享带来的影响,帮助其进行程序性能优化,设计实现了一种面向Pthread的并行程序线程性能分析工具PPAT(Pthreads program analysis tool),该工具可在程序运行过程中动态获取线程运行及线程间互斥/同步信息,生成线程通信图,并以多种可视化的方法显示,为编程人员优化程序性能提供依据。
With the development of multi/many-core processors' technology,growing multithreading parallel techniques will be required by the applications in order to enhance performances.However,along with the increase of threads number,the relations of synchronisation and mutual exclusion as well as resource competition in the process of parallel threads executions become more complex,and make the performance tuning more difficult.In this paper we design and implement the PPAT,a parallel program thread performance analysing tool for Pthread applications,in order to have the programmers intuitively learn the dynamic running process of the threads,in particular the influence affected by the synchronisation and resource sharing between the threads,and to assist them in program performance tuning.The tool can obtain dynamically during the program runtime the information of threads execution and mutual exclusion/synchronisation between threads,generate thread communication graph,and display in multiple visualisation approaches,these provide programmers a basis of program performance tuning.