Skip to content

Refactor timeline and add TS metric support for timeline CVS format

In this patch I've refactored how we store and process timeline (this can be further improved). Also I've added TS (Telemetry Solution) metrics (with formulas) to timeline file.

Notes:

  • Metrics are available in CVS file and marked with leading M@, e.g. M@l1d_cache_miss_ratio,M@l1d_tlb_mpki in order to distinguish metric name from event name.
  • I've added two new tests to cover refactoring and metrics support for timeline, see wperf_cli_timeline_test.py.
  • New namespace timeline hosts all timeline data structures and timeline API.

Example timeline CVS files

wperf stat -m l1d_cache_miss_ratio,l1d_tlb_mpki -c 1 -t -i 1 -n 3 -v

timeline file: 'wperf_core_1_2023_07_31_14_27_45.core.csv'
events to be counted:
     6              core events: 0x0004 0x0003 0x0008 0x0005 0x001b 0x001b
counting ... done

Telemetry Solution Metrics:
        core  product_name  metric_name             value  unit
        ====  ============  ===========             =====  ====
           1  neoverse-n1   l1d_cache_miss_ratio    0.005  per cache access
           1  neoverse-n1   l1d_tlb_mpki          999.545  MPKI
sleeping ... done
counting ... done

Telemetry Solution Metrics:
        core  product_name  metric_name           value  unit
        ====  ============  ===========           =====  ====
           1  neoverse-n1   l1d_cache_miss_ratio  0.031  per cache access
           1  neoverse-n1   l1d_tlb_mpki          6.642  MPKI
sleeping ... done
counting ... done

Telemetry Solution Metrics:
        core  product_name  metric_name           value  unit
        ====  ============  ===========           =====  ====
           1  neoverse-n1   l1d_cache_miss_ratio  0.014  per cache access
           1  neoverse-n1   l1d_tlb_mpki          2.851  MPKI
sleeping ... done
>type wperf_core_1_2023_07_31_14_27_45.core.csv
Multiplexing,FALSE
Kernel mode,FALSE
Count interval,1.00
Vendor,Arm Limited
Event class,core

core 1,core 1,core 1,core 1,core 1,core 1,core 1,
cycle,l1d_cache,l1d_cache_refill,inst_retired,l1d_tlb_refill,M@l1d_cache_miss_ratio,M@l1d_tlb_mpki,
2672756503,3429392628,18679267,3949525622,3947728808,0.005,999.545,
15319613,6098497,187612,16320369,108408,0.031,6.642,
64449120,32578964,451811,99540434,283776,0.014,2.851,

Changelog

  • wperf-scripts: add tests for timeline with metrics.
  • wperf: minor refactoring of pmu_device::print_core_metrics().
  • wperf-scripts: fix 'assert len(re.findall(pattern, cvs, re.DOTALL)) == N' regression.
  • wperf: add TS metrics to timeline file.
  • wperf: remove dead debug code.
  • wperf-test: add timeline.obj dependency.
  • wperf-lib: add timeline.obj dependency.
  • wperf-scripts: test for number of lines with data in timeline file.
  • wperf: update timeline feature with new test and fixes for DSU and DMC
  • wperf-scripts: add wperf_cli_timeline_test regression test.
  • wperf: remove extra header meta-data for timeline.h header.
  • wperf: fix linking error (missing header with 'enum evt_class').
  • wperf: timeline cleanup.
  • wperf: refactor timeline feature to separate files.
  • wperf: s/timeline_release/timeline_close/g.
  • wperf: add timeline cpp/h stubs to the project.

Testing (Ampere)

>pytest
================================= test session starts ==================================
platform win32 -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
collected 112 items

wperf_cli_common_test.py ....                                                     [  3%]
wperf_cli_config_test.py .....                                                    [  8%]
wperf_cli_extra_events_test.py ....                                               [ 11%]
wperf_cli_json_validator_test.py ....                                             [ 15%]
wperf_cli_list_test.py .....                                                      [ 19%]
wperf_cli_metrics_test.py ................                                        [ 33%]
wperf_cli_padding_test.py ...........                                             [ 43%]
wperf_cli_stat_test.py ...........................................                [ 82%]
wperf_cli_test_test.py .....                                                      [ 86%]
wperf_cli_timeline_test.py ..............                                         [ 99%]
wperf_lib_app_test.py s                                                           [100%]

====================== 111 passed, 1 skipped in 199.73s (0:03:19) ======================
Edited by Przemyslaw Wirkus

Merge request reports