diff options
author | Remy Noel <mocramis@gmail.com> | 2018-04-20 23:59:39 +0200 |
---|---|---|
committer | Remy Noel <mocramis@gmail.com> | 2018-04-21 01:27:49 +0200 |
commit | 5b92bf60486b62c8222ebd63d44faa7804c0edeb (patch) | |
tree | 01fca4cf43e56deed85d7ad80faf309b41789019 | |
parent | 0971db08230932057141990462f32c17ae088d82 (diff) |
perfmon: various cosmetics.
-rw-r--r-- | arch/x86/machine/pmu.h | 33 | ||||
-rw-r--r-- | arch/x86/machine/pmu_amd.c | 5 | ||||
-rw-r--r-- | arch/x86/machine/pmu_intel.c | 5 | ||||
-rw-r--r-- | kern/perfmon.c | 10 | ||||
-rw-r--r-- | kern/perfmon.h | 9 |
5 files changed, 45 insertions, 17 deletions
diff --git a/arch/x86/machine/pmu.h b/arch/x86/machine/pmu.h new file mode 100644 index 0000000..fdd79e7 --- /dev/null +++ b/arch/x86/machine/pmu.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018 Remy Noel. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Pmu driver modules. + */ + +#ifndef _X86_PMU_H +#define _X86_PMU_H + +#include <kern/init.h> + +/* + * PMU init modules + * - module fully initialized + */ +INIT_OP_DECLARE(pmu_intel_setup); +INIT_OP_DECLARE(pmu_amd_setup); + +#endif /* _X86_PMU_H */ + diff --git a/arch/x86/machine/pmu_amd.c b/arch/x86/machine/pmu_amd.c index 1c6545e..2fe6019 100644 --- a/arch/x86/machine/pmu_amd.c +++ b/arch/x86/machine/pmu_amd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Remy Noel. + * Copyright (c) 2014-2018 Remy Noel. * Copyright (c) 2014 Richard Braun. * * This program is free software: you can redistribute it and/or modify @@ -24,8 +24,9 @@ #include <kern/error.h> #include <kern/init.h> #include <kern/log.h> -#include <machine/cpu.h> #include <kern/perfmon.h> +#include <machine/cpu.h> +#include <machine/pmu.h> /* * AMD raw event IDs. diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c index bc7405c..0833a71 100644 --- a/arch/x86/machine/pmu_intel.c +++ b/arch/x86/machine/pmu_intel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Remy Noel. + * Copyright (c) 2014-2018 Remy Noel. * Copyright (c) 2014 Richard Braun. * * This program is free software: you can redistribute it and/or modify @@ -24,8 +24,9 @@ #include <kern/error.h> #include <kern/init.h> #include <kern/log.h> -#include <machine/cpu.h> #include <kern/perfmon.h> +#include <machine/cpu.h> +#include <machine/pmu.h> /* * Intel raw event IDs. diff --git a/kern/perfmon.c b/kern/perfmon.c index 4da95fb..4bedd99 100644 --- a/kern/perfmon.c +++ b/kern/perfmon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Remy Noel. + * Copyright (c) 2014-2018 Remy Noel. * Copyright (c) 2014-2015 Richard Braun. * * This program is free software: you can redistribute it and/or modify @@ -45,6 +45,7 @@ #include <kern/thread.h> #include <kern/xcall.h> #include <machine/cpu.h> +#include <machine/pmu.h> #include <machine/trap.h> /* @@ -564,8 +565,8 @@ INIT_OP_DEFINE(perfmon_setup, INIT_OP_DEP(panic_setup, true), INIT_OP_DEP(percpu_setup, true), INIT_OP_DEP(perfmon_bootstrap, true), - INIT_OP_DEP(pmu_intel_setup, false), INIT_OP_DEP(pmu_amd_setup, false), + INIT_OP_DEP(pmu_intel_setup, false), INIT_OP_DEP(spinlock_setup, true), INIT_OP_DEP(thread_setup, true), INIT_OP_DEP(trap_setup, true)); @@ -646,14 +647,13 @@ perfmon_event_sync(struct perfmon_cpu_pmu *cpu_pmu, struct perfmon_pmc *pmc; struct perfmon_cpu_pmc *cpu_pmc; uint64_t count; + int diff; pmc = perfmon_pmc_from_index(event->pmc_index); cpu_pmc = &cpu_pmu->pmcs[event->pmc_index]; count = pmu_driver.read(pmc->id); if (unlikely(event->overflow_id != cpu_pmc->overflow_id)) { - int diff; - assert(cpu_pmc->overflow_id > event->overflow_id); diff = cpu_pmc->overflow_id > event->overflow_id; @@ -1272,7 +1272,7 @@ perfmon_thread_load(struct thread *thread) assert(!cpu_intr_enabled()); assert(!thread_preempt_enabled()); - grouplist =thread->perfmon_groups; + grouplist = thread->perfmon_groups; spinlock_lock(&grouplist->lock); diff --git a/kern/perfmon.h b/kern/perfmon.h index 3b9a002..b979e65 100644 --- a/kern/perfmon.h +++ b/kern/perfmon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Remy Noel. + * Copyright (c) 2014-2018 Remy Noel. * Copyright (c) 2014 Richard Braun. * * This program is free software: you can redistribute it and/or modify @@ -247,11 +247,4 @@ void perfmon_cpu_pmc_set_prev(unsigned int pmc_id, uint64_t prev); */ void perfmon_cpu_pmc_inc_of(unsigned int pmc_id); -/* - * PMU init moduls - * - module fully initialized - */ -INIT_OP_DECLARE(pmu_intel_setup); -INIT_OP_DECLARE(pmu_amd_setup); - #endif /* _KERN_PERFMON_H */ |