Static Memory Consistency Check
The tool checks for any memory inconsistency problems in static mode when C/C++ source code is running on the Kunpeng platform, and also provides check reports and memory barrier insertion suggestions.
- Before using this function, ensure that the drive where the tool is installed has a sufficient space. During the weak memory sequence checks, large intermediate files are generated. According to empirical data, about 100 GB of available memory is required for every 100,000 lines of code.
- The check of a large amount of source code consumes many resources. It is recommended the code to be checked do not exceed 100,000 lines.
Command Function
Checks memory inconsistency problems in source code.
Syntax
1 | devkit advisor mm-check [-h | --help] {-i INPUT_PATH | --input INPUT_PATH}{-f BC_PATH | --bc-file BC_PATH} [--autofix {true,false}] [--autofix-dir AUTOFIX_OUTPUT_PATH] [-o OUTPUT_PATH | --output OUTPUT_PATH] [-l {0,1,2,3} | --log-level {0,1,2,3}] [-r {all,json,html,csv} | --report-type {all,json,html,csv}] [--set-timeout TIMEOUT] |
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. This parameter is optional. |
-i/--input |
- |
Path to the source code folder corresponding to the BC file. This parameter is mandatory. |
-f/--bc-file |
- |
BC folder path. BC files must exist in this path. This parameter is mandatory. NOTE:
|
--autofix |
true/false |
Indicates whether to generate a compiler configuration file. The default value is false. This parameter is optional. |
--autofix-dir |
- |
Path for storing the compiler configuration file. This parameter is optional. By default, the file is generated in the source code folder in the tool directory. The file takes effect only when the --autofix parameter is set to true. |
-o/--output |
- |
Path for storing scan reports. By default, scan reports are stored in the current execution path. A report name is the format of Module-name_Timestamp. This parameter is optional. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 1. This parameter is optional.
|
-r/--report-type |
all/json/html/csv |
Scan report format, which defaults to all. This parameter is optional.
|
--set-timeout |
- |
Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete. |
Example
In this example, the source code in the /opt/DevKit/testcase/affinity/weak_cons/test-mulbc_sort directory is scanned, the scan report is stored in the /opt/DevKit directory, and the log level is DEBUG. Replace the example parameter values with the actual ones.
1 | devkit advisor mm-check -i /opt/DevKit/testcase/affinity/weak_cons/test-mulbc_sort -f /opt/DevKit/testcase/affinity/weak_cons/bc_file -o /opt/DevKit -l 0 |
The following information is displayed and a report is generated:
Executing static memory consistency check task, please wait...
Current progress: ################################# [100%]
Scanned time: 2025/04/07 03:38:29
Configuration:
Scan bc files path: /opt/DevKit/testcase/affinity/weak_cons/bc_file
Scan source code path: /opt/DevKit/testcase/affinity/weak_cons/test-mulbc_sort
Autofix: false
Generate report path: /opt/DevKit
Generate report type: all
Task Timeout Interval: The timeout period is not set.
Log level: debug
Summary:
Scanned 2 bc files, there are 2 recommended modifications.
For the details information, please check:
/opt/DevKit/mem-check_20250407033829_7ebf.json
/opt/DevKit/mem-check_20250407033829_7ebf.html
/opt/DevKit/mem-check_20250407033829_7ebf.csv
Output Report
Parameter |
Description |
|---|---|
Configuration |
Displays the paths to the software source file and BC file. |
Source File to Be Modified |
Displays information such as the path to the source file that needs to be modified. |