ѧ
JOURNAL OF SOFTWARE
1999 2 No.2 1999



ԡܷһ廯
ǿ졡
ժҪŸоƬܼӦãǶԵҪٽڡȷԵԡǸһҪСܵԡȷԵĻϣͨԳϸ.ȷԵԺܵͨɶĹ֧֣ģʽѲܺܺõָ֧ܼ.һΪSIMDоƬƵͬʱȷԵԺܵԹܵĿӻ.ԡΪܷΪһ壬˸ܳĿڣΪܼṩǿ֧.
ؼʡ,ܷ,Ϊ,¼ɼ,ϵ,׮.
ͼšTP311
An Integrated Tool for Debugging, Monitoring and Performance Analysis 
LIU Qiang ZHANG Zhao-qing QIAO Ru-liang 
Abstract As the development of high-performance computing, the requirement for debugging is not only limited in correctness debugging, but also for performance debugging, which means to achieve the best performance through program tuning. The correctness debugging and the performance debugging are usually supported by the separate tools, which couldn't sufficiently support high-performance computing. A visualization tool is presented in this paper that supports both correctness debugging and performance debugging for a high performance SIMD chip. This tool incorporates the functionality of debugging, the behavior monitoring and the performance analyzing. It greatly improves the development cycle of high-performance computing programming.
Key wordsDebugging, performance analysis, behavior monitoring, events collecting, breakpoint, program instrumentation.
ǳ򿪷Ļ֮һ.㷨ƺ֮󣬳Ա༭ԵĿ.еĿой걸Դ뼶֧.һ棬Ÿܼ죬ԸܼܷߵΪһоȵ.Զ׼ģܼûܷΪǲ.ܷͨ˻¼ķ̬ʱԴп׮,ʱɼȤ¼,к¼Գܷ.ܷʱһ޸ĳٴν༭.ϵԺܷģܼͣгĿͼ1ʾ.

ͼ1ܷĿ
봫ͳĿȣܷѳΪܿҪһ.Ŀǰеĸܼƽ̨,PVM,EXPRESS֧Ͽ.ҹģм1000,Ϊ1000ܿӻParaVision,.ȻڶParaVisionùȴ¶ͼ1ʾĿڴڵ⣺(1) ÿڽȷԵԺܵԸΪ׶Ρߣʵʿ׶ǲе.(2) ܷڳִ֮Уȱԡʵʱԣʱ䳤ĳ򣬿Чʵͣڳ.
ϿڵĲ֮ʹʶԺܷһҪ.ΪһSIMDоƬƿĿУǽ뷨ʵ֣һ˳ԡΪܷΪһ廯ĹߡVisual-IDP(visualized integrated debugger and performance analysis toolIDP).ĽVisual-IDPʵԼԸܳ򿪷ڵȫ֧.
1ĿṹͿ
ĿǸܵĵָ(SIMD)ṹͼ2ʾ.

ͼ2Ŀϵṹ
ϵṹĽǶȿĿɿƴCEԪPEֲ洢LMȫִ洢GM͸DMAͨ岿.ܵĽǶȿǣΪʹڸת״̬Ӧ㣺
(1) PEм.ΪPEڼҪ,ʹPEʼմæ״̬ڴﵽ.PEеļҪȴݴGM䵽LM.
(2) LM-GMDMAͨ.Ӧͨſ.
ĿĿ-Ŀģͣͼ3ʾ.ΪPCվĿ֮ͨпڽͨϵ.ûPCϱдýĿִд룬ͨпڽĿװĿGMжִг.Visual-IDPͨпĿͨţʵֶSIMDԶ̵Ժͼ.

ͼ3Ŀģ
2IDPĽṹʵ
IDP˵ܷĹܣṹԸ.гԭעģ黯λͷװ.ͼ4IDPṹ.

