OPNET Worker99培训调试.ppt

上传人:laozhun 文档编号:2263374 上传时间:2023-02-07 格式:PPT 页数:68 大小:251.51KB
返回 下载 相关 举报
OPNET Worker99培训调试.ppt_第1页
第1页 / 共68页
OPNET Worker99培训调试.ppt_第2页
第2页 / 共68页
OPNET Worker99培训调试.ppt_第3页
第3页 / 共68页
OPNET Worker99培训调试.ppt_第4页
第4页 / 共68页
OPNET Worker99培训调试.ppt_第5页
第5页 / 共68页
点击查看更多>>
资源描述

《OPNET Worker99培训调试.ppt》由会员分享,可在线阅读,更多相关《OPNET Worker99培训调试.ppt(68页珍藏版)》请在三一办公上搜索。

1、Debugging Simulation Models(Introduction),Presented byYevgeny Gurevich,Goals,Teach use of OPNET Debugger(ODB)How to debug modelsReview features and commandsExplain their useDiscuss the debugging processStep-by step methods for debugging modelsWill not cover source-level debuggingC programmingSegment

2、ation violation,bus error,Agenda,Interpreting Error Messages Using the OPNET Debugger(ODB)Invoking ODBODB conceptsDevelopment KernelBreakpoints,traces,labels,maps,entity informationDiagnostic blockIdentification of memory allocationTwo hands-on labs use ODBUsing Animation for Debugging,The Challenge

3、,Debugging can be like finding a needle in a haystackNarrow down the problemTime(event#)Space(code segment)Different types of problemsStructuralSimulation fails to execute successfullyIllustrated in Lab 1BehavioralSimulation executes successfully,but does notaccurately represent modelers intentIllus

4、trated in Lab 2,Object Reference,Objects can be identified in two waysObject ID:Unique integer identifying objectObject Name:Hierarchical name of object:Format:.top.e_campus.bldg_10.router.in_queuetop.e_campus.bldg_10routerin_queue,Simulation Error Classifications,Simulation traps errorsClassified i

5、nto the following types:Program AbortProblem that prohibits the simulation from proceedingRecoverable ErrorProblem that does not prohibit the simulation from proceeding,but may result in cancellation of the current operation Diagnostic ErrorProblem that is recoverable,but minor;only reported ifdiag_

6、enable environment attribute is TRUEWarningTypically generated by model to identify problems withinmodel itself,written by model developer usingop_sim_message()Kernel Procedure(KP),Example of a Simulation Error Message,|-|Output stream index(1)is out-of-range.|T(21.4),EV(254),MOD(top.sample_net.stn_

7、5.mac),KP(op_pk_send)|-|Type:Type of error(recoverable error)Messages:Match in Kernel Procedure docs(non existing stream)T:Simulation time of errorEV:Event ID of simulation eventMOD:Name of module where error occurred(mac module of stn_5)KP:Name of Kernel Procedure that reported the problem,Obtainin

8、g a Function Call Stack(FCS),FCS provides the user withMore detailsLocates error in spaceContains function listingserr_log file in/op_admin records all FCSsThis file will grow over time and may be periodically removedm3_vuerr utility extracts last FCS from err_log-num_err attribute can be used to ex

9、tract the last N errors in case the error of interest is not the most recentExample:m3_vuerr-num_err 5,Example Function Call Stack,*Function call stack:(builds down)-Call Block Count Line#Function-0)1 141 main(argc,argv,envp)1)1 414 sim_init(argc,argv,envp,num_procs,proc_set_ptr)2)1 363 sim_ev_loop(

10、)3)17 212 sim_obj_qps_intrpt(simev_ptr)4)10 23 bursty_gen()init enter execs 5)10 57 op_pk_send(objid,direction,objmtype,index).6)1 123*sim_err_issue(pkg_id,msg_id,)7)1 181 sim_err_print(severity_level,str0,str1)8)1 282 Vos_Error_Print(level,package,err0,err1,err2)-,Sim.Kernel,ErrorMessagePrinting,Pr

