Allow event names in caps (e.g. CPU_CYCLES)
Introduction
Allow event names in caps (e.g. CPU_CYCLES). See https://linaro.atlassian.net/browse/WPERF-206.
Please note that now you can mix lower case and upper case letters in event names for -e command line option.
Note: we will still print event names as defined in .def files (so lower case). We will not inherit event name caps from command line.
This change aligns wperf to Linux perf CLI behavior.
Example
Now we can specify not only lower case names of the events. Please see below ASE_SPEC in -e command line:
>wperf stat -e inst_spec,vfp_spec,ASE_SPEC,dp_spec,ld_spec,st_spec -c 0
counting ... \Ctrl-C received, quit counting..done
Performance counter stats for core 0, no multiplexing, kernel mode excluded, on Arm Limited core implementation:
note: 'e' - normal event, 'gN' - grouped event with group number N, metric name will be appended if 'e' or 'g' comes from it
counter value event name event idx event note
============= ========== ========= ==========
2,616,862,144 cycle fixed e
69,870,525 inst_spec 0x1b e
1,689,946,315 vfp_spec 0x75 e
821,118,383 ase_spec 0x74 e
383,393,779 dp_spec 0x73 e
653,798,974 ld_spec 0x70 e
4,238,600 st_spec 0x71 e
1.71 seconds time elapsed
Testing
Regression (with new tests)
====================================== test session starts ======================================
platform win32 -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\Users\przemek\Desktop\wperf-tests
collected 75 items
wperf_cli_common_test.py .... [ 5%]
wperf_cli_json_validator_test.py .... [ 10%]
wperf_cli_list_test.py ... [ 14%]
wperf_cli_metrics_test.py ........ [ 25%]
wperf_cli_padding_test.py ......... [ 37%]
wperf_cli_stat_test.py ........................................... [ 94%]
wperf_cli_test_test.py .... [100%]
================================ 75 passed in 178.42s (0:02:58) =================================
Regression (on top of vanilla functional tests)
================================ test session starts =================================
platform win32 -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\Users\przemek\Desktop\wperf-tests
collected 71 items
wperf_cli_common_test.py .... [ 5%]
wperf_cli_json_validator_test.py .... [ 11%]
wperf_cli_list_test.py ... [ 15%]
wperf_cli_metrics_test.py ........ [ 26%]
wperf_cli_padding_test.py ......... [ 39%]
wperf_cli_stat_test.py ....................................... [ 94%]
wperf_cli_test_test.py .... [100%]
=========================== 71 passed in 144.10s (0:02:24) ===========================
Unit test
vstest.console x64\Debug\wperf-test.dll
Microsoft (R) Test Execution Command Line Tool Version 17.5.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed test_check_cores_in_pmu_ctl_hdr_p_null [< 1 ms]
Passed test_check_cores_in_pmu_ctl_hdr_p_cores_count [< 1 ms]
Passed test_check_cores_in_pmu_ctl_hdr_p_cores_no_error [< 1 ms]
Passed test_check_cores_in_pmu_ctl_hdr_p_cores_no [< 1 ms]
Passed test_get_core_event_index [< 1 ms]
Passed test_get_dmc_clk_event_index [< 1 ms]
Passed test_get_dmc_clkdiv2_event_index [< 1 ms]
Passed test_parse_events_str_for_sample_rf [< 1 ms]
Passed test_parse_events_str_for_sample_r1b [< 1 ms]
Passed test_parse_events_str_for_sample_r12_rab [< 1 ms]
Passed test_parse_events_str_for_sample_r_7_events [< 1 ms]
Passed test_parse_events_str_EVT_CORE_rf [< 1 ms]
Passed test_parse_events_str_EVT_CORE_r1b [< 1 ms]
Passed test_parse_events_str_EVT_CORE_r_7_events [< 1 ms]
Passed test_parse_events_str_EVT_DSU_1_event [< 1 ms]
Passed test_parse_events_str_EVT_DSU_2_events [< 1 ms]
Passed test_parse_events_str_EVT_DSU_2_events_case_insensitive_prefix [< 1 ms]
Passed test_parse_events_str_EVT_DSU_2_events_uppercase [< 1 ms]
Passed test_parse_events_str_EVT_DMC_CLKDIV2_1_event [< 1 ms]
Passed test_parse_events_str_EVT_DMC_CLKDIV2_1_event_uppercase [< 1 ms]
Passed test_parse_events_str_EVT_DMC_CLKDIV2_1_event_prefix_uppercase [< 1 ms]
Passed test_gen_pdb_name_dll [< 1 ms]
Passed test_gen_pdb_name_exe [< 1 ms]
Passed test_gen_pdb_name_dll_path [< 1 ms]
Passed test_gen_pdb_name_multiple_dll_dots [< 1 ms]
Passed test_MultiByteFromWideString [< 1 ms]
Passed test_IntToHexWideString [< 1 ms]
Passed test_IntToHexWideString_wchar_t [< 1 ms]
Passed test_IntToDecWideString [< 1 ms]
Passed test_DoubleToWideString [< 1 ms]
Passed test_DoubleToWideStringExt [< 1 ms]
Passed test_TokenizeWideStringOfInts_error [< 1 ms]
Passed test_TokenizeWideStringOfInts_empty [< 1 ms]
Passed test_TokenizeWideStringOfInts_clear_output [< 1 ms]
Passed test_TokenizeWideStringOfInts_0 [< 1 ms]
Passed test_TokenizeWideStringOfInts_012 [< 1 ms]
Passed test_TokenizeWideStringOfInts_fibb [< 1 ms]
Passed test_ReplaceFileExtension [< 1 ms]
Passed test_IntToDecWithCommas [< 1 ms]
Passed test_IntToDecWithCommas_neg [< 1 ms]
Passed test_IntToDecWithCommas_Ramanujan_Tau [< 1 ms]
Passed test_CaseInsensitiveWStringComparision [< 1 ms]
Passed test_WStringToLower [< 1 ms]
Passed test_WStringStartsWith [< 1 ms]
Passed test_CaseInsensitiveWStringStartsWith [< 1 ms]
Passed test_tablejson_char [< 1 ms]
Passed test_tablejson_wchar [< 1 ms]
Passed test_jsonobject_char [< 1 ms]
Passed test_jsonobject_wchar [< 1 ms]
Test Run Successful.
Total tests: 49
Passed: 49
Total time: 0.3098 Seconds
Edited by Przemyslaw Wirkus