summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cpc
diff options
context:
space:
mode:
authorJonathan Haslam <Jonathan.Haslam@Sun.COM>2008-09-19 13:14:28 +0100
committerJonathan Haslam <Jonathan.Haslam@Sun.COM>2008-09-19 13:14:28 +0100
commitc7a079a873b863c236656bd0db7b2cf390841b4d (patch)
tree7812a50b4caaf22d35d6125731d648466c3239fa /usr/src/cmd/cpc
parente8e4e80fe335862e1a369070e9acaa2060866c90 (diff)
downloadillumos-joyent-c7a079a873b863c236656bd0db7b2cf390841b4d.tar.gz
PSARC 2008/334 CPU Performance Counter Generic Event Names
6689461 CPC Generic Events 6423769 cpustat system global_power_events for Xeon incorrect
Diffstat (limited to 'usr/src/cmd/cpc')
-rw-r--r--usr/src/cmd/cpc/common/caps.c38
-rw-r--r--usr/src/cmd/cpc/common/strtoset.c7
2 files changed, 34 insertions, 11 deletions
diff --git a/usr/src/cmd/cpc/common/caps.c b/usr/src/cmd/cpc/common/caps.c
index 8057df3c57..5ed12182d3 100644
--- a/usr/src/cmd/cpc/common/caps.c
+++ b/usr/src/cmd/cpc/common/caps.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#define __EXTENSIONS__ /* header bug! strtok_r is overly hidden */
#include <string.h>
#include <strings.h>
@@ -139,7 +136,7 @@ allpics_equal(cpc_t *cpc)
for (i = 1; i < npics; i++)
if (lists[i]->size != lists[0]->size ||
strncmp(lists[i]->list, lists[0]->list,
- lists[0]->size) != 0) {
+ lists[0]->size) != 0) {
ret = 0;
break;
}
@@ -160,7 +157,7 @@ capabilities(cpc_t *cpc, FILE *fp)
char *text, *tok, *cp;
const char *ccp;
int npic = cpc_npic(cpc);
- int i;
+ int i, pics_equal = allpics_equal(cpc);
args->fp = fp;
@@ -174,7 +171,30 @@ capabilities(cpc_t *cpc, FILE *fp)
(void) fprintf(args->fp, "\t[picn=]<eventn>[,attr[n][=<val>]]"
"[,[picn=]<eventn>[,attr[n][=<val>]],...]\n");
- if (allpics_equal(cpc)) {
+ (void) fprintf(args->fp, gettext("\n\tGeneric Events:\n"));
+
+ if (pics_equal) {
+ args->margin = args->colnum = EVENT_MARGIN;
+ (void) fprintf(args->fp, "\n\tevent[0-%d]: ", npic - 1);
+ cpc_walk_generic_events_pic(cpc, 0, args, list_cap);
+ (void) fprintf(args->fp, "\n");
+ } else {
+ args->margin = EVENT_MARGIN;
+ for (i = 0; i < npic; i++) {
+ (void) fprintf(args->fp, "\n\tevent%d: ", i);
+ if (i < 10) (void) fprintf(args->fp, " ");
+ args->colnum = EVENT_MARGIN;
+ cpc_walk_generic_events_pic(cpc, i, args, list_cap);
+ (void) fprintf(args->fp, "\n");
+ }
+ }
+
+ (void) fprintf(args->fp, gettext("\n\tSee generic_events(3CPC) for"
+ " descriptions of these events\n\n"));
+
+ (void) fprintf(args->fp, gettext("\tPlatform Specific Events:\n"));
+
+ if (pics_equal) {
args->margin = args->colnum = EVENT_MARGIN;
(void) fprintf(args->fp, "\n\tevent[0-%d]: ", npic - 1);
cpc_walk_events_pic(cpc, 0, args, list_cap);
diff --git a/usr/src/cmd/cpc/common/strtoset.c b/usr/src/cmd/cpc/common/strtoset.c
index b61f7d75b8..a5236fd376 100644
--- a/usr/src/cmd/cpc/common/strtoset.c
+++ b/usr/src/cmd/cpc/common/strtoset.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <alloca.h>
@@ -125,6 +123,11 @@ event_valid(int picnum, char *event)
if (found)
return (1);
+ cpc_walk_generic_events_pic(cpc, picnum, event, event_walker);
+
+ if (found)
+ return (1);
+
/*
* Before assuming this is an invalid event, see if we have been given
* a raw event code. An event code of '0' is not recognized, as it