11、ocess modeland state,KP reportingproblem,Block Line Numbers in Function Call Stacks,Block Line Numbers refer to last curly brace passed 1int function(void)23int x,z;45FIN(function(void)6z=0;A7for(x=0;x 10;x+)89printf(“z=%dn”,z);10z+=x;B1112FRET(z)C13Location A Reported block line number:5Location B

12、Reported block line number:8Location C Reported block line number:11,Concept:The Development Kernel,OPNET 6.0 includes two different Simulation Kernels:Optimized KernelRun simulations,collect statisticsFasterDevelopment KernelSame as optimized KernelPlus diagnostic information automatically collecte

13、dSlowerDevelopment Kernel must be used for most debugging activitiesIn order to see complete FCS,the process models and external files must be compiled with comp_trace_info,Using the Development Kernel,kernel_type environment attributecontrols which Simulation Kernel is used during a simulationTo se

14、t kernel_type to development:optimize_simulation environment file should not be usedCommand-lineop_runsim-kernel_type developmentGraphicalPreferences:set kernel_type to developmentThe same value will be used for every simulationcomp_trace_info environment attribute must be set to TRUEThis inserts ad

15、ditional trace information into compiled codeUse FIN/FOUT/FRET macros in custom functions,Concept:The OPNET Debugger(ODB),The same events are executed in debug and non-debug simsODB capabilitiesAllows you to gain interactive control of the simulationYou can issue commands to obtain detailed informat

16、ion aboutevents or objects of interestODB provides commands that allow user to:Execute single and multiple eventsSet breakpoints for specific events,times,modules,and processesTrace Kernel Procedures as they are being executedPrint out information about the current status of simulation entitiesPrint

17、 out statistics of memory usageAffect the course of the simulation by modifying object attributes,How to Activate/Invoke ODB,Use the debug environment attribute to activate ODBTo set the value of debug:From the Simulation Tool:Include debug environment fileExecuting simulation via op_runsim:Specify

18、on command lineop_runsim-debugExample use:op_runsim-net_name project1-scenario1-debug,Example:Invoking and Exiting ODB,Commands can be issued at odb promptTo exit the simulation:quit-terminates the simulation normally(creates output files)exit-immediately exits ODB,no output file created,%op_runsim-

19、net_name example-debug_ OPNET Simulation Debugger _Type help for Command Summaryodb,Time 0,before begsim interrupts are delivered,Getting Help in ODB,help command is available at odb prompthelp:displays summary of help categorieshelp:displays help on specified categoryhelp:displays help on specified

20、 command,odb help_ OPNET Debugger Help _ There are three levels of help:help-displays summary of help categories.help-display help on specified category.help-display help on specified command._ Command Categories builtin _ all basic action.,Agenda:ODB Concepts,BreakpointsTracesLabelsLab 1BreakMapsEn

21、tity InformationLab 2Diagnostic BlockIdentification of Memory Allocation,ODB Concept 1:Breakpoints,Interrupt simulation executionAllow the user to issue commands at the odb promptTwo methods of advancing simulation execution within ODB:Single event executionContinuation of event execution until a br

22、eakpoint occursCommandsnext-executes one event and stops before the next eventcont-continues simulation execution until a pending breakpointMay be equivalent to several next commands,Interpreting the Event Banner,At each breakpoint,event banner for next pending event is displayed_(ODB 6.0.L:Event)_*

23、Time:9.08349170694 sec,00d 00h 00m 09s.083ms 491us 706ns 942ps*Event:execution ID(10),schedule ID(#20),type(stream intrpt)*Source:execution ID(9),top.pksw1.node_0.src(ideal generator)*Data:instrm(1),packet ID(1)Module:top.pksw1.node_0.proc(processor)TimeSimulation time associated with the eventEvent

24、Event ID associated with the eventSourceModule generating the interruptTypeType of interrupt that will be deliveredDataOther information associated with the eventModuleSimulation object where the event will occur,Basic Breakpoint Commands,NextExecute the next pending event andset a breakpoint after

25、its completionThe following commands set breakpoints:evstopFor specified pending eventtstopFor specified timemstopFor all interrupts delivered to a specific moduleprostopWhen a specified process is about to be invokedintstopFor a specified module and type of interrupt,Status Command to Review Existi

26、ng Breakpoints,status command displays all pending breakpoints,odb evstop 34odb tstop 40odb statusBreakpoints:1)stop at event(34)2)stop at time=(40)sec.Traces:None,Deletion and Suspension of Breakpoints,Breakpoints may be deleted while still pendingCommand:delstopBreakpoints may be suspended,then re

