Part Number: TMS320C6678
Background:
In addition to a test automation framework, I also want to implement a benchmark automation framework which collects profiling statistics. The most important profiling quantity is the number of CPU cycles a certain code snippet needed. However, other quantities such as cache misses would also be nice. A code snippet is defined via 2 breakpoint hits, namely, a breakpoint which defines the starting point and a breakpoint which defines the endpoint. This code snippet could be run several times, so that we create an array of a specific profiling quantity. At the end we derive some statistics (Average, median, max, min, ...) from this array. From my point of view, we can benchmark highly dynamic code snippets and account for changing circumstances over time.
Problem:
So far I have found out several ways to implement my approach. However, each approach comes along with one or several issues.
- 1) I could use a breakpoint of type "Count Event". This approach enables me to profile a bunch of events. However, as soon as the code snippet which is defined by the "Start Location" and "End Location" is run several times, I have no clue how to accumulate my profiling data in an array. My experience I've made so far says that the counts are accumulated. Well, this certainly prevents me of deriving statistics. I could imagine, that I could implement a GEL-File in combination with another breakpoint which is hit after my endpoint breakpoint. That would enable me to retrieve the current count value, but that sounds like smelling code.
- 2) I could define 2 breakpoints of type "Breakpoint" in combination with an action "Execute Expression (GEL)". These breakpoints define my to be profiled code snippet. On each breakpoint hit, I read the TSCL value, which enables me to determine at least how much CPU cycles were needed for this code snippet. However, this approach comes along with 2 issues: I can only profile CPU cycles, my CPU count value does not equal the reference value of approach 1). The first issue is not a big deal, because the most import quantity is the number of CPU cycles. However, the great difference between this approach and the "Count Event" approach is certainly a problem, because I assume they must be in the same range.
Questions:
- 1) What would be the recommended way to implement a profiling algorithm which also supports statistics?
- 2) If the "Count Event" approach is the way to go, is there any approach to add a feature to the breakpoint by using a GEL file which enables me to save the current counts on the fly as soon as the breakpoint is hit?
- 3) If the other approach ("Breakpoint" in combination with an action "Execute Expression (GEL)") is the way to go, why is there a great difference in my measurements?