[prev in list] [next in list] [prev in thread] [next in thread]
List: oprofile-list
Subject: [patch 5/7] Oprofile AMD IBS support
From: "Jason Yeh" <jason.yeh () amd ! com>
Date: 2008-01-29 21:49:34
Message-ID: 479F9F6E.8050002 () amd ! com
[Download RAW message or body]
This patch includes changes to recognize IBS events and correction to Family 10h processor name.
---
libop/op_cpu_type.c | 2 +-
libop/op_cpu_type.h | 2 +-
libop/op_events.c | 21 ++++++++++++++++-----
utils/ophelp.c | 15 ++++++++++++++-
4 files changed, 32 insertions(+), 8 deletions(-)
diff -uprN -X dontdiff oprofile-cvs-original/utils/ophelp.c oprofile-cvs-ibs/utils/ophelp.c
--- oprofile-cvs-original/utils/ophelp.c 2008-01-28 16:05:29.000000000 -0600
+++ oprofile-cvs-ibs/utils/ophelp.c 2008-01-29 09:39:46.000000000 -0600
@@ -73,6 +73,19 @@ static void help_for_event(struct op_eve
do_arch_specific_event_help(event);
nr_counters = op_get_nr_counters(cpu_type);
+ /*
+ * Sanity check
+ */
+ if(!event)
+ return;
+
+ /*
+ * Check for IBS derived events, we do not want
+ * to list these events
+ */
+ if( event->name != NULL && strncmp(event->name,"IBS",3) == 0)
+ return;
+
printf("%s", event->name);
printf(": (counter: ");
@@ -385,7 +398,7 @@ int main(int argc, char const * argv[])
printf("oprofile: available events for CPU type \"%s\"\n\n", pretty);
switch (cpu_type) {
case CPU_HAMMER:
- case CPU_FAMILY10:
+ case CPU_FAMILY10H:
break;
case CPU_ATHLON:
printf ("See AMD document x86 optimisation guide (22007.pdf), Appendix D\n\n");
diff -uprN -X dontdiff oprofile-cvs-original/libop/op_cpu_type.c oprofile-cvs-ibs/libop/op_cpu_type.c
--- oprofile-cvs-original/libop/op_cpu_type.c 2008-01-28 16:05:27.000000000 -0600
+++ oprofile-cvs-ibs/libop/op_cpu_type.c 2008-01-29 09:39:46.000000000 -0600
@@ -67,7 +67,7 @@ static struct cpu_descr const cpu_descrs
{ "ppc64 POWER6", "ppc64/power6", CPU_PPC64_POWER6, 4 },
{ "ppc64 970MP", "ppc64/970MP", CPU_PPC64_970MP, 8 },
{ "ppc64 Cell Broadband Engine", "ppc64/cell-be", CPU_PPC64_CELL, 8 },
- { "AMD64 family10", "x86-64/family10", CPU_FAMILY10, 4 },
+ { "AMD64 family10h", "x86-64/family10h", CPU_FAMILY10H, 4 },
{ "ppc64 PA6T", "ppc64/pa6t", CPU_PPC64_PA6T, 6 },
{ "ARM MPCore", "arm/mpcore", CPU_ARM_MPCORE, 2 },
{ "ARM V6 PMU", "arm/armv6", CPU_ARM_V6, 3 },
diff -uprN -X dontdiff oprofile-cvs-original/libop/op_cpu_type.h oprofile-cvs-ibs/libop/op_cpu_type.h
--- oprofile-cvs-original/libop/op_cpu_type.h 2008-01-28 16:05:26.000000000 -0600
+++ oprofile-cvs-ibs/libop/op_cpu_type.h 2008-01-29 09:39:46.000000000 -0600
@@ -65,7 +65,7 @@ typedef enum {
CPU_PPC64_POWER6, /**< ppc64 POWER6 family */
CPU_PPC64_970MP, /**< ppc64 970MP */
CPU_PPC64_CELL, /**< ppc64 Cell Broadband Engine*/
- CPU_FAMILY10, /**< AMD family 10 */
+ CPU_FAMILY10H, /**< AMD family 10 */
CPU_PPC64_PA6T, /**< ppc64 PA6T */
CPU_ARM_MPCORE, /**< ARM MPCore */
CPU_ARM_V6, /**< ARM V6 */
diff -uprN -X dontdiff oprofile-cvs-original/libop/op_events.c oprofile-cvs-ibs/libop/op_events.c
--- oprofile-cvs-original/libop/op_events.c 2008-01-28 16:05:27.000000000 -0600
+++ oprofile-cvs-ibs/libop/op_events.c 2008-01-29 09:39:46.000000000 -0600
@@ -432,10 +432,20 @@ static void load_events(op_cpu cpu_type)
char * um_file;
char * dir;
struct list_head * pos;
+ static op_cpu last_cpu_type = 0;
- if (!list_empty(&events_list))
- return;
-
+ if(last_cpu_type != cpu_type)
+ {
+ last_cpu_type = cpu_type;
+
+ // Empty the list and reinitialize it.
+ op_free_events();
+ }
+ else
+ {
+ if (!list_empty(&events_list))
+ return;
+ }
dir = getenv("OPROFILE_EVENTS_DIR");
if (dir == NULL)
dir = OP_DATADIR;
@@ -691,7 +701,8 @@ struct op_event * op_find_event(op_cpu c
{
struct op_event * event;
- load_events(cpu_type);
+ if (list_empty(&events_list))
+ load_events(cpu_type);
event = find_event(nr);
@@ -758,7 +769,7 @@ void op_default_event(op_cpu cpu_type, s
case CPU_CORE_2:
case CPU_ATHLON:
case CPU_HAMMER:
- case CPU_FAMILY10:
+ case CPU_FAMILY10H:
descr->name = "CPU_CLK_UNHALTED";
break;
["op_cvs_IBS_PATCH_5" (text/plain)]
diff -uprN -X dontdiff oprofile-cvs-original/utils/ophelp.c oprofile-cvs-ibs/utils/ophelp.c
--- oprofile-cvs-original/utils/ophelp.c 2008-01-28 16:05:29.000000000 -0600
+++ oprofile-cvs-ibs/utils/ophelp.c 2008-01-29 09:39:46.000000000 -0600
@@ -73,6 +73,19 @@ static void help_for_event(struct op_eve
do_arch_specific_event_help(event);
nr_counters = op_get_nr_counters(cpu_type);
+ /*
+ * Sanity check
+ */
+ if(!event)
+ return;
+
+ /*
+ * Check for IBS derived events, we do not want
+ * to list these events
+ */
+ if( event->name != NULL && strncmp(event->name,"IBS",3) == 0)
+ return;
+
printf("%s", event->name);
printf(": (counter: ");
@@ -385,7 +398,7 @@ int main(int argc, char const * argv[])
printf("oprofile: available events for CPU type \"%s\"\n\n", pretty);
switch (cpu_type) {
case CPU_HAMMER:
- case CPU_FAMILY10:
+ case CPU_FAMILY10H:
break;
case CPU_ATHLON:
printf ("See AMD document x86 optimisation guide (22007.pdf), Appendix D\n\n");
diff -uprN -X dontdiff oprofile-cvs-original/libop/op_cpu_type.c oprofile-cvs-ibs/libop/op_cpu_type.c
--- oprofile-cvs-original/libop/op_cpu_type.c 2008-01-28 16:05:27.000000000 -0600
+++ oprofile-cvs-ibs/libop/op_cpu_type.c 2008-01-29 09:39:46.000000000 -0600
@@ -67,7 +67,7 @@ static struct cpu_descr const cpu_descrs
{ "ppc64 POWER6", "ppc64/power6", CPU_PPC64_POWER6, 4 },
{ "ppc64 970MP", "ppc64/970MP", CPU_PPC64_970MP, 8 },
{ "ppc64 Cell Broadband Engine", "ppc64/cell-be", CPU_PPC64_CELL, 8 },
- { "AMD64 family10", "x86-64/family10", CPU_FAMILY10, 4 },
+ { "AMD64 family10h", "x86-64/family10h", CPU_FAMILY10H, 4 },
{ "ppc64 PA6T", "ppc64/pa6t", CPU_PPC64_PA6T, 6 },
{ "ARM MPCore", "arm/mpcore", CPU_ARM_MPCORE, 2 },
{ "ARM V6 PMU", "arm/armv6", CPU_ARM_V6, 3 },
diff -uprN -X dontdiff oprofile-cvs-original/libop/op_cpu_type.h oprofile-cvs-ibs/libop/op_cpu_type.h
--- oprofile-cvs-original/libop/op_cpu_type.h 2008-01-28 16:05:26.000000000 -0600
+++ oprofile-cvs-ibs/libop/op_cpu_type.h 2008-01-29 09:39:46.000000000 -0600
@@ -65,7 +65,7 @@ typedef enum {
CPU_PPC64_POWER6, /**< ppc64 POWER6 family */
CPU_PPC64_970MP, /**< ppc64 970MP */
CPU_PPC64_CELL, /**< ppc64 Cell Broadband Engine*/
- CPU_FAMILY10, /**< AMD family 10 */
+ CPU_FAMILY10H, /**< AMD family 10 */
CPU_PPC64_PA6T, /**< ppc64 PA6T */
CPU_ARM_MPCORE, /**< ARM MPCore */
CPU_ARM_V6, /**< ARM V6 */
diff -uprN -X dontdiff oprofile-cvs-original/libop/op_events.c oprofile-cvs-ibs/libop/op_events.c
--- oprofile-cvs-original/libop/op_events.c 2008-01-28 16:05:27.000000000 -0600
+++ oprofile-cvs-ibs/libop/op_events.c 2008-01-29 09:39:46.000000000 -0600
@@ -432,10 +432,20 @@ static void load_events(op_cpu cpu_type)
char * um_file;
char * dir;
struct list_head * pos;
+ static op_cpu last_cpu_type = 0;
- if (!list_empty(&events_list))
- return;
-
+ if(last_cpu_type != cpu_type)
+ {
+ last_cpu_type = cpu_type;
+
+ // Empty the list and reinitialize it.
+ op_free_events();
+ }
+ else
+ {
+ if (!list_empty(&events_list))
+ return;
+ }
dir = getenv("OPROFILE_EVENTS_DIR");
if (dir == NULL)
dir = OP_DATADIR;
@@ -691,7 +701,8 @@ struct op_event * op_find_event(op_cpu c
{
struct op_event * event;
- load_events(cpu_type);
+ if (list_empty(&events_list))
+ load_events(cpu_type);
event = find_event(nr);
@@ -758,7 +769,7 @@ void op_default_event(op_cpu cpu_type, s
case CPU_CORE_2:
case CPU_ATHLON:
case CPU_HAMMER:
- case CPU_FAMILY10:
+ case CPU_FAMILY10H:
descr->name = "CPU_CLK_UNHALTED";
break;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
oprofile-list mailing list
oprofile-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic