WPERF-583: Add to timeline JSON more fields
Introduction
Out JSON requires few fields from command line to give better overview of things. New fields will help with testing CLI vs timeline output as well.
I've decided to skip some CSV fields like multiplexing and focus on -i, -n and --timeout because other fields like multiplexing are already inside JSON (which contains "full" counting JSONs inside").
In this patch:
- wperf: pass count interval, duration and timeline count from CLI to timeline JSON
- wperf: add to WPerfTimelineJSON count duration, interval and number of
- wperf-scripts: update timeline JSON schema with new fields
Testing
I've generated timeline JSON with new values:
>wperf stat -t -i 1.3 -n 7 --json -m imix --timeout 2.2
JSON header looks now like this:
{
"count_duration": 2.2,
"count_interval": 1.3,
"count_timeline": 7,
"timeline": [
{
"core": {
"Multiplexing": false,
"Kernel_mode": false,
"cores": [
{
...
See full output here: https://gitlab.com/-/snippets/3633311
Regression testing
>type schemas\wperf.timeline.schema
{
"$id": "https://gitlab.com/Linaro/WindowsPerf/windowsperf/-/raw/main/wperf-scripts/tests/schemas/",
"title": "WindowsPerf timeline JSON output format",
"description": "WindowsPerf outputs JSON format for timeline feature (counting)",
"type": "object",
"required": [
"timeline",
"count_duration",
"count_interval",
"count_timeline"
],
"additionalProperties": false,
"properties": {
"timeline": {
"type": "array",
"items": {
"$ref": "wperf.stat.schema"
}
},
"count_duration": {
"type": "number"
},
"count_interval": {
"type": "number"
},
"count_timeline": {
"type": "integer"
}
}
}
Test output:
>pytest
======================================================== test session starts =========================================================
platform win32 -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\Users\przemek\Desktop\wperf\merge-request\3.2.2, configfile: pytest.ini
collected 198 items / 1 skipped
wperf_cli_common_test.py .... [ 2%]
wperf_cli_config_test.py ..... [ 4%]
wperf_cli_extra_events_test.py .... [ 6%]
wperf_cli_info_str_test.py . [ 7%]
wperf_cli_json_validator_test.py .......... [ 12%]
wperf_cli_list_test.py ..... [ 14%]
wperf_cli_metrics_test.py ................ [ 22%]
wperf_cli_padding_test.py .............. [ 29%]
wperf_cli_record_test.py .............. [ 36%]
wperf_cli_stat_test.py .................................................... [ 63%]
wperf_cli_test_test.py ........ [ 67%]
wperf_cli_timeline_test.py .................................................... [ 93%]
wperf_cli_ustress_bench_test.py ...... [ 96%]
wperf_cli_ustress_dep_record_test.py . [ 96%]
wperf_cli_ustress_dep_wperf_test.py ..... [ 99%]
wperf_lib_app_test.py s [100%]
====================================================== short test summary info =======================================================
SKIPPED [1] wperf_cli_ustress_dep_wperf_lib_timeline_test.py:110: Can not find wperf-lib-timeline.exe
SKIPPED [1] wperf_lib_app_test.py:44: Can not run wperf-lib-app.exe
============================================= 197 passed, 2 skipped in 528.00s (0:08:48) =============================================
Edited by Przemyslaw Wirkus