效能測試結果的 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
  • milliseconds」或「ms
  • 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]
    }
]

另請參閱