---
title: 使用命令行进行字节对齐检查
description: "检查源码中结构体变量的字节对齐情况。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevkithistory/devkit_24_rc1/cliuserguide/KunpengDevKitCli_0024.html
sourcePath: /source/zh/kunpengdevkithistory/devkit_24_rc1/cliuserguide/KunpengDevKitCli_0024.html
indexId: 1263e40785d27345f31a0c532c36f505923c2ef1b9c7e67973c182bf177551b985
---
# 使用命令行进行字节对齐检查

#### 命令功能

检查源码中结构体变量的字节对齐情况。


#### 命令格式

```
devkit advisor byte-align {-i INPUT_PATH | --input INPUT_PATH} {-c COMMAND | --cmd COMMAND}[-o OUTPUT_PATH | --output OUTPUT_PATH]
[-b {make,cmake, automake} | --build-tool {make,cmake, automake}] [-r {all,json,html,csv} | --report-type {all,json,html,csv}]
[-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]
```


#### 参数说明


**表1 参数说明**

| 参数 | 参数选项 | 参数说明 |
| --- | --- | --- |
| \-i/\-\-input | input\_path | 待扫描的源码文件夹路径。 必选参数。 例如：/home/test1 |
| \-c/\-\-cmd | cmd | 源码构建命令。 必选参数。 在服务器中正常执行的构建命令，命令中如有空格，要使用单引号包住。 |
| \-b/\-\-build\-tool | make,cmake,automake | 构建工具。 可选参数。 当前工具支持make，cmake，automake，默认选项为make。 |
| \-o/\-\-output | output\_path | 报告存放路径。 可选参数。 报告默认存放在当前执行路径下，名称默认为“特性名称\_时间戳”。 |
| \-\-set\-timeout | timeout | 任务超时时间。 可选参数。 默认无超时时间，任务将持续执行直到结束。 |
| \-l/\-\-log\-level | 0,1,2,3 | 日志等级，可选参数：0（DEBUG）、1（INFO）、2（WARNING）、3（ERROR），默认为1（INFO）。 |
| \-r/\-\-report\-type | all,json,html,csv | 扫描报告的格式。 可选参数。 默认为all，即默认生成json、html、csv三种报告。 |


#### 使用实例

此处以以下命令为例，请根据实际情况替换成实际需要扫描的源码文件路径。

```
devkit advisor byte-align -i /opt/DevKit/wtdbg2-2.5 -c make -l 0
```

返回信息如下，并输出报告。

```
Scanned time: 2024/02/29 02:44:48
Configuration:
Scan source code path: /opt/DevKit/wtdbg2-2.5
Generate report path: /opt/DevKit/workspace/devadmin/porting/package
Generate report type: all
Task Timeout Interval: The timeout period is not set.
Log level: DEBUG
For the detailed information, please check
/opt/DevKit/workspace/devadmin/porting/package/byte-align_20240229024448_4d53.html
/opt/DevKit/workspace/devadmin/porting/package/byte-align_20240229024448_4d53.json
/opt/DevKit/workspace/devadmin/porting/package/byte-align_20240229024448_4d53.csv
```


#### 输出报告说明


**表2 字节对齐检查输出报告参数说明**

| 参数 | 说明 |
| --- | --- |
| 配置信息 | 显示软件源码文件存放路径。 |
| 需要修改的源码文件 | 显示需要进行字节对齐的源码文件路径等相关信息。 |