ͼ4IDPṹ
2.1 Client/Serverģ
-Ŀģ͵IDPClient/Serverṹ.ClientϣServerĿϣͨнͨŽ.
IDP Client:Clientû룬ͨпĿͨţضĵԡ.IDP ClientڽṹϿԷΪ4εĹģ飺 GUIͼûӿڣԿӻʽʾΪ. ܲ㣺IDP壬ɵܷ.GUI书շֽΪIDP Client APIĵ. IDP Client APIIDPͻӦóӿ.Client API ǶĿķװͳʵͨĿ.Client APIװԶ̵ԵϸڣܲԲڱصԻԶ̵ԣϵͳģ黯ҪĹ.Client APIԱȽԭʼĲҪܰĿƺͶĿ״̬Ĵȡ. ͨŲ㣺ԴڵķװݵĴݣü򵥵ķ-ӦЭ.ͨŲƷдڲϸ.
IDP Server:ĿһвClient APIϣ޷ֱӶĿ,Client APIĹĿϵIDP Serverʵ.IDP ServerȴԴڵķͨĿĴڴֱӲṩ.
2.2 Ŀ
ĿIDPҪ.Ŀ״̬ͬʱΪͳṩӦϢ.ĿҪ¼ ¼.ɶϵСеȵԹĿ״̬ĸı.Ŀ¼͸ܵ¼ӦĵԶ. Ϊ¼.¼ͬ¼¼ռΪйص¼.Ŀյ¼󣬽¼е¼вһ֪ͨΪ.Ϊȡ¼УӻΪ.
2.3 
ͼ5ʾ˵ɽṹԼģĹϵ.3ε߼ģ飺ϢϢAPI͵Ĺ.һ,GUIͨClient APIĵöɺĹܵʵ.һ棬ĿϢĿ״̬.ڵѾһųļصԶ̵Եʵ.

ͼ5ṹģĹϵ
ԱػͬIDPҪԶ̵.ԹܵʵClient˺Server˹ͬЭ.ԶԶϵĴΪ
a=bld r0,&a*DebugTrap
st &b,r0st &b,r0
Уöϵʱǽϵ㴦ָΪDebugTrap.DebugTrapһǷָеϵִDebugTrapʱƴCEǷָ.Ƿָ⴦֪ͨIDP Server.ϣĿͨIDP ServerĽ⵽ķ.Ŀ¼֪ͨʹÿ,һĴ.
2.4 
ڵԣIDPһҪ.һڿӻΪһΪܷṩ.ܷĻڳ¼1ݣΧų¼Ҫ¼͵Ļ֡¼¼⡢¼ݡ¼ʾ¼.
2.4.1 ¼
ο1Ŀص,IDPӦԳΪӰ¼.
1 IDPļҪ¼ 

¼   Ҫ ¼
FUNC_ENTRYһʱṹ¼
FUNC_EXIT˳һʱṹ¼
SIMD_STARTPE㿪ʼʱ¼
SIMD_ENDPEʱ¼
WAIT_STARTĿʼȴͨʱͨ¼
WAIT_ENDĿȴͨʱͨ¼
DMA_STARTDMAʼʱͨŷͨ¼
DMA_ENDDMAʱͨ¼

