Profiling Report Training
Module Code: Profiling report
Document Code: <SDKTrainning>– v<1.0>
Profiling report - Training Document
RECORD OF CHANGE
No Effective Date Version Change Description Reason Reviewer Approver
1 25/01/2018 1.0-D1 Initial version Added new
10
SDK Internal use /
Profiling report - Training Document
TABLE OF CONTENTS
1 INTRODUCTION....................................................................................................................4
1.1 Purpose................................................................................................................................4
1.2 Scope....................................................................................................................................4
1.3 Definitions, acronyms and abbreviations............................................................................4
1.4 References............................................................................................................................4
2 PROFILING REPORT OVERVIEW....................................................................................5
3 PROFILING REPORT CONTENT.......................................................................................6
4 GUIDELINES TO IMPLEMENT PROFILING TEST.......................................................8
4.1 Hardware setup....................................................................................................................8
4.2 Software setup and V&V configuration..............................................................................8
4.3 How to design test case........................................................................................................9
4.4 How to add test code............................................................................................................9
4.5 How to generate excel report.............................................................................................10
5 APPENDIX-A: HOW T32 GET THE TRACE DATA FROM TARGET.......................12
5.1 MPC57xx target.................................................................................................................12
6 APPENDIX-B: TROUBLE SHOOTINGS..........................................................................15
SDK Internal use /
Profiling report - Training Document
1 INTRODUCTION
1.1 Purpose
This document provides introduction on profiling report, guidelines on how to setup, create test case,
execute test and generate profiling report in S32SDK project.
It also includes information on how LauterbachTrace32 obtaining profiling data from hardware and
some common issues when runs profiling test.
1.2 Scope
This document applies for all S32SDK testers, test lead and test architect.
1.3 Definitions, acronyms and abbreviations
Table 2-1: Terms and abbreviations
No Term Description
1
2
3
1.4 References
Table 2-2: References
No Document name Description
1 AN4591 Lauterbach MPC57xx Nexus Trace Tools
Including both parallel and serial (Aurora) trace
protocols
2 training_debugger.pdf Debugger Basics – Training from Lauterbach
3 training_trace.pdf Training Real-time Trace from Lauterbach
SDK Internal use /
Profiling report - Training Document
2 PROFILING REPORT OVERVIEW
Objective:
Provide the execution time for all driver APIs and the execution time for each critical region. The
report contains information on minimum, average and maximum runtime of APIs.
This is measured through dedicated Test Case. A profile test case can contain one or more
measurement use cases
Compiler names will not be available in the report; the compilers are identified through numbers.
Some sheets are empty, but is not an issue; this is normal behavior of the tool.
File name: <product>_<component>_ProfileReport.xlsx
e.g. S32SDK_CLOCK_ProfileReport.xlsx
Quality Target: No target
MCAL customer requirement example:
“The maximum interrupt lock time equals the maximum execution time of a critical section and shall
be less 100 us. The execution time of ISR shall be minimized.”
What to consider during review:
Reviewer: the list of functions included in each sheet is correct and complete
Quality: template, release information like date, product name & version, spot-check the sheets to
verify if there is data inside.
SDK Internal use /
Profiling report - Training Document
3 PROFILING REPORT CONTENT
The profiling reports are created for each test module under folder: \vnv_test\auto\non_asr\sdk\test\
test_adc_pal\specific\<platform_name> \doc\profiling_reports and includes 5 files:
1. 00_trace_time_log.txt – log file for command: B::TRACE.STATISTIC.FUNC_
%LEN_50_NAME_ALL_/SORT_ADDRESS
2. 00_trace_time_log_tree.txt – log file for command
B::TRACE.STATISTIC.TREE_%LEN_50
3. 00_trace_error_log.txt – error log from T32
4. 00_trace_params_log.txt – contains information on system clock frequency, Instruction
cache and Data cache status, data read wait state in flash and ram at which test is run.
5. S32SDK_<derivative_name>_<module_name>_ProfileReport.xlsx – Summary excel file
from 4 above files and generated by Auto tool.
The following table lists all the trace data for an APIs:
Table 4-3: Trace data
No Trace data Description
1 total The total time within the function.
2 Min The shortest measured time it took to execute the function. The time includes the
execution times of all sub-function calls. The time used for interrupt requests is
not included, unless the window is opened with option IncludeINTR.
If the function was never executed completely, the MIN time is not displayed.
3 Max The longest measured time it took to execute the function. The time includes the
execution times of all sub-function calls. The time used for interrupt requests is
not included, unless the window is opened with option IncludeINTR.
4 Avr The average time it took to execute the function. The time includes the
execution times of all sub-function calls.
The time used for interrupt requests is not included, unless the window is
opened with option IncludeINTR
5 Internal Total time between function entry and exit without called sub-functions, TRAP
handlers, interrupt service routines, other tasks …
6 Ivar Average time between function entry and exit without called sub functions,
TRAP handlers, interrupt service routines, other tasks …
7 External Total time spent within called sub-functions, TRAP handlers, interrupt service
routines, other tasks …
8 eavr Average time spent within called sub-functions, TRAP handlers, and interrupt
service routines.
9 eintr Total time the function was interrupted.
10 eintrmax Max. time 1 function pass was interrupted.
11 etask Total time in other tasks.
12 etaskmax Max. time 1 function pass was interrupted by other tasks.
SDK Internal use /
Profiling report - Training Document
No Trace data Description
13 count Number of calls of the function.
If a function is never completely executed, no number of calls is displayed.
14 intern% Ratio of time within the function without sub-functions, TRAP handlers,
interrupts.
<Internal time of function>/<Total measurement time> as a numeric value.
SDK Internal use /
Profiling report - Training Document
4 GUIDELINES TO IMPLEMENT PROFILING TEST
4.1 Hardware setup
Table 5-4: Lauterbach Trace hardware
No Name Device Label
1 Power trace II LA-7693
2 Power debug interface LA-3505
3 Aurora serial LA-3911
4 Debug cable LA-3736
Figure detail HW (Will update later)
4.2 Software setup and V&V configuration
4.2.1 Software
Tool: ltb_time_parser tool
Version: Update base on tool team
4.2.2 V&V configuration
Have to 2 files .c and .h to define some macro and function to support for trace
- …\test\test\specific\MPC574X\include\sys_trace.h
- …\test\test\specific\MPC574X\include\sys_trace.c
Detail:
TRACE_START: Set breakpoint to starting measurement time
TRACE_STOP: Set breakpoint to stopping measurement time
TRACE_DESCRIPTION: To tester more monitor for that function
TRACE_FILTERS: to support tool filter capture data in logs file
Configuration in VnV
Table 2-5: V&V make configuration
No File Content
1 local_config.m T32_TRACE_APP:=ON
ak
2 config_beart.m SRC_FILES +=
ak $(CFG_DIR)/../../../test/specific/$(PLATFORM)/src/sys_trace.c
INCLUDE_DIRS += $(CFG_DIR)/../../../test/specific/$(PLATFORM)/inc
ifeq ($(T32_TRACE_APP),ON)
SDK Internal use /
Profiling report - Training Document
No File Content
CFG_OUT_FILES=$(DEV_DIR)/test/specific/$(PLATFORM)/config/
debug/lauterbach/cmm/get_system_params.cmm
endif
3 build_cfg.mak ifeq ($(T32_TRACE_APP),ON)
CFG_OUT_FILES=$(DEV_DIR)/test/specific/$(PLATFORM)/config/
debug/lauterbach/cmm/get_system_params.cmm
endif
build_cfg.mak
ifeq ($(T32_TRACE_APP),ON)
CCOPT := $(CCOPT) -DT32_TRACE_APP
endif
Note: This will be prepared by build environment engineer.
4.3 How to design test case
Profiling report are measured for sequence of TYPICAL USER CASES of drivers. In the case that it
is very difficult to specify the TYPICAL USER CASE, driver EXAMPLE code is considered as an
important source to develop test case for profiling test.
4.4 How to add test code
Template name of test suite/test case:
[Msn]_TS_PERF_xxx.c
[Msn]_TS_PERF_xxx.mak
[Msn]_TC_PERF_xxx.c
Example
/*-----------------------------------Start of use case 1------------------------------------------*/
TRACE_DESCRIPTION("Gets the default configuration for the RTC %s",DET_STATUS);
TRACE_FILTERS("RTC_DRV_GetDefaultConfig");
TRACE_START();
SDK Internal use /
Profiling report - Training Document
RTC_DRV_GetDefaultConfig(&T_config);
TRACE_STOP();
/*-----------------------------------Start of use case 2------------------------------------------*/
TRACE_DESCRIPTION("Rtc initialization with a valid configuration %s",DET_STATUS);
TRACE_FILTERS("RTC_DRV_Init");
TRACE_START();
RTC_DRV_Init(T_RTC_INSTANCE, &rtcTimer1_State2, &T_config);
TRACE_STOP();
Execute: make clean generate parse; make build run report
Output is consist of 4 files for each function at path: vnv_test\output\[*]\
Rtc_c55_TS_PERF_005\debug\trace_log\Rtc_TC_PERF_0501
00_trace_time_log.txt, 00_trace_time_log_tree, 00_trace_error_log.txt, 00_trace_params_log.txt
4.5 How to generate excel report
4.5.1 Please set up on AF
T32_TRACE_APP:=ON
Module register number test suite to run Profiling: Make clean generate parse; make build run
report
Output is consist of 4 files for each function at path: vnv_test\output\[*]\
Rtc_c55_TS_PERF_005\debug\trace_log\Rtc_TC_PERF_0501
00_trace_time_log.txt, 00_trace_time_log_tree, 00_trace_error_log.txt, 00_trace_params_log.txt
SDK Internal use /
Profiling report - Training Document
4.5.2 Run command in cmd to generate excel file
Command:
trace_extract.exe ..\..\output ..\..\output MPC574X ..\..\non_asr\sdk\test\test\specific\MPC574X\
release_configuration.txt ..\..\tools\templates\excel_header.xlsx ..\..\non_asr\sdk\test\test\specific\
MPC574X\TestReport.config S32SDK_MPC5748G
Detail parameter:
Param 1. Input is path to Lauterbach T32 logs: ..\..\output
Param 2. Output path at ..\..\output\
Param 3. Platform name is MPC574X
Param 4. Excel template path: config ..\..\tools\templates\excel_header.xlsx
Param 5. Report prefix: .\..\non_asr\sdk\test\test\specific\MPC574X\TestReport.
Param 6. Release configuration path at ..\..\non_asr\sdk\test\test\specific\ MPC574X \
release_configuration.txt
Param 7. Product name path: S32SDK_MPC5768G
Output is many files for all modules.
Example a file: S32SDK_MPC5748G_RTC_C55_ProfileReport.xlsx at folder ..\..\output
SDK Internal use /
Profiling report - Training Document
5 APPENDIX-A: HOW T32 GET THE TRACE DATA FROM TARGET
5.1 MPC57xx target
5.1.1 Introduction to Lauterbach Trace solution to MPC57xx
Profiling data of the MPC77xx devices is collected via Nexus Aurora Trace interface. Lauterbach
provides MPC57xx NEXUS High Speed Serial Trace Port as following figure:
TRACE32 offers full access to all NEXUS settings.
SDK Internal use /
Profiling report - Training Document
The basic filter and trigger features in Trace32:
TraceEnable: Sample only the specified event.
TraceData: Sample the complete program flow and the specified data event.
TraceON: Switch the sampling to the trace buffer on after the specified event occurred.
TraceOFF: Switch the sampling to the trace buffer off after the specified event occurred.
SDK Internal use /
Profiling report - Training Document
TraceTrigger: Stop the sampling to the trace buffer at the specified event. A trigger delay
is possible.
5.1.2 VnV framework for profiling report
The following files implement configuration of V&V framework to work with MPC57xx NEXUS
High Speed Serial Trace Port.
1. get_system_params.cmm
- Get System Clock Value, Flash/RAM Latency, CACHE State and BTB state of the targeted
device.
2. trace_init.cmm.m4
- Reset and Initialize the Tracer
- T32 Performance Measurement Configuration for Nexus
- Set a breakpoint to start & stop the tracing
3. trace_performance_analysis.cmm.m4
Currently, S32SDK for MPC57xx uses METHOD 1 for trace, the file will:
- Create *_trace_time_log.txt file and save result for TRACE32 command:
TRACE.STATISTIC.FUNC %LEN 50 NAME ALL /SORT ADDRESS to it.
- Create *_trace_time_log_tree.txt and size result for TRACE32 command:
TRACE.STATISTIC.TREE %LEN 50
- Create *_trace_error_log.txt and size error log into it.
- Crate *_trace_params_log.txt and save value get from get_system_params.cmm
SDK Internal use /
Profiling report - Training Document
6 APPENDIX-B: TROUBLE SHOOTINGS
SDK Internal use /