]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf test: Restore sample rate for perf_event_attr
authorVeronika Molnarova <vmolnaro@redhat.com>
Thu, 3 Oct 2024 12:51:36 +0000 (14:51 +0200)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Oct 2024 16:46:12 +0000 (09:46 -0700)
commitf72751a73a6b6ad678d254335e031e4511282564
treebf6ff5b9ffe677eb6022cb65197e07730e41d553
parentd29d92df410e2fb523f640478b18f70c1823e55e
perf test: Restore sample rate for perf_event_attr

Test "Setup struct perf_event_attr" consists of multiple test cases that
can affect the max sample rate value for perf events. Some test cases
check this value as it should not be lowered under the set minimum for
the given test. Currently, it is possible for the test cases to affect
each other as the previous tests can lower the sample rate, leading to
a possible failure of some of the future test cases as the value is not
restored at any point.

   # 10: Setup struct perf_event_attr:
    --- start ---
    test child forked, pid 104220
    Using CPUID 0x00000000413fd0c1
    running './tests/attr/test-record-C0'
    Current sample rate: 10000
    running './tests/attr/test-record-basic'
    Current sample rate: 900
    running './tests/attr/test-record-branch-any'
    Current sample rate: 600
    running './tests/attr/test-record-dummy-C0'
    Current sample rate: 600
    expected sample_period=4000, got 600
    FAILED './tests/attr/test-record-dummy-C0' - match failure

Restore the max sample rate value for perf events to a reasonable value
before each test case if its value was lowered too much to ensure the
same conditions for each test case.

   # 10: Setup struct perf_event_attr:
    --- start ---
    test child forked, pid 107222
    Using CPUID 0x00000000413fd0c1
    running './tests/attr/test-record-C0'
    Current sample rate: 10000
    running './tests/attr/test-record-basic'
    Current sample rate: 800
    running './tests/attr/test-record-branch-any'
    Current sample rate: 700
    unsupp  './tests/attr/test-record-branch-any'
    running './tests/attr/test-record-branch-filter-any'
    Current sample rate: 10000
    running './tests/attr/test-record-count'
    Current sample rate: 10000
    running './tests/attr/test-record-data'
    Current sample rate: 600
    running './tests/attr/test-record-dummy-C0'
    Current sample rate: 800
    running './tests/attr/test-record-freq'
    Current sample rate: 10000
    ...

Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Radostin Stoyanov <rstoyano@redhat.com>
Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Link: https://lore.kernel.org/r/20241003125136.15918-1-vmolnaro@redhat.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/attr.py