BUNGALOW POD. MULTI POD MULTI POD – END UNIT MULTI POD COMBO POD – COMBINED INNER AND END UNIT.
Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA...
Transcript of Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA...
![Page 1: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/1.jpg)
XDS560 Trace
Daniel Rinkes
Texas Instruments
Advanced Use Cases for
Profiling
![Page 2: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/2.jpg)
Agenda
• AET / XDS560Trace Overview
• Interrupt Profiling
• Statistical Profiling
• Thread Aware Profiling
• Thread Aware Dynamic Call Graph
![Page 3: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/3.jpg)
Agenda
• AET / XDS560Trace Overview
• Interrupt Profiling
• Statistical Profiling
• Thread Aware Profiling
• Thread Aware Dynamic Call Graph
![Page 4: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/4.jpg)
What is AET / XDS560 Trace
• XDS560 Trace Allows Cycle Accurate Logging of CPU Address Bus and Data Bus Activity Non-Intrusively, in Real Time
• Advanced Event Triggering (AET) is logic that allows us to smartly turn trace on in interesting locations and off in non-interesting locations so as to preserve the trace buffer for interesting data
![Page 5: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/5.jpg)
XDS560 Trace Architecture
Additional JTAG Emulation Pins
DATA ADDRESS BUSSES
DATA BUSSES
PROGRAM BUS
DSP
XDS560T POD
CPU
XDS560T POD RECORDING
UNIT
• Current Buffer Size: 224K
• Future: 64 MB To/from host PC
Trace & AET Jobs
Comparators
Compressor
Cycle counter
![Page 6: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/6.jpg)
Required Software and Hardware
• 60 Pin emulation header
• Target must support
Trace (Full-Gem)
• Blackhawk USB 560
• XDS560T Trace
Pod/Cable
• CCS 3.30 or higher
![Page 7: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/7.jpg)
64x+ Device Support For Trace
SUPPORT TRACE
• C6455
• C6488
• DM647/DM648
DO NOT SUPPORT TRACE
• DM6443/DM6446
• Any LC Device
![Page 8: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/8.jpg)
Agenda
• AET / XDS560Trace Overview
• Interrupt Profiling
• Statistical Profiling
• Thread Aware Profiling
• Thread Aware Dynamic Call Graph
![Page 9: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/9.jpg)
Interrupt Profiling Overview
• Capture Program
Address and
Timestamp whenever
the PC is within the
Interrupt Vector Table
• Generate a cycle
accurate picture of
when each interrupt
starts executing
Graphically display
interrupt cycle accurate
interrupt servicing
frequency
![Page 10: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/10.jpg)
0x00897C68 102458
102462102463Cycle Count 102456102457102458102459102460102461
Trace Log
PC Cycles
0x00897C64 102457
0x00897C6C 102459
0x00897C70 102460
0x00897C74 102461
0x00897C78 102462
0x00897C7C 102463
0x00897C60 102456
![Page 11: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/11.jpg)
Data CapturedRaw Trace Data Processed Data
![Page 12: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/12.jpg)
Results
![Page 13: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/13.jpg)
Results - 2
![Page 14: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/14.jpg)
Agenda
• AET / XDS560Trace Overview
• Interrupt Profiling
• Statistical Profiling
• Thread Aware Profiling
• Thread Aware Dynamic Call Graph
![Page 15: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/15.jpg)
Statistical Profiling
GOAL
Get a quick overall view of which
functions in an application
consume the most
cycles
• Sampling every Program Counter in an application
quickly consumes Trace
Buffer Bandwidth, preventing analysis of the
entire application
• We can eliminate this
problem by only capturing a statistical sample of
application execution
![Page 16: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/16.jpg)
Statistical Profiling Overview
Fxn1
Fxn2
Fxn3
Fxn4
Fxn5
Fxn6
4 4 2 5 3 3 2 2 2 3 3 6 6 4 4
• The Program Address is sampled at regular intervals
• Statistical Analysis is performed on the captured samples
• As in any statistical analysis, the determinations made on
the statistical sample can be related to the general
population
![Page 17: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/17.jpg)
Statistical Profiling - 2
• AET contains all of the hardware needed to capture trace samples at a specified interval
• Interval should be carefully chose so as not to coincide with a periodic function
• Application instrumentation can switch AET off in locations that are not of interest
![Page 18: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/18.jpg)
Statistical Profiling - Results
• Comma Separated
Value Format
• Sorted from most
intensive functions to
least
![Page 19: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/19.jpg)
Agenda
• AET / XDS560Trace Overview
• Interrupt Profiling
• Statistical Profiling
• Thread Aware Profiling
• Thread Aware Dynamic Call Graph
![Page 20: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/20.jpg)
Thread Aware Profiling
GOAL
Generate a cycle
accurate execution
graph of a
Thread/Task based
application
Time (cycles)
![Page 21: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/21.jpg)
Solution
• Instrument the task/thread switch function to write the task/thread ID to a well known location (global variable)
– Operating systems typically provide hooks to
insert functions in this location
• Trace all of the writes to that location, and get a timestamp with each.
![Page 22: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/22.jpg)
Results
![Page 23: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/23.jpg)
Agenda
• AET / XDS560Trace Overview
• Interrupt Profiling
• Statistical Profiling
• Thread Aware Profiling
• Thread Aware Dynamic Call Graph
![Page 24: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/24.jpg)
Thread Aware Dynamic Call Graph
GOAL
Display a Thread Based
representation of
actual function
execution in an
application200
200
132
68
65
![Page 25: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/25.jpg)
Capturing the Data
• Thread/Task– Hook function writes address of task
• Function– Entry/Exit points instrumented with Mark 0/ Mark 1
instructions*• Mark 0 inlined at each function entry point
• Mark 1 inlined at each function exit point
– Trace captures each of these locations with timestamp
* CGT 6.0.1 enables function hooks
![Page 26: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/26.jpg)
Presentation
• Graphical Displays
become impractical
as the number of
functions increase
• At right is a sample
call graph displayed
by the Guess
graphing package
![Page 27: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/27.jpg)
GPROF Like Format
• Modeled after Unix GPROF
• Each Thread separated into it’s own subsection
• Each function section contains only immediate callers and callees
![Page 28: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/28.jpg)
A Closer Look
Primary Line -
describes the function
which the entry is
about and gives the
overall statistics for this
function
Lines for a Functions
CallersLines for a Functions
Callees
![Page 29: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/29.jpg)
Thread: 0x828194
_DEC_tcp2DeintUnpunctsoft3
_DEC_tcp2QuantizeSoft
_DEC_tcp2PreProc
_varianceEstim
_COM_spoolTsk
_COM_spoolPost
_DEC_tcp2EdmaIsr
_DEC_tcp2DeintUnpunctsoft3
Callers
Callees
_DEC_tcp2DeintUnpunctsoft3
Callers
_DEC_tcp2PreProc
Calls = 388/388
Exclusive Cycles = 14491050
Future Display – Tree View
![Page 30: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/30.jpg)
Questions?
![Page 31: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/31.jpg)
Backup Material
![Page 32: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/32.jpg)
Statistical vs Traditonal Profiling
0.00%
10.00%
20.00%
30.00%
40.00%
Function
% of TimeTraditional
Statistical
Traditional 2.27% 25.00 29.55 27.27 4.55% 11.36
Statistical 0.00% 25.00 33.33 16.67 8.33% 16.67
Fxn1 Fxn2 Fxn3 Fxn4 Fxn5 Fxn6
Comparison vs. Traditional
•The Results of the statistical profile tend to
approximate those found using traditional
profiling.
![Page 33: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/33.jpg)
Advanced Event Triggering Overview
![Page 34: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/34.jpg)
Use Case Examples
• Simple
– Read/Write Data Location
– Read/Write Data Range
– Specific Value Read/Write
to/from Specific Location
• Medium
– Read/Write to location A, but
only after executing instruction
B
• Complex
– Read/Write to location A, but
only after executing instruction
B at least 20 times
• CPU Halt
• Interrupt
• Start/Advance Counter
• Stop/Reload Counter
• Start Trace
• Store Trace Sample
• End Trace
• External Trigger (EMU 0/1)
• State Transition
![Page 35: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/35.jpg)
AET Target LIbrary
• What is it?
– A Target Library to allow programming of AET resources from the target application
• Advantages over CCS AET Plug-in?
– Context based control of where AET is enabled/disabled
– Ability to reallocate AET resources on the fly
– Some functionality not inherently contained in the plug-in
• Disadvantages
– Some Application cycles consumed
– Some Application footprint used
![Page 36: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/36.jpg)
Use Case
• Consider: Thread based application crashing because of a suspected overflow of one of the task stacks.
• Would like to use AET to monitor the top of the task stacks and generate an interrupt when we get too close
to the top
• Problems
– All of the threads are dynamically created at run time, so there’s no way to know where the top of the dynamically allocated stack will be located at load time.
– There are numerous threads, and AET resources are consumed by ONE “Watchpoint In Range” job
![Page 37: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/37.jpg)
Solution
• Use the AET Target Library
• All Operating Systems (DSP/Bios, OSE, etc) have a
thread switch function that occurs when switching tasks. The user can place code in this hook that gets executed
every time a thread switches context.
• In this function, program AET to watch the top of the stack of the NEXT thread.
• Every subsequent time that the thread is switched, delete the old AET job, and program a new one.
![Page 38: Daniel Rinkes Texas Instruments · XDS560 Trace Architecture Additional JTAG Emulation Pins DATA ADDRESS BUSSES DATA BUSSES PROGRAM BUS DSP XDS560T POD CPU XDS560T POD RECORDING UNIT](https://reader034.fdocuments.in/reader034/viewer/2022050405/5f82159687d59c460f08cb64/html5/thumbnails/38.jpg)
Solution - 2
• What does this accomplish?
– Reuse of resources
• By removing the prior AET job, you are reclaiming the resources (trigger builder and comparators) that were used.
• Additionally, AET is only watching the CURRENT stack at a given time. Thus we’re able to manage with the 4 data comparators that are available.
– Dynamic Task Location
• By programming AET at run time, we can know where the dynamically allocated tasks are placing their stack.
• This method also works perfectly well for statically allocated tasks.