OpenApi
1 签名
1.1 签名参数
| 参数名称 | 类型 | 必选 | 描述 |
|---|---|---|---|
| access_token | string | 是 | PerfSight平台生成的token, 点击获取 |
| env | string | 是 | 国内环境: v2; 新加坡环境: sgp; |
| app_id | string | 是 | 项目ID |
| username | string | 是 | 登录PerfSight平台的用户名 |
1.2 签名方法
以python为例, 假设业务接口实际参数为
payload = {
"platform": 0,
}
- 设置token过期时间(以120秒为例)
exp = int(time.time() + 120)
- 把exp添加到参数中
payload = {
"platform": 0,
"exp": exp
}
- 使用jwt生成token
headers = {
"alg": "HS256",
"typ": "JWT"
}
jwt_token = jwt.encode(payload=payload, key=access_token, algorithm='HS256', headers=headers)
- 构造上传参数
params = {
'app_id': "123",
'env': 'sgp',
'username': 'abc',
'token': jwt_token,
}
- 发送请求
headers = {'Content-Type': 'application/json'}
url = 'http://9.134.150.248:8086/openapi/scene/dayAggregateData'
response = requests.post(url, json=params, headers=headers)
print(response.json())
- 返回数据格式
{
{
"ret": 200, // 状态码
"msg": "", // 错误消息
"data": [ // 返回数据
{
"merge_count": 581179108,
"fps_mean": 52.56,
"fps_swing_hour": 11.03,
"jank_frame_hour": 5.99,
"pss": 1425.3,
"vss": 12507.61,
"psmall_jank": 3.51,
"frame100": 0.02,
"mono": 183.34
}
],
"requestid": "94e2ac8b38b08ec238d492a708e3d023", // 服务端请求ID
"flush_time": "2023-02-24 17:21:54" // 返回时间
}
}
1.3 请求地址
国内环境: https://api.perfsight.qq.com
新加坡环境: http://101.32.239.248:32414/(临时)
不同环境情注意 env参数的给值不同 【国内环境: v2; 新加坡环境: sgp;】
2 接口描述及说明
2.1 获取场景分析版本汇总/区间累计数据
接口请求路径:/openapi/scene/dayAggregateData
请求方式:POST
输入参数(body):
| 参数名称 | 类型 | 必选 | 描述 |
|---|---|---|---|
| platform | int | 是 | 平台ID, Android:0, iOS:1, PC:5 |
| project_version | string | 是 | 版本号 |
| scene | string | 是 | 场景名 |
| is_customize | bool | 是 | 自定义画质开关,默认false |
| customize_arr | array | 是 | 自定义画质数组, 画质开关为true时生效,用例如下 |
| region | string | 是 | 地区 |
| start | string | 是 | 开始时间,格式"2023-02-20 00:00:00" |
| end | string | 是 | 结束时间,格式"2023-02-20 00:00:00" |
| time_level | int | 是 | 1:版本汇总, 4:区间累计 |
"is_customize:true
"customize_arr": [
{
"category": "机型分档",
"category_items": ["超一档"]
},
{
"category": "目标帧率",
"category_items": ["高"]
}
],
输出参数:
| 参数名称 | 类型 | 描述 |
|---|---|---|
| merge_count | int | 对局数 |
| fps_mean | float | FPS均值(帧/秒) |
| fps_jetter_hour | float | FPS抖动(次/小时) |
| fps_jank_hour | float | FPS卡顿(次/小时) |
| pss_average_peak | float | PSS内存峰值均值(MB) |
| vss_average_peak | float | VSS内存峰值均值(MB) |
| perfdog_small_jank | float | Jank卡顿(次/10分钟) |
| frametime_gt_100ms_percent | float | 帧时间>100ms比例(%) |
| mono_reserved_peak | float | MonoReserved内存峰值(MB) |
2.2 获取机型分析数据
接口请求路径:/openapi/device/deviceAnalysis
请求方式:POST
输入参数(body):
| 参数名称 | 类型 | 必选 | 描述 |
|---|---|---|---|
| platform | int | 是 | 平台ID, Android:0, iOS:1, PC:5 |
| project_version | string | 是 | 版本号 |
| scene | string | 是 | 场景名 |
| is_customize | bool | 是 | 自定义 |
| customize_arr | array | 是 | 自定义数组, 用例如下 |
| device_class | array | 是 | 机型分档,int数组;0:综合, 1:高, 2:中, 3:低 |
| device_search | array | 是 | 机型,字符串数组,支持"全部" |
| region | string | 是 | 地区,国内写"world" |
| start | string | 是 | 开始时间,格式"2023-02-20 00:00:00" |
| end | string | 是 | 结束时间,格式"2023-02-20 00:00:00" |
| time_level | int | 是 | 1:版本汇总, 2:日级, 4:区间累计 |
"customize_arr": [
{
"category": "机型分档",
"category_items": ["超一档"]
},
{
"category": "目标帧率",
"category_items": ["高"]
}
],
输出参数:
| 参数名称 | 类型 | 描述 |
|---|---|---|
| calendar_time | string | 日期 |
| device_model | string | 机型 |
| ram | int | Ram |
| device_cpu_core | int | CPU核数 |
| os | string | 操作系统 |
| device_cpu_freq | int | CPU频率 |
| gpu_renderer | string | GPU |
| gpu_version | string | GPU版本 |
| device_manu | string | 厂商 |
| scene_label | string | 场景名 |
| def_class | int | 自定义分档 |
| merge_count | int | 对局数 |
| quality | string | 画质 |
| benchmark_main_top | string | benchmark分档 |
| region_id | int | 区域ID |
| region_name | string | 区域名 |
| cpu_avg | float | APP CPU usage(%) |
| avg_online_time | float | 平均在线时长 |
| count_rate | float | 子场景占比 |
| x64_support | string | 是否支持64位 |
| fps_mean | float | FPS均值(帧/秒) |
| fps_jetter_hour | float | FPS抖动(次/小时) |
| fps_low_hour | float | 低帧(次/小时) |
| fps_jank_hour | float | FPS卡顿(次/小时) |
| perfdog_small_jank | float | SmallJank卡顿(次/10分钟) |
| perfdog_big_jank | float | BigJank卡顿(次/10分钟) |
| frametime_gt_100ms_percent | float | 帧时间>100ms比例(%) |
| cpu_decline_percent | float | 疑似降频对局数占比(%) |
| stutter | float | Stutter卡顿率 |
| fps_attainment | float | 帧率达标率 |
| fps_section1 | float | fps分段1 |
| fps_section2 | float | fps分段2 |
| fps_section3 | float | fps分段3 |
| fps_section4 | float | fps分段4 |
| fps_section5 | float | fps分段5 |
| pss_average_peak | float | PSS内存峰值均值(MB) |
| pss_average_peak_top1 | float | PSS内存峰值TOP1%均值 |
| pss_peak_peak | float | PSS内存峰值的峰值 |
| vss_average_peak | float | VSS内存峰值均值(MB) |
| vss_average_peak_top1 | float | VSS内存峰值TOP1%均值 |
| vss_peak_peak | float | VSS内存峰值的峰值 |
| dist_data | map | 分段数据 |
| cpu_mean | float64 | CPU均值 |
| current_mean | float64 | 平均电流 |
| power_mean | float64 | 平均功耗 |
| power_consumption | float64 | 耗电量 |
| cpu_temperateure_mean | float64 | 平均CPU温度 |
| battery_temperature_mean | float64 | 平均电池温度 |
| loading_time | float | 场景切换时间 |
| loading_tiem_mean_r1000 | float | 场景加载时间 |
| mean_scene_time | int | 场景持续时间 |
2.3 用户详情数据获取
接口请求路径:/openapi/single/detailQuery
请求方式:POST
输入参数(body):
| 参数名称 | 类型 | 必选 | 描述 |
|---|---|---|---|
| platform | int | 否 | 默认全平台,平台ID, Android:0, iOS:1, PC:5 |
| requestid | string | 是 | 请求id,UUID |
| user_id | string | 是 | 用户ID |
| apmEnv | string | 是 | 站点区域 V2:国内 sgp:新加坡 |
| stime | string | 是 | 开始时间,格式"2023-02-20 00:00:00" |
| etime | string | 是 | 结束时间,格式"2023-02-20 00:00:00" |
| timeSortField | int | 是 | 1:场景开始时间, 2:场景上传时间 |
| size | int | 是 | 查询条数,默认1000 |
{
"user_id": "2315dc13e13c1eb5",
"timeSortField": 1,
"apmEnv": "v2",
"platform": "0",
"requestid": "3b7baf973ed5cbe17d9f5d4cb7eaceb4",
"stime": "2024-02-28 00:00:00",
"etime": "2024-02-28 23:59:59",
"size": 1
}
输出参数:
| 参数名称 | 类型 | 描述 |
|---|---|---|
| performance_id | string | 单局ID |
| user_id | string | 用户ID |
| app_version | string | 版本ID |
| upload_time | string | 上传时间 |
| scene_time | string | 场景时间 |
| scene_name | string | 场景名 |
| scene_quality | string | 画质ID |
| game_id | string | 项目ID |
| manu | string | 厂商 |
| model | string | 机型 |
| scene_last_time | int | 场景持续时间,单位ms |
| fps_mean | float | 帧率 |
| pdjank_10min | float | SmallJank卡顿(次/10分钟) |
| pdbigjank_10min | float | BigJank卡顿(次/10分钟) |
| janks_10min | float | fps卡顿(次/10min) |
| unders_1hour | float | fps低帧(次/10min) |
| swings_1hour | float | fps抖动(次/10min |
| launch_time | string | 启动时间 |
| pss_max | float | PSS内存峰值 |
| maxrealmem | float | Footprint内存峰值,IOS |