# merge_profiling_timeline **Repository Path**: teemopan/merge_profiling_timeline ## Basic Information - **Project Name**: merge_profiling_timeline - **Description**: merge timeline - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 8 - **Created**: 2023-04-20 - **Last Updated**: 2023-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # merge_profiling_timeline ## 介绍 merge timeline ## 软件架构 软件架构说明 ## 使用说明 ### 1 获取服务器与客户端的启动时间差值文件time_difference.json 以下代码中,服务器为当前代码所在机器,所有步骤都在服务器上操作,可以选择集群中任意节点作为服务器 #### 1.1 拉取代码到集群任意节点任意目录,打开get_all_node_system_boot_time_difference目录 ```shell git clone -b master https://gitee.com/aerfaliang/merge_profiling_timeline.git cd merge_profiling_timeline/get_all_node_system_boot_time_difference ``` #### 1.2 安装依赖sshpass(1.4中远程执行客户端命令时要用到) ##### Ubuntu ```shell apt-get install sshpass ``` ##### CentOS ```shell # 源码包安装 wget http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz tar -xvzf sshpass-1.05.tar.gz cd sshpass-1.05 ./configure make make install # yum安装 yum -y install sshpass ``` #### 1.3 按照集群节点顺序编辑nodeinfo.json文件 文件中的内容为全部节点的ip,用户名,密码以及端口 注意:必须按照集群节点顺序填写,以下为样例文件中内容,请根据实际节点信息修改,将集群中所有节点信息填入 ```shell root@root:~/test/merge_profiling_timeline/get_all_node_system_boot_time_difference$ cat nodeinfo.json { "cluster": { "90.90.66.62": { "user": "root", "pd": "password", "port": 22 }, "90.90.66.64": { "user": "root", "pd": "password", "port": 22 } } } ``` #### 1.4 执行run_system_boot_time_difference_all.sh脚本,获取服务器与客户端的启动时间差值文件time_difference.json ```shell # bash run_system_boot_time_difference_all.sh {当前机器ip} bash run_system_boot_time_difference_all.sh 90.90.66.62 ``` #### 1.5 检查在脚本同目录有time_difference.json文件生成 文件中记录的是节点ip以及客户端相对服务器启动时间差(客户端当前启动时间-服务器启动时间),按照集群节点顺序排列 ```shell root@root:~/test/merge_profiling_timeline/get_all_node_system_boot_time_difference$ cat time_difference.json { "90.90.66.62": -3.8049183785915375e-06, "90.90.66.64": -1.551163767464459 } ``` ### 2 多timeline数据合并 #### 2.1 使用msporf采集数据,将采集到的所有节点的profiling数据拷贝到当前机器同一目录下,以下假设数据在/home/test/all_cann_profiling下 #### 2.2 使用merge_profiling_timeline下的main.py合并timeline ```shell # -i为profiling数据文件或文件夹路径 # -t传入的为前面步骤1.3生成的time_difference.json文件路径 # -o为可选参数,传入的是合并后的文件输出的文件或文件夹路径,默认为msprof_merged_timeline.json root@root:~/test/merge_profiling_timeline$ python3 main.py -i ../all_cann_profiling -t ./get_all_node_system_boot_time_difference/time_difference.json ``` #### 2.3 查看在当前目录生成msprof_merged_timeline.json文件,为合并后的文件