27、-activated so that complete recreation is not necessaryCommands:suspstop,actstop,ODB Concept 2:Traces,A list of KPs called by a processUsed to print detailed information about event executionTypical traces:Display details of Kernel Procedures invoked during events,includingthe KP name,argument names

28、 and their values,return valueContain information about the process being executedOnce activated,a trace remains active until deactivated,Interpreting the ODB Process Message Format,*invoking process(“pk_sink”)_state(st_0):exit executives_*op_intrpt_strm()active strm(0)*op_pk_get(instrm_index)strm.i

29、ndex(0)packet ID(1)*op_pk_destroy(pkptr)packet ID(1)_state(st_1):enter executives_*returning from process(“pk_sink”),Process invocation,Process return,State banner,KP invocations,State banner,Interpreting the KP Invocation Trace Format,Kernel Procedure invocation argument valuesKernel Procedure retu

30、rn values,Basic Trace Commands,fulltrace:Global tracing of all KP invocationsToggles between enabled or disabledOther commands restrict traces to focused conditions:mtraceKPs invoked within a specified moduleprotraceKPs invoked within a specified module processpktraceKPs which affect a certain packe

31、tpttraceKPs which affect a certain packet trace,odb pktrace 5odb mtrace 11odb protrace 0odb statusBreakpoints:NoneTraces:0)trace on packet with ID(5)(packet not in system)1)trace on module(top.pksw1.node_0.proc)2)trace on process(0),Status Command to Review Existing Traces,status command displays al

32、l pending traces,Deletion and Suspension of Traces,Traces may be deletedCommand:deltraceTrace may be suspended,then re-activated so that complete recreation is not necessaryCommands:susptrace,acttraceIf fulltrace is active,fulltrace again toggles to inactive,ODB Concept 3:Labels,Labels may be establ

33、ished by process model code to allow traces restricted to classes of activity(print the values of state or temporary variables,results of statements)User-defined trace statements may be added to a process modelMany OPNET standard models use labelse.g.TCP,ATMCommands:ltrace:sets a trace for a specifi

