diff options
author | Milosz Wasilewski <milosz.wasilewski@hackbox.linaro.org> | 2014-10-02 10:16:18 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@hackbox.linaro.org> | 2014-10-02 10:16:18 +0100 |
commit | 8b27a74bc734d860958941b1a331aa7b38bc2af4 (patch) | |
tree | 90f368cfd48a916aa52ddbd3356a7ef2224384a8 /powerpc/pmu/per_event_excludes.c | |
parent | e14eb051ff73ab8692770762adf44045ba092398 (diff) |
Update to 54cd4bea5a18f7bd5921a76d31eef4c61a68d8e7 from repo http://git.linaro.org/kernel/linux-linaro-stable.git branch linux-linaro-lsk-v3.10f6e46ae658e4443e765f87702603deca167f2b57f1326e0892329b0d58dec467f71f5d94c4d5d5a9d266af7f712dc494727b6a18e26fb123911884d5ceafc84623c8ef94c13a87363277a595988b2b79c810fcb930d9c705774427bb6eb551b2e1108adbc293f79246d7cdaf6e75b40aa1f957eb8d195835bbba26b2fc88c77239ebcd45d7fb669018511dfeba0bfedf4c9cad58f56a7038d1462ffc21cd33dfb94eedf4bb47fe789e3947875beb24f558ebd11988720d8b842c59efcc0c4dc17e2107f4dae502f580124ed1ec12ae83dfdcae3ca15e491a813c1729709d22822886bfb105a1c498c14ab6647d0f1284692d96aa22dea8bb80018c6a76556ad6afd464a654cd4bea5a18f7bd5921a76d31eef4c61a68d8e743e7406efd7822d75c64310461d2cbca0ece19f02eb736d6b425cb932b038fd555243b9b0e59c0362156eda2aafa0b0f660656246a11d7c2a9947ff91874098820e8269fe88d67bc08c908134dd8710215f82fce54b86e159fe5a1d41dcdc89e12b264590bde84f40232e0f81bb9fa79d7953fed4a32811clinux-linaro-stable-3.10
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"); -} |