用于性能测试结果的 Fuchsiaperf 格式

本文档介绍了 Fuchsia 基准测试结果必须遵循的 JSON 架构,以便上传到性能信息中心。

JSON 说明

[
    {
        "label":       string     // Name of the test case in the performance dashboard.
        "test_suite":  string     // Name of the test suite in the performance dashboard.
        "unit":        string     // One of the supported units (see below)
        "values":      [v1, v2..] // Numeric values collected in this test case
    },
    {
        ...
    }
]

请注意,在 values 数组中包含多个值在某种程度上是遗留问题。fuchsiaperf 文件的使用者通常只使用 values 数组的平均值,而该数组通常只包含一个值。

支持的单位

为了将基准测试结果转换为性能信息中心所需的格式,unit 必须是以下字符串之一,用于描述结果 values 的单位。

  • nanosecondsns
  • millisecondsms
  • bytes
  • bytes/second
  • frames/second
  • percent
  • count
  • W(瓦)

指标方向

unit 字符串可以选择性地通过附加下划线来指定指标方向(值越小越好还是越大越好)。

  • _smallerIsBetter
  • _biggerIsBetter

例如:ns_smallerIsBetterbytes/second_biggerIsBetter

示例

[
    {
        "label": "Channel/WriteRead/64bytes",
        "test_suite": "fuchsia.microbenchmarks",
        "unit": "nanoseconds",
        "values": [105.45, 697.916667, 672.743056]
    },
    {
        "label": "Channel/WriteRead/1024bytes",
        "test_suite": "fuchsia.microbenchmarks",
        "unit": "nanoseconds",
        "values": [102.23, 1004.340278, 906.250000]
    }
]

另请参阅