34、ed labelExample:ltrace atmmltrace:sets a trace for a specified module and labelproltrace-sets a trace for a specified process model and label,_(ODB 6.0.L:Event)_*Time:972.409334997 sec,00d 00h 16m 12s.409ms 334us 997ns 496ps*Event:execution ID(15204),schedule ID(#15605),type(remote intrpt)*Source:ex

35、ecution ID(15203),top.Office network.DEVELOPMENT.tcp(processor)*Data:code(10)Module:top.Office network.DEVELOPMENT.tcp(processor)|Removing connection(14)from TCB list.,/*Print trace information if enabled*/if(op_prg_odb_ltrace_active(“tcp”)sprintf(msg0,“Removing connection(%d)from TCB list.”,conn_id

36、);op_prg_odb_print_minor(msg0,OPC_NIL);,Example:Label Trace,User-defined code in a that checks for a label and prints the relevant information:Output when running a simulation with the TCP trace turned on(ltrace tcp):,A Basic Debugging Paradigm,1.Locate the errorFrom error message,identify event num

37、ber of an error2.Stop the simulation at the last event before the errorIn ODB,evstop with that event numbercont to“skip ahead”to that event of interest3.Turn on traces fulltrace to turn on detailed tracenext to view execution details of the event of interest4.Inspect the traces5.Fix the problem,LAB:

38、Using evstop and fulltrace,Context:Packet Switching Tutorial model Packets are evenly routed between 4 nodes via a hubOpen Project Editor and load pksw_net modelOpen Lab1 scenario,Network Model,node_0 model,hub model,*Time:13:05:05 Mon Jul 19 1999*Program:op_runsim(Version 6.0.L PL5)*Error:Packet po

39、inter is NIL T(8.93569),EV(6),MOD(top.pksw1.node_1.proc),KP(op_pk_nfd_set),Error Message from pksw_net,1.Execute simulation from command lineop_runsim-net_name pksw_net-lab12.Inspect error message3.Note:Event ID 6,Obtain fulltrace Information of Error Event,1.Execute simulation in debug modeop_runsi

40、m-net_name pksw_net-lab1-debug-noprompt2.Set evstop for event 6(evstop 6)3.cont to continue until event 64.fulltrace to toggle global tracing5.next to execute pending event,_(ODB 6.0.L:Event)_*Time:8.9356938109 sec,00d 00h 00m 08s.935ms 693us 810ns 900ps*Event:execution ID(6),schedule ID(#14),type(s

41、tream intrpt)*Source:execution ID(5),top.pksw1.node_1.src(ideal generator)*Data:instrm(1),packet ID(0)Module:top.pksw1.node_1.proc(processor)breakpoint trapped:stop at event(6),Inspect fulltrace Information of Error Event,_state(xmt):enter executives_*op_pk_get(instrm_index)strm.index(0)strm.is empt

42、y.*op_dist_outcome(dist_ptr)dist.ptr.(0 x00893438)distribution(uniform_int(0.000000000000e+000,3.000000000000+000)outcome(1.0)*Time:15:05:54 Mon Jul 19 1999*Program:op_runsim(Version 6.0.L PL0)*Error:Packet pointer is NILT(8.93569),EV(6),MOD(top.pksw1.node_1.proc),KP(op_pk_nfd_set)6.Observe:packet a

43、rrived on stream 1,but op_pk_get()attempts to access stream 07.quit to quit ODB.,Edit Process Model,1.In the Project Editor double click onnode_1 to edit module proc module proc to edit process model pksw_nd_proc2.Edit enter executive of xmt stateChangepkptr=op_pk_get(RCV_IN_STRM)topkptr=op_pk_get(S

44、RC_IN_STRM)3.Compile process model,Execute Corrected pksw_net,prompt%op_runsim-net_name pksw_net-lab1|-|Module(11),(top.pksw1.node_0.proc)|From procedure:pksw_nd_proc()end enter execs|Node node_0:received 81 packets.|-|-|Module(22),(top.pksw1.node_1.proc)|From procedure:pksw_nd_proc()end enter execs

45、|Node node_1:received 0 packets.|-|-|Simulation Completed-Collating Results.|Simulated:Time(16 min.40 sec.),Events(1077)|Time:Elapsed(3 sec.)|-|,Break,ODB Concept 4:Maps,A list of simulation objects corresponding to some criteriaProvides object IDs and corresponding topological“location”Objects are

46、identified by name or object IDInspect state of simulation objects and packetsTypically:Selection of a specific object(RIP process at Router_4)Selection of all objects of a specific type(map of all queue objects in the simulation,packets from the same packet tree),odb objmap proc hubObj ID Obj Name

47、Obj Type Parent ID-55 top.pksw1.hub.hub processor 6,Interpreting Map Command Output,Packet switching tutorial network:Object ID:Unique integer identifying objectObject Name:Hierarchical name of objectObject Type:Description of class of objectParent ID:Obj ID of parent object,Basic Map Commands,objma

48、pList of objects matching specified criteriapromapList of processes associated with a specifiedprocessor or queueobjidObject id of a specified objectobjassocList of objects of the specified type that areassociated with the specified objectpkmap List of packets matching specified criteriaptmap List o

49、f packets belonging to a specified tree,ODB Concept 5:Entity Information,Commands can be applied to objects to display verbose information about the state of the objectExamples:Print the current state of a subqueue including list of packets it containsPrint contents of packet fields,Basic Entity Inf

50、ormation Commands,objprint:Display information about an object(attribute values,queue sizes and contents,process information)pkprint:Display information about a packet(ID,field values,current location,size)attrgetDisplay the current value of an attribute of an object attrsetAssign a new value to an

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号