Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Update the URLs, and add the DC_refills_ fl...



details:   https://anonhg.NetBSD.org/src/rev/32b6da4a684e
branches:  trunk
changeset: 821288:32b6da4a684e
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jan 31 17:38:54 2017 +0000

description:
Update the URLs, and add the DC_refills_ flags (from the spec, not present
on my cpu).

diffstat:

 sys/arch/x86/x86/tprof_amdpmi.c |  28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diffs (58 lines):

diff -r 34fe988cdb08 -r 32b6da4a684e sys/arch/x86/x86/tprof_amdpmi.c
--- a/sys/arch/x86/x86/tprof_amdpmi.c   Tue Jan 31 17:13:36 2017 +0000
+++ b/sys/arch/x86/x86/tprof_amdpmi.c   Tue Jan 31 17:38:54 2017 +0000
@@ -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 @@
 #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 @@
                                /* 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;



Home | Main Index | Thread Index | Old Index