Attach模式采集数据
链路时延检测工具支持通过Attach模式采集运行时数据的能力。
命令功能
提供以Attach模式的方式采集数据的能力,启动应用后指定应用的PID,在运行过程中采集数据。

- Attach模式仅支持在鲲鹏平台上运行。
- 使用Attach模式采集数据,会在用户应用程序运行的中间阶段触发采集,不需要重启应用程序。
命令格式
1 | devkit advisor knet [-h | --help] {attach} {-p PROCESS_ID} {-i CONF_FILE_PATH} {-o OUTPUT_DIR_PATH} [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] |
参数说明
参数 |
参数选项 |
参数说明 |
---|---|---|
-h/--help |
- |
可选参数,获取帮助信息。 |
-p |
- |
必选参数,指定应用的PID号。 |
-i |
- |
必选参数,配置文件,指定需要记录的函数的配置文件路径。配置文件格式请参见配置文件说明。 |
-o |
- |
必选参数,指定数据文件的输出目录。生成的数据文件格式说明请参见采集后存储的数据文件说明。 |
-l/--log-level |
0/1/2/3 |
可选参数,设置日志级别,默认为1。
|
--set-timeout |
- |
可选参数,任务超时时间,单位为分钟,若执行时间超过超时时间则退出执行。默认无超时时间,任务将持续执行直到结束。 |
使用示例
运行以下命令,查看链路时延检测Attach模式支持的功能信息:
1 | devkit advisor knet attach -h |
返回信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | OVERVIEW Run this command with 'knet' to attach the collector(librecord.so) to a running process USAGE devkit advisor knet [-h | --help] {attach} {-p PROCESS_ID} {-i CONF_FILE_PATH} {-o OUTPUT_DIR_PATH} [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT] OPTIONS -h, --help Get help information and exit. attach [Mandatory option] Specify using the attach feature. -p PROCESS_ID [Mandatory option] Specify the running process id to attach. -i CONF_FILE_PATH [Mandatory option] Specify the path to the configuration file which contains function names to be collected. -o OUTPUT_DIR_PATH [Mandatory option] Specify the directory where collected data files will be saved. -l, --log-level {0,1,2,3} Specify the log level of the current task, 0(DEBUG) | 1(INFO) | 2(WARNING) | 3(ERROR). The default value is 1(INFO). --set-timeout <min> Specify the timeout period of a task. By default, the timeout period is not set. EXAMPLE devkit advisor knet attach -p <pid> -i /path/to/conf -o /path/to/data_dir |
父主题: 采集运行时数据