Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/tprof Obtain the number of general counters from CPU...
details: https://anonhg.NetBSD.org/src/rev/16e1833c7ce8
branches: trunk
changeset: 374209:16e1833c7ce8
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Apr 11 02:47:01 2023 +0000
description:
Obtain the number of general counters from CPUID 0xa.
diffstat:
sys/dev/tprof/tprof_x86_intel.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r c44f10813517 -r 16e1833c7ce8 sys/dev/tprof/tprof_x86_intel.c
--- a/sys/dev/tprof/tprof_x86_intel.c Tue Apr 11 02:44:06 2023 +0000
+++ b/sys/dev/tprof/tprof_x86_intel.c Tue Apr 11 02:47:01 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_x86_intel.c,v 1.5 2022/12/01 00:32:52 ryo Exp $ */
+/* $NetBSD: tprof_x86_intel.c,v 1.6 2023/04/11 02:47:01 msaitoh Exp $ */
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.5 2022/12/01 00:32:52 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.6 2023/04/11 02:47:01 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -79,7 +79,6 @@
#include <machine/i82489reg.h>
#include <machine/i82489var.h>
-#define NCTRS 4 /* XXX */
static u_int counter_bitwidth;
#define PERFEVTSEL(i) (MSR_EVNTSEL0 + (i))
@@ -102,7 +101,11 @@ static nmi_handler_t *intel_nmi_handle;
static uint32_t
tprof_intel_ncounters(void)
{
- return NCTRS;
+ uint32_t descs[4];
+
+ x86_cpuid(0x0a, descs);
+
+ return __SHIFTOUT(descs[0], CPUID_PERF_NGPPC);
}
static u_int
Home |
Main Index |
Thread Index |
Old Index