[netperf-dev] netperf2 commit notice r286 - trunk/src
raj at netperf.org
raj at netperf.org
Mon Aug 4 17:10:02 PDT 2008
Author: raj
Date: 2008-08-04 17:10:01 -0700 (Mon, 04 Aug 2008)
New Revision: 286
Modified:
trunk/src/netcpu_kstat10.c
trunk/src/netlib.h
Log:
start to use lib_cpu_map in cpu util code
Modified: trunk/src/netcpu_kstat10.c
===================================================================
--- trunk/src/netcpu_kstat10.c 2008-07-28 18:30:02 UTC (rev 285)
+++ trunk/src/netcpu_kstat10.c 2008-08-05 00:10:01 UTC (rev 286)
@@ -70,6 +70,8 @@
void
cpu_util_init(void)
{
+ kstat_t *ksp;
+ int i;
kc = kstat_open();
if (kc == NULL) {
@@ -80,6 +82,37 @@
fflush(where);
exit(-1);
}
+
+ /* lets flesh-out a CPU instance number map since it seems that some
+ systems, not even those which are partitioned, can have
+ non-contiguous CPU numbers. discovered "the hard way" on a
+ T5220. raj 20080804 */
+ i = 0;
+ for (ksp = kc->kc_chain, i = 0;
+ (ksp != NULL) && (i < MAXCPUS);
+ ksp = ksp->ks_next) {
+ if ((strcmp(ksp->ks_module,"cpu") == 0) &&
+ (strcmp(ksp->ks_name,"sys") == 0)) {
+ if (debug) {
+ fprintf(where,"Mapping CPU instance %d to entry %d\n",
+ ksp->ks_instance,i);
+ fflush(where);
+ }
+ lib_cpu_map[i++] = ksp->ks_instance;
+ }
+ }
+
+ if (MAXCPUS == i) {
+ fprintf(where,
+ "Sorry, this system has more CPUs (%d) than netperf can handle (%d).\n",
+ i,
+ MAXCPUS);
+ fprintf(where,
+ "Please alter MAXCPUS in netlib.h and recompile.\n");
+ fflush(where);
+ exit(1);
+ }
+
return;
}
@@ -126,7 +159,7 @@
kstat_named_t *knp;
int i;
- ksp = kstat_lookup(kc, "cpu", cpu_num, "sys");
+ ksp = kstat_lookup(kc, "cpu", lib_cpu_map[cpu_num], "sys");
if ((ksp) && (ksp->ks_type == KSTAT_TYPE_NAMED)) {
/* happiness and joy, keep going */
nkcid = kstat_read(kc, ksp, NULL);
@@ -201,8 +234,9 @@
else {
/* the lookup failed or found the wrong type */
fprintf(where,
- "get_cpu_counters: kstat_lookup failed for module 'cpu' instance %d name 'sys' and KSTAT_TYPE_NAMED: errno %d %s\n",
+ "get_cpu_counters: kstat_lookup failed for module 'cpu' number %d instance %d name 'sys' and KSTAT_TYPE_NAMED: errno %d %s\n",
cpu_num,
+ lib_cpu_map[cpu_num],
errno,
strerror(errno));
fflush(where);
@@ -219,7 +253,7 @@
kstat_named_t *knp;
int i;
- ksp = kstat_lookup(kc, "cpu", cpu_num, "intrstat");
+ ksp = kstat_lookup(kc, "cpu", lib_cpu_map[cpu_num], "intrstat");
counters[cpu_num].interrupt = 0;
if ((ksp) && (ksp->ks_type == KSTAT_TYPE_NAMED)) {
@@ -273,8 +307,9 @@
else {
/* the lookup failed or found the wrong type */
fprintf(where,
- "get_cpu_counters: kstat_lookup failed for module 'cpu' instance %d class 'intrstat' and KSTAT_TYPE_NAMED: errno %d %s\n",
+ "get_cpu_counters: kstat_lookup failed for module 'cpu' %d instance %d class 'intrstat' and KSTAT_TYPE_NAMED: errno %d %s\n",
cpu_num,
+ lib_cpu_map[cpu_num],
errno,
strerror(errno));
fflush(where);
Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h 2008-07-28 18:30:02 UTC (rev 285)
+++ trunk/src/netlib.h 2008-08-05 00:10:01 UTC (rev 286)
@@ -596,6 +596,7 @@
extern double result_confid;
extern double loc_cpu_confid;
extern double rem_cpu_confid;
+extern int lib_cpu_map[];
#endif
#ifdef WIN32
More information about the netperf-dev
mailing list