Byte Alignment Check
The tool checks the byte alignment of structure variables in the source code.
Prerequisites
- /opt is the default installation directory of the tool. The following uses this directory as an example. Replace it with the actual directory.
- On the WebUI, this feature requires uploading the files or compressed package. In the IDE, the tool plugin can scan local projects. If the source code is included in a compressed package, decompress the package and select the decompressed folder.
Procedure
- On the left pane of the page, choose Affinity Analyzer > Byte Alignment Check and click
to create a task. See Figure 1.
Table 1 Parameter description Parameter
Description
Task Name
A task name is automatically generated by default, which can be modified as required.
Source File Path
Set this parameter using either of the following methods:
- If you want to use uploaded source code, click the text box and select a source code path from the drop-down list or manually enter a source code path.
- Click Upload on the right to upload the package or folder. (The package is automatically decompressed during the upload.)
NOTE:- Only TAR, TAR.BZ, TAR.BZ2, TAR.GZ, TAR.XZ, TBZ, TBZ2, TGZ, TXZ and ZIP packages can be uploaded. Only one package can be uploaded at a time. The source package cannot exceed 1 GB, and the extracted files cannot take up more than half of the remaining drive space.
- Only one folder can be uploaded at a time. The size of the folder must be less than or equal to half of the remaining drive space.
- Before manually uploading a software package, check whether the target directory exists. If it does not exist, create such a directory and grant the read, write, and execute permissions to the devkit user.
Compile Command
Command to be used to compile the source code. If there are multiple compile commands to be run on the server, separate them with semicolons (;).
Example: cd build;cmake ..;make.
NOTE:Compile commands do not allow setting common variables or environment variables.
Example: CFLAGS='-O0 -g';make or export CFLAGS='-O0 -g';make
- Click Check. After the check is complete, the check report page is displayed. See Figure 2.
- You can click
to sort the source files to be modified by path or number of recommended items. - In the upper right corner of the page, you can click Download Report. Then click Download Report (.csv) or Download Report (.html) to download the analysis report. Alternatively, you can click
next to the task name and click Download Report (.csv) or Download Report (.html) to download the analysis report.
Table 2 Parameters in the report Parameter
Description
Source File Statistics
Files to Modify
Total number of files to be modified in the source file path.
Code Lines to Modify
Number of code lines to be modified.
Total Number of Suggestions
Total number of items recommended for modification. Modify these items to enhance application performance on the Kunpeng platform.
Source Files to Modify
Source files to be modified and suggestions for each file. You can click View Suggested Source Code in the Operation column to quickly go to the source file suggestion page.
- You can click
- Click the View Suggested Source Code tab to switch to the alignment check result page. See Figure 3.
Table 3 Parameter description Parameter
Description
Original Source Code
Original source code.
Structure Variable Memory Allocation
Displays the 32-bit and 64-bit memory spaces that need to be aligned in the code.
- The tool supports concurrent running of multiple byte alignment check tasks.
- To cancel a task, click Close during the task running process.
- To modify the configuration of a successful or failed task, click
on the right of the task name to restart the task. - Only one of the 64-bit mode check and byte alignment check can be performed by a user at a time.
- You can click the arrow keys in the upper right corner of Original Source Code to view the code.
- If you use shortcut keys to modify the source code, pay attention to shortcut key conflicts caused by the input method or IDE environment.
- The analysis result may vary according to the environment, which is normal.
- If the scan result does not match the code, macro expansion may be involved.
- If the system displays a message indicating that the task times out, rectify the fault by following instructions in Task Timeout.


