[netperf-dev] netperf4 commit notice r8 - trunk/src
raj at netperf.org
raj at netperf.org
Wed Oct 26 17:56:06 PDT 2005
Author: raj
Date: 2005-10-26 17:56:05 -0700 (Wed, 26 Oct 2005)
New Revision: 8
Modified:
trunk/src/netmsg.c
trunk/src/netperf.c
trunk/src/netserver.c
trunk/src/netsysstats_common.c
trunk/src/netsysstats_hpux.c
trunk/src/netsysstats_linux.c
Log:
rationalize changes in netsysstats_hpux into netsysstats_linux and such.
Modified: trunk/src/netmsg.c
===================================================================
--- trunk/src/netmsg.c 2005-10-27 00:07:55 UTC (rev 7)
+++ trunk/src/netmsg.c 2005-10-27 00:56:05 UTC (rev 8)
@@ -1,5 +1,5 @@
char netmsg_id[]="\
-@(#)netmsg.c (c) Copyright 2005, Hewlett-Packard Company, Version 4.0.0";
+@(#)netmsg.c (c) Copyright 2005, Hewlett-Packard Company, $Id$";
/*
@@ -140,7 +140,11 @@
msg = xmlDocGetRootElement(doc);
if (msg == NULL) {
fprintf(stderr,"empty document\n");
+ fflush(stderr);
+ printf("freeing the %p empty doc\n",doc);
xmlFreeDoc(doc);
+ /* somehow I don't think that returning NPE_SUCCESS is the right
+ thing here? raj 2005-10-26 */
return(rc);
}
fromnid = xmlGetProp(msg,(const xmlChar *)"fromnid");
@@ -185,7 +189,9 @@
which_msg++;
}
}
+ printf("freeing the %p doc doc\n",doc);
xmlFreeDoc(doc);
+ printf("freed the %p doc doc\n",doc);
return(rc);
}
Property changes on: trunk/src/netmsg.c
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c 2005-10-27 00:07:55 UTC (rev 7)
+++ trunk/src/netperf.c 2005-10-27 00:56:05 UTC (rev 8)
@@ -1,8 +1,8 @@
+char netperf_id[]="\
+@(#)netperf.c (c) Copyright 2005, Hewlett-Packard Company, $Id$";
/*
netperf - network-oriented performance benchmarking
-/*
-
This file is part of netperf4.
Netperf4 is free software; you can redistribute it and/or modify it
Property changes on: trunk/src/netperf.c
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c 2005-10-27 00:07:55 UTC (rev 7)
+++ trunk/src/netserver.c 2005-10-27 00:56:05 UTC (rev 8)
@@ -1,3 +1,5 @@
+char netserver_id[]="\
+@(#)netserver.c (c) Copyright 2005, Hewlett-Packard Company, $Id$";
/*
This file is part of netperf4.
Property changes on: trunk/src/netserver.c
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/netsysstats_common.c
===================================================================
--- trunk/src/netsysstats_common.c 2005-10-27 00:07:55 UTC (rev 7)
+++ trunk/src/netsysstats_common.c 2005-10-27 00:56:05 UTC (rev 8)
@@ -1,5 +1,5 @@
char netsysstats_id[]="\
-@(#)netsysstats_common.c (c) Copyright 2005, Hewlett-Packard Company, Version 4.0.0";
+@(#)netsysstats_common.c (c) Copyright 2005, Hewlett-Packard Company, $Id$";
/*
Property changes on: trunk/src/netsysstats_common.c
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/netsysstats_hpux.c
===================================================================
--- trunk/src/netsysstats_hpux.c 2005-10-27 00:07:55 UTC (rev 7)
+++ trunk/src/netsysstats_hpux.c 2005-10-27 00:56:05 UTC (rev 8)
@@ -1,5 +1,5 @@
char netsysstats_specific_id[]="\
-@(#)netsysstats_hpux.c (c) Copyright 2005, Hewlett-Packard Company, Version 4.0.0";
+@(#)netsysstats_hpux.c (c) Copyright 2005, Hewlett-Packard Company, $Id$";
/*
Property changes on: trunk/src/netsysstats_hpux.c
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/netsysstats_linux.c
===================================================================
--- trunk/src/netsysstats_linux.c 2005-10-27 00:07:55 UTC (rev 7)
+++ trunk/src/netsysstats_linux.c 2005-10-27 00:56:05 UTC (rev 8)
@@ -1,5 +1,5 @@
char netsysstats_linux[]="\
-@(#)netsysstats_linux.c (c) Copyright 2005, Hewlett-Packard Company, Version 4.0.0";
+@(#)netsysstats_linux.c (c) Copyright 2005, Hewlett-Packard Company, $Id$";
/*
@@ -67,9 +67,9 @@
static int proc_stat_buflen = 0;
enum {
- LINUX_SYS_STATS_PSTAT_GETPROCESSOR_FAILED = -5,
+ LINUX_SYS_STATS_PROCSTAT_OPEN_FAILED = -5,
LINUX_SYS_STATS_MALLOC_FAILED = -4,
- LINUX_SYS_STATS_GETDYNAMIC_FAILED = -3,
+ LINUX_SYS_STATS_SYSCONF_FAILED = -3,
LINUX_SYS_STATS_REQUESTED_STATE_INVALID = -2,
LINUX_SYS_STATS_STATE_CORRUPTED = -1,
LINUX_SYS_STATS_SUCCESS = 0
@@ -78,7 +78,6 @@
extern int debug;
FILE *where;
-int num_cpus;
int ticks;
struct timeval prev_time;
@@ -87,30 +86,34 @@
struct timeval total_elapsed_time;
struct timeval delta_elapsed_time;
-struct pst_processor *psp;
-
-static void
-sys_cpu_util_init(void)
+int
+sys_cpu_util_init(netsysstat_data_t *tsd)
{
where = stderr;
+ int err;
+ if ((tsd->num_cpus = sysconf(_SC_NPROCESSORS_ONLN)) == -1) {
+ return(LINUX_SYS_STATS_SYSCONF_FAILED);
+ }
+
if (proc_stat_fd < 0) {
proc_stat_fd = open (PROC_STAT_FILE_NAME, O_RDONLY, NULL);
if (proc_stat_fd < 0) {
fprintf (stderr, "Cannot open %s!\n", PROC_STAT_FILE_NAME);
- exit (1);
+ return(LINUX_SYS_STATS_PROCSTAT_OPEN_FAILED);
};
};
if (!proc_stat_buf) {
- proc_stat_buflen = N_CPU_LINES (num_cpus) * CPU_LINE_LENGTH;
+ proc_stat_buflen = N_CPU_LINES (tsd->num_cpus) * CPU_LINE_LENGTH;
proc_stat_buf = (char *)malloc (proc_stat_buflen);
if (!proc_stat_buf) {
fprintf (stderr, "Cannot allocate buffer memory!\n");
- exit (1);
+ close(proc_stat_fd);
+ return(LINUX_SYS_STATS_MALLOC_FAILED);
};
};
- return;
+ return LINUX_SYS_STATS_SUCCESS;
}
/* get the cpu ticks from /proc/stat for each CPU. There are four
@@ -140,10 +143,10 @@
fflush(where);
}
/* Skip first line (total) on SMP */
- if (num_cpus > 1) p = strchr (p, '\n');
+ if (tsd->num_cpus > 1) p = strchr (p, '\n');
- for (i = 0; i < num_cpus; i++) {
+ for (i = 0; i < tsd->num_cpus; i++) {
records = sscanf(proc_stat_buf,
"%s %lld %lld %lld %lld",
cpunam,
Property changes on: trunk/src/netsysstats_linux.c
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the netperf-dev
mailing list