[wperf] Enhance PrettyTable so it supports multi-row per item as well as items being of the type PrettyTable.

Implements https://linaro.atlassian.net/browse/WPERF-561

This change in itself is already too complex. This is going to support disassembly at a later MR.

  • I changed PrettyTable's m_table map to support a std::variant instead of the usual vector of strings. With this I can add the possibility of items being PrettyTables in themselves.
  • I also needed to enable items to occupy more than a single row, so the infrastructure to calculate row lengths based on items was added.
  • Printing got more complex because. It is now broken down into printing one line at a time, this facilitates recursively printing tables as elements.

This is a result from a standalone version

        Column 1  Column 2        Column 3  Column 4  Column 5               Column 6
        ========  ========        ========  ========  ========               ========
        a                1    HELLO  WORLD  1           OLLEH  DLROW  WORLD  1
                              =====  =====              =====  =====  =====
                              A         10              AA        11    100
                              B         20              BB        22    200
                              C         30              CC        33    300
                                                        DD        44    400
                                                        EE        55    500
        b                2    HELLO  WORLD  2           OLLEH  DLROW  WORLD  2
                              =====  =====              =====  =====  =====
                              A         10              AA        12    101
                              B         20              BB        23    201
                              C         30              CC        34    301
                                                        DD        45    401
                                                        EE        56    501
        c                3    HELLO  WORLD  3           OLLEH  DLROW  WORLD  3
                              =====  =====              =====  =====  =====
                              A         10              AA        13    102
                              B         20              BB        24    202
                              C         30              CC        35    302
                                                        DD        46    402
                                                        EE        57    502

Unfortuantely for now there isn't much testing that can be done on this feature beyond what we already do with Python. We will be able to enhance this once disassembly gets merged.

The results from usual Python unit tests follows

============================= test session starts =============================
platform win32 -- Python 3.10.3, pytest-7.2.1, pluggy-1.0.0
rootdir: C:\Users\everton\wperf-scripts\tests, configfile: pytest.ini
collected 168 items / 4 skipped

wperf_cli_common_test.py ....                                            [  2%]
wperf_cli_config_test.py .....                                           [  5%]
wperf_cli_extra_events_test.py ....                                      [  7%]
wperf_cli_info_str_test.py .                                             [  8%]
wperf_cli_json_validator_test.py ........                                [ 13%]
wperf_cli_list_test.py .....                                             [ 16%]
wperf_cli_metrics_test.py ..s....sssssssss                               [ 25%]
wperf_cli_padding_test.py ...........                                    [ 32%]
wperf_cli_record_test.py ..............                                  [ 40%]
wperf_cli_stat_test.py ................................................. [ 69%]
..                                                                       [ 70%]
wperf_cli_test_test.py .....                                             [ 73%]
wperf_cli_timeline_test.py .........................ssssssssssssssssss   [ 99%]
wperf_lib_app_test.py s                                                  [100%]

=========================== short test summary info ===========================
SKIPPED [1] wperf_cli_ustress_bench_test.py:109: skipping as ustress do not support CPU=ARMV8_A
SKIPPED [1] wperf_cli_ustress_dep_record_test.py:104: skipping as ustress do not support CPU=ARMV8_A
SKIPPED [1] wperf_cli_ustress_dep_wperf_lib_timeline_test.py:107: skipping as ustress do not support CPU=ARMV8_A
SKIPPED [1] wperf_cli_ustress_dep_wperf_test.py:107: skipping as ustress do not support CPU=ARMV8_A
SKIPPED [2] wperf_cli_metrics_test.py:71: unsupported configuration
SKIPPED [4] wperf_cli_metrics_test.py:99: unsupported configuration
SKIPPED [4] wperf_cli_metrics_test.py:129: unsupported configuration
SKIPPED [4] wperf_cli_timeline_test.py:244: unsupported metric: l1d_cache_miss_ratio
SKIPPED [2] wperf_cli_timeline_test.py:244: unsupported metric: l1d_tlb_mpki
SKIPPED [8] wperf_cli_timeline_test.py:306: unsupported metric: l1d_cache_miss_ratio
SKIPPED [4] wperf_cli_timeline_test.py:306: unsupported metric: l1d_tlb_mpki
SKIPPED [1] wperf_lib_app_test.py:44: Can not run wperf-lib-app.exe
================= 139 passed, 33 skipped in 263.50s (0:04:23) =================

Merge request reports

Loading