1е¼Ϊ¼룺
(1) ṹ¼̺λãΪṩԴӦϢ.
(2) ¼ĴмͲм㣬ͳƳĲ.
(3) ͨ¼DMAͨſDMA_START.
¼Ϊܽ.¼ķԱܹٳȵ㣬ֳƿ.
2.4.2 ¼Ĳʹ
¼Ĳʹݻ֮ϵΪһ.ͼ4IDPṹУ϶£Ŀ¼IDP ServerIDP Client APIĿЭͬ.
¼Ĳ,ǲ˶ûп׮ (Instrumentation)ķ.иӾµķٳ¼,2,3.ּͻŵڼٶûĸţҪӲ֧һõݹԭʼڳ.ܵӲƶò׮ûһӰ죬ʵ֤,˷֮Ч.֮ͨûпвģGenEventEventType,EventDataʵ¼.GenEventʵΪ꣬ԴﵽЧ.磬DMAʼͨʱ´¼
QType=DMA_START;
QTime=Clock;
Q++;
If(Length(Q)>MAX_EVENT) NotifyIDPClient();
ϴУQĿе¼.ȫڴGMбһڴ¼.MAX_EVENTǶܹ¼.ϴִЧʣϴ뷭ɻֻ5ָںNotifyIDPClientIfÿMAX_EVENT¼ŵһθúMAX_EVENTϴʱÿ¼ĿǳСڣӶûӰҲǳС.
һ¼.¼ʱ¼ϢҪĿ͸.Client˺Server.Ŀϣ¼ʱִкNotifyIDPClientú£
NotifyIDPClient(){
EventFlag=1;
DebugTrap;
}
NotifyIDPClientָֻ.DebugTrapָʹû쳣ͣϵһ.ͬǣNotifyIDPClient֮ͣǰEventFlag־ֵ,ĿݸֳֵΪ¼͵¼.ͼ6¼ݡԺĿ֮Ľϵ.ͼ6УԶϵ¼ݵDebugTrapָʹĿֹͣ.ĿEventFlagֵжĿֹͣԭ.жϳֹͣ¼ݲʱ¼ϢĿжȡ¼УλEventFlag֮ʹĿ. 

ͼ6¼䡢ԺĿ֮Ĺϵ
Ͻ¼Ĳʹݻ.Ŀ֮ľϣʹԺܵ͵Ŀ͸ʵһ.
2.4.3 
ַʽ̨ʽͿӻʽ.ں̨ʽ£򵥵ؽ¼תļº.ӻʽ£״̬ͼοӵķʽʾû.
2.5 ܷ
ܷͨ¼еķ.¼ɼΪʵĻܷƾ.дĻ¼ܷﲻ.֮IDPݣ(1) ĿĲԼĿЧʱ.(2) ĿDMA֮ͨĲԼDMAͨŵͨ.
3IDPֵ֧Ŀ
2иIDPƺ͹֧ͼ7ʾĿ.ͼ1ʾĿȣIDPֵ֧Ŀھص㣺 ܷںϳΪһĲ. IDP֧ûͬʱгԡΪܷ.

ͼ7IDPֵ֧Ŀ
ͼ7ʾĿڶԴͳĿڵĸĽIDPƵĳ.ûʹõĽǶûԽIDPһڵʱ,ԼΪ۲ܣһ棬ûҲԽIDPһΪڼʱõǿ,翴ֵջ͵.IDP֧ûĿ.
4
IDPǽǴ¸ܼ㿪оеĳɹ.IDP˳ԡΪ⼰ܷܣЧ֧˸ܳĿ.ܼҪõĿ֧.IDPⷽ̽.IDP뷨ԭMPP(ģд)ϵͳӶ˼ƹ㵽Ϊ.
оõ863߿ƼĿ.
߽ܣǿ,1969,ʿ,ҪоΪϵͳ.
,Ů1938,оԱʿʦ,ҪоΪϵͳ.
,1937,оԱҪоΪϵͳ.
ͨѶϵ:ǿ 100076,к֪·76Ŵ乬BBT˾
ߵλǿ졡йѧԺ㼼оġ100080
E-mail: qliu@bbti.com.cn
ο
1Worley Patrick H. A New PICL Trace File Format. Oak Ridge National Laboratory: Mathematical Sciences Section, 1992
2TSAI Jeffrey J P, MEMBER, IEEE et al. A noninterference monitoring and replay mechanism for real-time software testing and debugging. IEEE Transactions on Software Engineering, 1990,16(8)
3Dodd Paul S, Racishankar Chinya V. Monitoring and debugging distributed real-time programs. Software-Practice and Experience, 1992,22(10)
1997-11-13յԭ,1998-04-01յ޸ĸ
