Solana RPC API手册

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

getRecentPerformanceSamples

getRecentPerformanceSamples方法返回倒序排列的最近的性能样本列表。 性能样本每60秒采集一次,包含交易数以及在指定时间窗口内的槽位数。

请求参数

  • limit: <usize> - (可选) number of samples to return (maximum 720)

返回结果

getRecentPerformanceSamples方法返回一组RpcPerfSample对象,其结构如下:

  • slot: <u64> - 采样提取槽位
  • numTransactions: <u64> - 样本中的交易数量
  • numSlots: <u64> - 样本中的槽位数量
  • samplePeriodSecs: <u16> - 采样窗口秒数

示例代码

请求:

curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc":"2.0", "id":1, "method":"getRecentPerformanceSamples", "params": [4]}

响应:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "numSlots": 126,
      "numTransactions": 126,
      "samplePeriodSecs": 60,
      "slot": 348125
    },
    {
      "numSlots": 126,
      "numTransactions": 126,
      "samplePeriodSecs": 60,
      "slot": 347999
    },
    {
      "numSlots": 125,
      "numTransactions": 125,
      "samplePeriodSecs": 60,
      "slot": 347873
    },
    {
      "numSlots": 125,
      "numTransactions": 125,
      "samplePeriodSecs": 60,
      "slot": 347748
    }
  ],
  "id": 1
}