BT.runtime
BT.runtime
功能
返回当前 BT 进程运行期信息。
语法
BT.runtime()
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| 无 | - | 否 | 无 | 不需要参数。 |
返回值
| 类型 | 说明 |
|---|---|
| Object | 返回运行期信息对象。字段见下方“返回对象字段”。 |
返回对象字段
| 字段 | 类型 | 必定存在 | 说明 |
|---|---|---|---|
| uptime | Int | 是 | 当前 BT 进程已运行秒数,按当前 Unix 时间戳减 start_time 计算。 |
| threads | Int | 是 | 当前系统可用并行线程数。读取失败时返回 1。 |
| start_time | Int | 是 | BT 进程启动时间戳,单位秒。该值在进程内固定不变。 |
示例
runtime = BT.runtime() result = runtime.threads == BT.THREADS // 输出:true print result
注意事项
- start_time 是 BT 进程启动时间戳,单位秒。
- uptime 是当前时间减 start_time,单位秒。
- 如需查看 I/O、task、timer、net 和缓存资源状态,请使用
BT.stats()。