Module Name: src
Committed By: maxv
Date: Tue Jan 31 17:38:54 UTC 2017
Modified Files:
src/sys/arch/x86/x86: tprof_amdpmi.c
Log Message:
Update the URLs, and add the DC_refills_ flags (from the spec, not present
on my cpu).
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/tprof_amdpmi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/tprof_amdpmi.c
diff -u src/sys/arch/x86/x86/tprof_amdpmi.c:1.4 src/sys/arch/x86/x86/tprof_amdpmi.c:1.5
--- src/sys/arch/x86/x86/tprof_amdpmi.c:1.4 Fri Nov 15 08:47:55 2013
+++ src/sys/arch/x86/x86/tprof_amdpmi.c Tue Jan 31 17:38:54 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_amdpmi.c,v 1.4 2013/11/15 08:47:55 msaitoh Exp $ */
+/* $NetBSD: tprof_amdpmi.c,v 1.5 2017/01/31 17:38:54 maxv Exp $ */
/*-
* Copyright (c)2008,2009 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_amdpmi.c,v 1.4 2013/11/15 08:47:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_amdpmi.c,v 1.5 2017/01/31 17:38:54 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: tprof_amdpmi
#include <x86/nmi.h>
#include <machine/cpufunc.h>
-#include <machine/cputypes.h> /* CPUVENDER_* */
+#include <machine/cputypes.h> /* CPUVENDOR_* */
#include <machine/cpuvar.h> /* cpu_vendor */
#include <machine/i82489reg.h>
#include <machine/i82489var.h>
@@ -73,16 +73,22 @@ __KERNEL_RCSID(0, "$NetBSD: tprof_amdpmi
/* bit 42-63 reserved */
/*
- * parameters
- *
- * XXX should not hardcode
- *
- * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf
- * http://developer.amd.com/Assets/Basic_Performance_Measurements.pdf
+ * Documents:
+ * http://support.amd.com/TechDocs/32559.pdf
+ * http://developer.amd.com/wordpress/media/2012/10/Basic_Performance_Measurements.pdf
*/
-static uint32_t event = 0x76; /* CPU Clocks not Halted */
-static uint32_t unit = 0;
+/* Event flags - abbreviations as found in the documents */
+#define CPU_clocks__EVENT 0x76
+#define CPU_clocks__UNIT 0x00
+#define DC_refills_L2__EVENT 0x42
+#define DC_refills_L2__UNIT 0x1E
+#define DC_refills_sys__EVENT 0x43
+#define DC_refills_sys__UNIT 0x1E
+
+/* Hardcode your counter here */
+static uint32_t event = CPU_clocks__EVENT;
+static uint32_t unit = CPU_clocks__UNIT;
static int ctrno = 0;
static uint64_t counter_val = 5000000;