diff options
author | Milosz Wasilewski <milosz.wasilewski@hackbox.linaro.org> | 2014-10-02 10:16:33 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@hackbox.linaro.org> | 2014-10-02 10:16:33 +0100 |
commit | 24689e01d37605141ce768d94a94f0be3421049d (patch) | |
tree | b2ac61c7572a4bbb49aa5c871fe6f3fd68436db1 /powerpc/pmu/per_event_excludes.c | |
parent | e14eb051ff73ab8692770762adf44045ba092398 (diff) |
Update to 83d460a640af052ee4a6b8ef5104022ffd6d6a3b from repo http://git.linaro.org/kernel/linux-linaro-stable.git branch linux-linaro-lsk-v3.14eff6a902ff6b8a42f768c4b78fc63b9b8d0a41d9a779989fd4ccf6a58237ab3932559d8e60e157b6a47897538c3e1f71c35691a1f73e73dd9149977ca0d6a47ed69978c84ba8859c3cdbbbd04e79eb2d9347e87f7cd66d6ca96ba7d0b4b1cacebea4d09683d460a640af052ee4a6b8ef5104022ffd6d6a3b7adf3d9a27e4838d0af9250c53ad5744b84886ce7368857a8eed5144e56e65713970764ef0f2f0b8667ea3959654ae48ef303df13f2635fd07766cb45b9be6d71758967d5f24c91903ef3a1b22252a365210951a4876a42856434546d2789838d3e35f3447bbd44e18034d3277a29459d1f0c45e8d1c8d3e3af2dae32ca1108e47a435eaeec276a1c8289a362dad587ec1dddf02a00d3b54156337a6dc79a752297e25caff999eeccf24b19e62388450763af15d250e8659c56d94320b877f659be45b8de130fa3121d7f14b70fed254222a24e124e8771e1437be4c0d590a1ecd1ad44b2dae2bcdc5a6cb24a7080489linux-linaro-stable-3.14
Diffstat (limited to 'powerpc/pmu/per_event_excludes.c')
-rw-r--r-- | powerpc/pmu/per_event_excludes.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/powerpc/pmu/per_event_excludes.c b/powerpc/pmu/per_event_excludes.c deleted file mode 100644 index fddbbc9..0000000 --- a/powerpc/pmu/per_event_excludes.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2014, Michael Ellerman, IBM Corp. - * Licensed under GPLv2. - */ - -#define _GNU_SOURCE - -#include <elf.h> -#include <limits.h> -#include <stdio.h> -#include <stdbool.h> -#include <string.h> -#include <sys/prctl.h> - -#include "event.h" -#include "lib.h" -#include "utils.h" - -/* - * Test that per-event excludes work. - */ - -static int per_event_excludes(void) -{ - struct event *e, events[4]; - char *platform; - int i; - - platform = (char *)get_auxv_entry(AT_BASE_PLATFORM); - FAIL_IF(!platform); - SKIP_IF(strcmp(platform, "power8") != 0); - - /* - * We need to create the events disabled, otherwise the running/enabled - * counts don't match up. - */ - e = &events[0]; - event_init_opts(e, PERF_COUNT_HW_INSTRUCTIONS, - PERF_TYPE_HARDWARE, "instructions"); - e->attr.disabled = 1; - - e = &events[1]; - event_init_opts(e, PERF_COUNT_HW_INSTRUCTIONS, - PERF_TYPE_HARDWARE, "instructions(k)"); - e->attr.disabled = 1; - e->attr.exclude_user = 1; - e->attr.exclude_hv = 1; - - e = &events[2]; - event_init_opts(e, PERF_COUNT_HW_INSTRUCTIONS, - PERF_TYPE_HARDWARE, "instructions(h)"); - e->attr.disabled = 1; - e->attr.exclude_user = 1; - e->attr.exclude_kernel = 1; - - e = &events[3]; - event_init_opts(e, PERF_COUNT_HW_INSTRUCTIONS, - PERF_TYPE_HARDWARE, "instructions(u)"); - e->attr.disabled = 1; - e->attr.exclude_hv = 1; - e->attr.exclude_kernel = 1; - - FAIL_IF(event_open(&events[0])); - - /* - * The open here will fail if we don't have per event exclude support, - * because the second event has an incompatible set of exclude settings - * and we're asking for the events to be in a group. - */ - for (i = 1; i < 4; i++) - FAIL_IF(event_open_with_group(&events[i], events[0].fd)); - - /* - * Even though the above will fail without per-event excludes we keep - * testing in order to be thorough. - */ - prctl(PR_TASK_PERF_EVENTS_ENABLE); - - /* Spin for a while */ - for (i = 0; i < INT_MAX; i++) - asm volatile("" : : : "memory"); - - prctl(PR_TASK_PERF_EVENTS_DISABLE); - - for (i = 0; i < 4; i++) { - FAIL_IF(event_read(&events[i])); - event_report(&events[i]); - } - - /* - * We should see that all events have enabled == running. That - * shows that they were all on the PMU at once. - */ - for (i = 0; i < 4; i++) - FAIL_IF(events[i].result.running != events[i].result.enabled); - - /* - * We can also check that the result for instructions is >= all the - * other counts. That's because it is counting all instructions while - * the others are counting a subset. - */ - for (i = 1; i < 4; i++) - FAIL_IF(events[0].result.value < events[i].result.value); - - for (i = 0; i < 4; i++) - event_close(&events[i]); - - return 0; -} - -int main(void) -{ - return test_harness(per_event_excludes, "per_event_excludes"); -} |