--- GalileoGlobals.cpp	Sat Jul 19 10:21:42 2003
+++ GalileoGlobals.cpp.mod	Sat Aug  2 15:04:55 2003
@@ -4,7 +4,43 @@
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
-/* ##  Job .......: ...                                                   ## */
+/* ##  Job .......: <to be set>                                           ## */
+/* ##                                                                     ## */
+/* ## ------------------------------------------------------------------- ## */
+/* ##                                                                     ## */
+/* ##  Intel Open Source License                                          ## */
+/* ##                                                                     ## */
+/* ##  Copyright (c) 2001 Intel Corporation                               ## */
+/* ##  All rights reserved.                                               ## */
+/* ##  Redistribution and use in source and binary forms, with or         ## */
+/* ##  without modification, are permitted provided that the following    ## */
+/* ##  conditions are met:                                                ## */
+/* ##                                                                     ## */
+/* ##  Redistributions of source code must retain the above copyright     ## */
+/* ##  notice, this list of conditions and the following disclaimer.      ## */
+/* ##                                                                     ## */
+/* ##  Redistributions in binary form must reproduce the above copyright  ## */
+/* ##  notice, this list of conditions and the following disclaimer in    ## */
+/* ##  the documentation and/or other materials provided with the         ## */
+/* ##  distribution.                                                      ## */
+/* ##                                                                     ## */
+/* ##  Neither the name of the Intel Corporation nor the names of its     ## */
+/* ##  contributors may be used to endorse or promote products derived    ## */
+/* ##  from this software without specific prior written permission.      ## */
+/* ##                                                                     ## */
+/* ##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND             ## */
+/* ##  CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,      ## */
+/* ##  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF           ## */
+/* ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE           ## */
+/* ##  DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS  CONTRIBUTORS BE    ## */
+/* ##  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,   ## */
+/* ##  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,           ## */
+/* ##  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,    ## */
+/* ##  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    ## */
+/* ##  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     ## */
+/* ##  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT    ## */
+/* ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY    ## */
+/* ##  OF SUCH DAMAGE.                                                    ## */
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
@@ -12,58 +48,16 @@
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
-/* ##  Changes ...: 2003-04-25 (daniel.scheibli@edelbyte.org)             ## */
+/* ##  Changes ...: 2003-08-02 (daniel.scheibli@edelbyte.org)             ## */
+/* ##               - Moved to the use of the IOMTR_[OSFAMILY|OS|CPU]_*   ## */
+/* ##                 global defines.                                     ## */
+/* ##               - Integrated the License Statement into this header.  ## */
+/* ##               2003-04-25 (daniel.scheibli@edelbyte.org)             ## */
 /* ##               - Updated the global debug flag (_DEBUG) handling     ## */
 /* ##                 of the source file (check for platform etc.).       ## */
 /* ##               - Added new header holding the changelog.             ## */
 /* ##                                                                     ## */
 /* ######################################################################### */
-/*
-Intel Open Source License 
-
-Copyright (c) 2001 Intel Corporation 
-All rights reserved. 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met: 
-
-   Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer. 
-
-   Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution. 
-
-   Neither the name of the Intel Corporation nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
- 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS  CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// ==========================================================================
-//                  Copyright (C) 1999-2000 Intel Corporation
-//                          All rights reserved                               
-//                INTEL CORPORATION PROPRIETARY INFORMATION                   
-//    This software is supplied under the terms of a license agreement or     
-//    nondisclosure agreement with Intel Corporation and may not be copied    
-//    or disclosed except in accordance with the terms of that agreement.     
-// ==========================================================================
-//
-// This is one of the CENTRAL PROJECT FILES for Iometer
-// GalileoDefs.h		- GUI-wide central include file
-// GalileoGlobals.cpp	- global function implementation file
-//
-//////////////////////////////////////////////////////////////////////
-/* ######################################################################### */
 
 
 #include "stdafx.h"
@@ -71,6 +65,7 @@
 #include "GalileoApp.h"
 
 
+
 // Needed for MFC Library support for assisting in finding memory leaks
 //
 // NOTE: Based on the documentation[1] I found, it should be enough to have
@@ -81,12 +76,13 @@
 //       [1] = http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_debug_new.asp
 //
 #if defined (_WIN32) || defined (_WIN64)
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
+ #ifdef _DEBUG
+  #define new DEBUG_NEW
+  #undef THIS_FILE
+  static char THIS_FILE[] = __FILE__;
+ #endif
 #endif
+
 
 
 UINT MessageBoxThread(LPVOID pErrorMessage);
--- IOCQAIO.cpp	Sat Jul 19 10:21:48 2003
+++ IOCQAIO.cpp.mod	Sat Aug  2 15:06:27 2003
@@ -8,62 +8,57 @@
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
+/* ##  Intel Open Source License                                          ## */
+/* ##                                                                     ## */
+/* ##  Copyright (c) 2001 Intel Corporation                               ## */
+/* ##  All rights reserved.                                               ## */
+/* ##  Redistribution and use in source and binary forms, with or         ## */
+/* ##  without modification, are permitted provided that the following    ## */
+/* ##  conditions are met:                                                ## */
+/* ##                                                                     ## */
+/* ##  Redistributions of source code must retain the above copyright     ## */
+/* ##  notice, this list of conditions and the following disclaimer.      ## */
+/* ##                                                                     ## */
+/* ##  Redistributions in binary form must reproduce the above copyright  ## */
+/* ##  notice, this list of conditions and the following disclaimer in    ## */
+/* ##  the documentation and/or other materials provided with the         ## */
+/* ##  distribution.                                                      ## */
+/* ##                                                                     ## */
+/* ##  Neither the name of the Intel Corporation nor the names of its     ## */
+/* ##  contributors may be used to endorse or promote products derived    ## */
+/* ##  from this software without specific prior written permission.      ## */
+/* ##                                                                     ## */
+/* ##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND             ## */
+/* ##  CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,      ## */
+/* ##  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF           ## */
+/* ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE           ## */
+/* ##  DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS  CONTRIBUTORS BE    ## */
+/* ##  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,   ## */
+/* ##  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,           ## */
+/* ##  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,    ## */
+/* ##  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    ## */
+/* ##  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     ## */
+/* ##  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT    ## */
+/* ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY    ## */
+/* ##  OF SUCH DAMAGE.                                                    ## */
+/* ##                                                                     ## */
+/* ## ------------------------------------------------------------------- ## */
+/* ##                                                                     ## */
 /* ##  Remarks ...: <none>                                                ## */
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
-/* ##  Changes ...: 2003-02-02 (daniel.scheibli@edelbyte.org)             ## */
+/* ##  Changes ...: 2003-08-02 (daniel.scheibli@edelbyte.org)             ## */
+/* ##               - Moved to the use of the IOMTR_[OSFAMILY|OS|CPU]_*   ## */
+/* ##                 global defines.                                     ## */
+/* ##               - Integrated the License Statement into this header.  ## */
+/* ##               2003-02-02 (daniel.scheibli@edelbyte.org)             ## */
 /* ##               - Applied the iometer-initial-datatypes.patch file.   ## */
 /* ##                 (changing the datatype of the "temp" variable in    ## */
 /* ##                 the GetStatus(int*, int*, int) method).             ## */
 /* ##                                                                     ## */
 /* ######################################################################### */
-/*
-Intel Open Source License 
 
-Copyright (c) 2001 Intel Corporation 
-All rights reserved. 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met: 
-
-   Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer. 
-
-   Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution. 
-
-   Neither the name of the Intel Corporation nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
- 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS  CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// ==========================================================================
-//                Copyright (C) 1997-2000 Intel Corporation
-//                          All rights reserved                               
-//                INTEL CORPORATION PROPRIETARY INFORMATION                   
-//    This software is supplied under the terms of a license agreement or     
-//    nondisclosure agreement with Intel Corporation and may not be copied    
-//    or disclosed except in accordance with the terms of that agreement.     
-// ==========================================================================
-//
-// IOCQAIO.cpp: Implementation of the class CQAIO, which provides a Completion
-// Queue for asynchronous access to TargetDisk and TargetTCP objects.  CQAIO
-// is an implementation of the abstract class CQ.
-//
-//////////////////////////////////////////////////////////////////////
-/* ######################################################################### */
 
 #include "IOCQAIO.h"
 
@@ -123,7 +118,8 @@
 }
 
 
-#ifdef UNIX
+
+#if defined(IOMTR_OSFAMILY_UNIX)
 BOOL CQAIO::SetQueueSize(int size)
 {
     struct IOCQ *this_cqid = (struct IOCQ *)completion_queue;
@@ -154,3 +150,5 @@
     return(TRUE);
 }
 #endif
+
+
--- IOGrunt.h	Sat Jul 19 10:22:00 2003
+++ IOGrunt.h.mod	Sat Aug  2 15:08:48 2003
@@ -8,10 +8,51 @@
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
+/* ##  Intel Open Source License                                          ## */
+/* ##                                                                     ## */
+/* ##  Copyright (c) 2001 Intel Corporation                               ## */
+/* ##  All rights reserved.                                               ## */
+/* ##  Redistribution and use in source and binary forms, with or         ## */
+/* ##  without modification, are permitted provided that the following    ## */
+/* ##  conditions are met:                                                ## */
+/* ##                                                                     ## */
+/* ##  Redistributions of source code must retain the above copyright     ## */
+/* ##  notice, this list of conditions and the following disclaimer.      ## */
+/* ##                                                                     ## */
+/* ##  Redistributions in binary form must reproduce the above copyright  ## */
+/* ##  notice, this list of conditions and the following disclaimer in    ## */
+/* ##  the documentation and/or other materials provided with the         ## */
+/* ##  distribution.                                                      ## */
+/* ##                                                                     ## */
+/* ##  Neither the name of the Intel Corporation nor the names of its     ## */
+/* ##  contributors may be used to endorse or promote products derived    ## */
+/* ##  from this software without specific prior written permission.      ## */
+/* ##                                                                     ## */
+/* ##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND             ## */
+/* ##  CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,      ## */
+/* ##  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF           ## */
+/* ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE           ## */
+/* ##  DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS  CONTRIBUTORS BE    ## */
+/* ##  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,   ## */
+/* ##  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,           ## */
+/* ##  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,    ## */
+/* ##  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    ## */
+/* ##  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     ## */
+/* ##  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT    ## */
+/* ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY    ## */
+/* ##  OF SUCH DAMAGE.                                                    ## */
+/* ##                                                                     ## */
+/* ## ------------------------------------------------------------------- ## */
+/* ##                                                                     ## */
 /* ##  Remarks ...: <none>                                                ## */
+/* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
-/* ##  Changes ...: 2003-05-07 (yakker@aparity.com)                       ## */
+/* ##  Changes ...: 2003-08-02 (daniel.scheibli@edelbyte.org)             ## */
+/* ##               - Moved to the use of the IOMTR_[OSFAMILY|OS|CPU]_*   ## */
+/* ##                 global defines.                                     ## */
+/* ##               - Integrated the License Statement into this header.  ## */
+/* ##               2003-05-07 (yakker@aparity.com)                       ## */
 /* ##               - Applied the iometerCIOB5.2003.05.02.patch file      ## */
 /* ##                 (avoiding cache line collisions and performance     ## */
 /* ##                 lock-ups for some chipsets).                        ## */
@@ -19,53 +60,6 @@
 /* ##               - Added new header holding the changelog.             ## */
 /* ##                                                                     ## */
 /* ######################################################################### */
-/*
-Intel Open Source License 
-
-Copyright (c) 2001 Intel Corporation 
-All rights reserved. 
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met: 
-
-   Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer. 
-
-   Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution. 
-
-   Neither the name of the Intel Corporation nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
- 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS  CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// ==========================================================================
-//                Copyright (C) 1997-2000 Intel Corporation
-//                          All rights reserved                               
-//                INTEL CORPORATION PROPRIETARY INFORMATION                   
-//    This software is supplied under the terms of a license agreement or     
-//    nondisclosure agreement with Intel Corporation and may not be copied    
-//    or disclosed except in accordance with the terms of that agreement.     
-// ==========================================================================
-//
-// IOGrunt.h: Interface for the Grunt (worker) class for Dynamo.
-// There is one Grunt for each worker.  This class performs all I/O to
-// the targets and records its own results.  
-//
-//////////////////////////////////////////////////////////////////////
-/* ######################################################################### */
-
 #ifndef	GRUNT_DEFINED
 #define	GRUNT_DEFINED
 
@@ -84,7 +78,7 @@
 void Grunt_Thread_Wrapper( void *grunt );
 
 #define TIMEOUT_TIME	1000	// max time to wait for an asynch
-								// I/O to complete, in milliseconds
+				// I/O to complete, in milliseconds
 
 //
 // An I/O worker who does all of the dirty work.
@@ -227,6 +221,7 @@
 	// Used by random number generator functions.
 	DWORDLONG	holdrand;
 };
+
 
 
 #endif
--- IOPerformance.cpp	Sat Jul 19 14:23:20 2003
+++ IOPerformance.cpp.mod	Sat Aug  2 19:25:22 2003
@@ -53,7 +53,12 @@
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
-/* ##  Changes ...: 2003-07-19 (daniel.scheibli@edelbyte.org)             ## */
+/* ##  Changes ...: 2003-08-02 (daniel.scheibli@edelbyte.org)             ## */
+/* ##               - Moved to the use of the IOMTR_[OSFAMILY|OS|CPU]_*   ## */
+/* ##                 global defines.                                     ## */
+/* ##               - Massive cleanup of this file (grouping the          ## */
+/* ##                 different blocks together).                         ## */
+/* ##               2003-07-19 (daniel.scheibli@edelbyte.org)             ## */
 /* ##               - Removed IOTime.h inclusion (now in IOCommon.h)      ## */
 /* ##               - Integrated the License Statement into this header.  ## */
 /* ##               2003-03-04 (joe@eiler.net)                            ## */
@@ -67,22 +72,19 @@
 /* ##                 Get_Processor_Speed() method).                      ## */
 /* ##                                                                     ## */
 /* ######################################################################### */
-
-
 #define PERFORMANCE_DETAILS	0 // Turn on to display additional performance messages.
+#if !defined(IOMTR_OS_LINUX)
 
 
 
-#ifndef LINUX
-
 #include "IOPerformance.h"
-#ifdef UNIX
-#ifdef SOLARIS
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/processor.h>
-#endif // SOLARIS
-#endif // UNIX
+#if defined(IOMTR_OS_SOLARIS)
+ #include <sys/types.h>
+ #include <unistd.h>
+ #include <sys/processor.h>
+#endif
+
+
 
 //
 // Initializing system performance data.
@@ -91,15 +93,19 @@
 {
 	int i;
 
-#if defined (_WIN32) || defined (_WIN64)
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 	// Allocating buffer to receive performance data.
 	if ( !( perf_data = (LPBYTE) malloc( MAX_PERF_SIZE ) ) )
 	{
 		cout << "*** Unable to allocate space for performance data." << endl << flush;
 		exit( 1 );
 	}
-	perf_size = MAX_PERF_SIZE;
+	perf_size   = MAX_PERF_SIZE;
 	perf_object = NULL;
+#elif defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 
 	// Obtaining the number of CPUs in the system and their speed.
@@ -119,7 +125,7 @@
 		exit( 1 );
 	}
 
-#if defined (_WIN32) || defined (_WIN64)
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 	// Setting the NT CPU performance counters to extract.
 	cpu_perf_counter_info[CPU_TOTAL_UTILIZATION].index = PERF_CPU_TOTAL_UTILIZATION;
 	cpu_perf_counter_info[CPU_USER_UTILIZATION].index = PERF_CPU_USER_UTILIZATION;
@@ -141,9 +147,7 @@
 		tcp_perf_counter_info[i].offset = IOERROR;
 	for ( i = 0; i < NI_RESULTS; i++ )
 		ni_perf_counter_info[i].offset = IOERROR;
-#endif // WIN32 || _WIN64
-
-#ifdef SOLARIS
+#elif defined(IOMTR_OS_SOLARIS)
 	// Initialize all the arrays to 0.
 	memset(raw_cpu_data, 0, (MAX_CPUS * CPU_RESULTS * MAX_SNAPSHOTS * sizeof(_int64)));
 	memset(raw_ni_data, 0, (MAX_NUM_INTERFACES * NI_RESULTS * MAX_SNAPSHOTS * sizeof(_int64)));
@@ -235,86 +239,48 @@
 		streamfd = 0;
 	}
 	else streamfd = -1;
-#endif /* SOLARIS */
-
-#ifdef LINUX
-#endif /* LINUX */
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
+#endif
 }
 
 
 
+
+
 //
 // Freeing memory used by class object.
 //
 Performance::~Performance()
 {
-#if defined (_WIN32) || defined (_WIN64)
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 	free( perf_data );
-#else
+#elif defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
 	free(ctlbuf);
 	free(databuf);
 	kstat_close(kc);
 	streamfd = -1;
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 }
 
 
 
+
+
 //
 // Getting the number of processors in the system.
 //
 int Performance::Get_Processor_Count()
 {
-#ifdef UNIX
-#ifdef SOLARIS
+#if defined(IOMTR_OS_SOLARIS)
 	return (sysconf(_SC_NPROCESSORS_CONF));
-#endif // SOLARIS
-#ifdef LINUX
-	/*
-	 * The file "/proc/stat" enumerates the CPUs, one per line, each line starting
-	 * with the string "cpu". I prepend a '\n' to the file, then search for the
-	 * string "\ncpu"; that way, I will find every time that "cpu" appears as the
-	 * first thing in a line.
-	 *
-	 * Example /proc/stat file:
-	 **********************************************************************
-	 * cpu  1847686 355419 509281 14738354
-	 * disk 69683 0 22232 0
-	 * disk_rio 18236 0 302 0
-	 * disk_wio 51447 0 21930 0
-	 * disk_rblk 145876 0 2374 0
-	 * disk_wblk 411576 0 173352 0
-	 * page 76934 442943
-	 * swap 1410 2465
-	 * intr 21377391 17450740 101201 0 2 2 0 3 0 1 0 0 69197 724623 1 340233 2691388 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-	 * ctxt 175242460
-	 * btime 942875987
-	 **********************************************************************
-	 */
-	char stats[16 * 1024 + 1], *search;
-	int fd, byteCount, cpuCount;
-	fd = open("/proc/stat", O_RDONLY);
-	if (fd < 0) {
-	  cout << "*** Unable to determine number of processors in system.";
-	  return 0;
-	}
-	byteCount = read(fd, stats + 1, sizeof(stats) - 1);
-	close(fd);
-	if ((byteCount < 0) || (byteCount == sizeof(stats) - 1)) {
-	  cout << "*** Unable to determine number of processors in system.";
-	  return 0;
-	}
-	stats[0] = '\n'; // Make the first line begin with a \n, like the others.
-	stats[byteCount + 1] = '\0';
-	search = stats;
-	cpuCount = 0;
-	while ((search = strstr(search, "\ncpu")) != NULL) {
-	  ++cpuCount;
-	  ++search; // Make sure we don't find the same CPU again!
-	}
-	return(cpuCount);
-#endif
-#else // WIN_NT
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 	SYSTEM_INFO	system_info;
 
 	SetLastError( 0 );
@@ -326,11 +292,15 @@
 	}
 	cout << "Number of processors: " << system_info.dwNumberOfProcessors << endl;
 	return (int) system_info.dwNumberOfProcessors;
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 }
 
 
 
+
+
 #define SPEED_VALUE_COUNT 117
 //
 // Getting the speed of the processors in Hz.
@@ -353,51 +323,17 @@
 		 300,  280,  275,  266,  250,  240,  233,  220,  210,
 		 200,  180,  175,  166,  150,  140,  133,  120,  110,
 		 100,   80,   75,   66,   50,   40,   33,   25,   20 };
-
 	DWORD speed;
-#ifndef SOLARIS
+
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64) 
 	int speed_magnitude; /* 0=MHz,1=GHz */
 	DWORD type;
 	DWORD size_of_speed = sizeof( DWORD );
-#endif
-#ifdef UNIX
-#ifdef SOLARIS
-	processor_info_t infop;
-	int j, status;
-
-	for (j = 0; j < MAX_CPUS; j++)
-	{
-		status = p_online((processorid_t)j, P_STATUS);
-		if ((status == -1) || (status == EINVAL))
-			continue;
-
-		// Ok we found a processor.
-		// This call should succeed. Else it means that the system has no processors !!!
-		// ("its haunted" !!!) or that this call is unsupported.
-		if (processor_info((processorid_t)j, &infop) < 0)
-		{
-			cout << "*** Could not determine processor speed." << endl << flush;
-			return (double) 0.0;
-		}
-		// found a processor and also the obtained the infop structure. So break.
-		break;
-	}
-	if (j == MAX_CPUS)
-	{
-		cout << "*** Could not determine processor speed." << endl << flush;
-		return (double) 0.0;
-	}
 
-	// If there are more than one processors, well, we get the speed of the first one.
-	speed = infop.pi_clock;
-#endif // SOLARIS
-#ifdef LINUX
-#endif // LINUX
-#else // WIN_NT
-//#ifndef WIN64_COUNTER_WORKAROUND
 	BOOL rdtsc_or_itc_supported = TRUE;
 	HKEY processor_speed_key;
-#ifndef _WIN64
+
+#if defined(IOMTR_OS_WIN32)
 	// Try RDTSC and see if it causes an exception.  (This code is NT-specific 
 	// because Solaris does not support __try/__except.)
 	__try
@@ -412,8 +348,7 @@
 	{
 		rdtsc_or_itc_supported = FALSE;
 	}
-#endif // !_WIN64
-#ifdef _WIN64
+#elif defined(IOMTR_OS_WIN64)
 	//*** Trying to read ITC instead of using GetTickCount.  See IOTime.h.
 
 	// Try ITC and see if it causes an exception.  (This code is NT-specific 
@@ -426,18 +361,17 @@
 	{
 		rdtsc_or_itc_supported = FALSE;
 	}
-#endif // _WIN64
+#endif
 
 	if ( !rdtsc_or_itc_supported )
 	{
-#ifndef _WIN64
-		cout << "*** Processor does not support RDTSC instruction!" << endl <<
-			    "    Dynamo requires this for high-resolution timing." << endl;
-#endif // !_WIN64
-#ifdef _WIN64
-		cout << "*** Processor does not support ITC instruction!" << endl <<
-			    "    Dynamo requires this for high-resolution timing." << endl;
-#endif // _WIN64
+#if defined(IOMTR_OS_WIN32)
+		cout << "*** Processor does not support RDTSC instruction!"    << endl <<
+			"    Dynamo requires this for high-resolution timing." << endl;
+#elif defined(IOMTR_OS_WIN64)
+		cout << "*** Processor does not support ITC instruction!"      << endl <<
+			"    Dynamo requires this for high-resolution timing." << endl;
+#endif
 		return (double) 0.0;
 	}
 	// Retrieving the estimated speed from the NT system registry.
@@ -472,18 +406,48 @@
 		speed *= 1000; /* convert the GHz value to MHz */
 	}
 
-#endif // WIN_NT
-//#ifdef WIN64_COUNTER_WORKAROUND
+	//#ifdef WIN64_COUNTER_WORKAROUND
    	// *** Removed ***
 	//
 	//currently Win64 uses GetTickCOunt whose units are in milliseconds.
 	//
-    //return (double) MILLISECOND;
-    //
+    	//return (double) MILLISECOND;
+   	//
 	// *** End Removed ***
+#elif defined(IOMTR_OS_SOLARIS)
+	processor_info_t infop;
+	int j, status;
+
+	for (j = 0; j < MAX_CPUS; j++)
+	{
+		status = p_online((processorid_t)j, P_STATUS);
+		if ((status == -1) || (status == EINVAL))
+			continue;
 
+		// Ok we found a processor.
+		// This call should succeed. Else it means that the system has no processors !!!
+		// ("its haunted" !!!) or that this call is unsupported.
+		if (processor_info((processorid_t)j, &infop) < 0)
+		{
+			cout << "*** Could not determine processor speed." << endl << flush;
+			return (double) 0.0;
+		}
+		// found a processor and also the obtained the infop structure. So break.
+		break;
+	}
+	if (j == MAX_CPUS)
+	{
+		cout << "*** Could not determine processor speed." << endl << flush;
+		return (double) 0.0;
+	}
 
-//#endif	
+	// If there are more than one processors, well, we get the speed of the first one.
+	speed = infop.pi_clock;
+#elif defined(LINUX)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
+#endif
 
 	for ( int i = 0; i < SPEED_VALUE_COUNT; i++ )
 	{
@@ -517,6 +481,8 @@
 
 
 
+
+
 /*
 Getting NT performance counters.  These counters provide the same performance
 information found running perfmon.
@@ -552,17 +518,20 @@
 	PERF_OBJECT_TYPE t:
 		...
 */
-
 //
 // Extracting system performance data.  The data is accessed through the NT registry, but stored elsewhere.
 //
 void Performance::Get_Perf_Data( DWORD perf_data_type, int snapshot )
 {
-#ifndef SOLARIS
-	long	query_result;				// Value returned trying to query performance data.
-	DWORD	perf_object_size;			// Size of buffer allocated to storing performance data.
+#if defined(IOMTR_OS_SOLARIS)
+	long	query_result;			// Value returned trying to query performance data.
+	DWORD	perf_object_size;		// Size of buffer allocated to storing performance data.
 	char	perf_data_type_name[10];	// ASCII representation of performance data index.
-	_int64	perf_update_freq;			// Frequency that performance counters are updated.
+	_int64	perf_update_freq;		// Frequency that performance counters are updated.
+#elif defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64) 
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 
 	// Get the performance data stored by the system.
@@ -570,7 +539,7 @@
 		cout << "   Getting system performance data." << endl << flush;
 	#endif
 
-#if defined (_WIN32) || defined (_WIN64)
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 	perf_object_size = perf_size;
 	_itoa( perf_data_type, perf_data_type_name, 10 );  // convert index to a string
 
@@ -649,15 +618,6 @@
 			perf_time = (double)(time_counter[LAST_SNAPSHOT] - time_counter[FIRST_SNAPSHOT]) / perf_update_freq;
 		else
 		{
-//
-// *** Removed:  Need to add back in if using getTickCount.
-//
-//#ifndef WIN64_COUNTER_WORKAROUND //the new getTickCount doesn't take snapshots fast enough for the test 
-//			cout << "*** Unable to get time or frequency of performance update." << endl << flush;
-//#endif
-//
-// *** End Removed.
-//
 			perf_time = (double) 0.0;	// Error gathering performance time, mark as invalid.
 		}
 		#if _DEBUG
@@ -665,7 +625,7 @@
 		#endif
 	}
 	Extract_Counters( perf_data_type, snapshot );
-#else // ! WINDOWS => UNIX
+#elif defined(IOMTR_OS_SOLARIS)
 	time_counter[snapshot] = gethrtime();
 	if (snapshot == LAST_SNAPSHOT)
 		// calculate time diff in clock ticks..
@@ -686,118 +646,273 @@
 	default:
 		break;
 	}
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 }
 
-#ifdef UNIX
-void Performance::Get_CPU_Counters(int snapshot)
-{
-	kstat_t		*ksp;
-	cpu_stat_t	*cpu_stat;
-	int			current_cpu = 0;
-	
-	for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next)
-	{
-		if (ksp->ks_type != KSTAT_TYPE_RAW)
-			continue;
 
-		// cpu_stat is raw data.
-		if (strcmp(ksp->ks_module, "cpu_stat") == 0)
-		{
-			// found a cpu_stat.
-			if (-1 == kstat_read(kc, ksp, NULL))
-			{
-				cout << "kstat_read() failed with error " << errno << endl;
-				exit(1);
-			}
-			// else kstat_read thru..
-			cpu_stat = (cpu_stat_t *)ksp->ks_data;
-			// store the cpu_data
-			raw_cpu_data[current_cpu][CPU_TOTAL_UTILIZATION][snapshot] =
-				cpu_stat->cpu_sysinfo.cpu[CPU_USER] + cpu_stat->cpu_sysinfo.cpu[CPU_KERNEL];
-			raw_cpu_data[current_cpu][CPU_USER_UTILIZATION][snapshot] =
-				cpu_stat->cpu_sysinfo.cpu[CPU_USER];
-			raw_cpu_data[current_cpu][CPU_PRIVILEGED_UTILIZATION][snapshot] =
-				cpu_stat->cpu_sysinfo.cpu[CPU_KERNEL];
-			raw_cpu_data[current_cpu][CPU_DPC_UTILIZATION][snapshot] = 0;
-			raw_cpu_data[current_cpu][CPU_IRQ_UTILIZATION][snapshot] = 0;
-			raw_cpu_data[current_cpu][CPU_IRQ][snapshot] = cpu_stat->cpu_sysinfo.intr;
-			if (current_cpu++ > processor_count)
-				break;
-		}
-	}
-	return;
-}
 
-void Performance::Get_NI_Counters(int snapshot)
+
+
+//
+// Calculating CPU statistics based on snapshots of performance counters.
+//
+void Performance::Calculate_CPU_Stats( CPU_Results *cpu_results )
 {
-	kstat_t		*ksp;
-	kstat_named_t *knamed;
-	int			current_nic = 0 , i;
+	int		cpu, stat;		// Loop control variables.
 
-	for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next)
+	// Loop though all CPUs and determine various utilization statistics.
+	cpu_results->count = processor_count;
+	for ( cpu = 0; cpu < processor_count; cpu++ )
 	{
-		if (ksp->ks_type != KSTAT_TYPE_NAMED)
-			continue;
-
-		// NET data is NAMED data.
-		if (strcmp(ksp->ks_name, nic_names[current_nic]) == 0)
+		// Loop through the counters and calculate performance.
+		for ( stat = 0; stat < CPU_RESULTS; stat++ )
 		{
-			// found the interface we are looking for.
-			if (0 > kstat_read(kc, ksp, NULL))
+			#if PERFORMANCE_DETAILS
+				cout << "Calculating stat " << stat << " for CPU " << cpu << endl;
+			#endif
+
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
+			// If we've never set the counter offsets, then we've never successfully retrieved
+			// the performance data.  Set all of the values to 0.
+			if ( cpu_perf_counter_info[stat].offset == IOERROR )
 			{
-				cout << "kstat_read() failed with error " << errno << endl;
-				exit(1);
+				cout << "*** Offset to CPU performance counter not defined for stat " 
+					 << stat << "." << endl;
+				cpu_results->CPU_utilization[cpu][stat] = (double)0.0;
 			}
-			// store data into raw_ni_data. First initialize for this snapshot to 
-			// prevent a buildup of values.
-			raw_ni_data[current_nic][NI_PACKETS][snapshot] = 0;
-			raw_ni_data[current_nic][NI_ERRORS][snapshot] = 0;
-
-			for (i=0; i < ksp->ks_ndata; i++)
+			else
 			{
-				knamed = KSTAT_NAMED_PTR(ksp)  + i;
-				if (strcmp(knamed->name, "opackets") == 0)
-					raw_ni_data[current_nic][NI_PACKETS][snapshot] += knamed->value.ui32;
-				if (strcmp(knamed->name, "ipackets") == 0)
-					raw_ni_data[current_nic][NI_PACKETS][snapshot] += knamed->value.ui32;
-				if (strcmp(knamed->name, "oerrors") == 0)
-					raw_ni_data[current_nic][NI_ERRORS][snapshot] += knamed->value.ui32;
-				if (strcmp(knamed->name, "ierrors") == 0)
+				cpu_results->CPU_utilization[cpu][stat] = Calculate_Stat( 
+					raw_cpu_data[cpu][stat][FIRST_SNAPSHOT],
+					raw_cpu_data[cpu][stat][LAST_SNAPSHOT],
+					cpu_perf_counter_info[stat].type );
+			}
+#elif defined(IOMTR_OS_SOLARIS)
+			double result;
+			if (stat == CPU_IRQ)
+			{
+				// we have to calculate Interrupts/sec.
+				// This is similar to calculating Network packets per second
+				// but we are more fortunate here.
+				// See the corresponding Notes at the end of this file for a description.
+				//
+				result = ((double) raw_cpu_data[cpu][stat][LAST_SNAPSHOT]
+						 - raw_cpu_data[cpu][stat][FIRST_SNAPSHOT]) * 
+						 clock_tick / timediff;
+				cpu_results->CPU_utilization[cpu][stat] = result;	
+			}
+			else
+			{
+				// All other CPU statistics.
+				result = ((double) raw_cpu_data[cpu][stat][LAST_SNAPSHOT]
+							- raw_cpu_data[cpu][stat][FIRST_SNAPSHOT]) / timediff;
+
+				if (result < 0.0) 
 				{
-					raw_ni_data[current_nic][NI_IN_ERRORS][snapshot] = knamed->value.ui32;
-					raw_ni_data[current_nic][NI_ERRORS][snapshot] += knamed->value.ui32;
+					result = 0.0;
+					//
+					// CPU Utilization figures are outside valid range far too often.
+					// Ok, not in every cycle but frequent still.
+					// So, it is better to comment it out rather than have the message
+					// pop up on the screen at regular intervals.
+					//
+					// cout << "***** Error : CPU utilization outside valid range 0% - 100% *****" << endl;
+				}
+				if  (result > 1.0)
+				{
+					result = 1.0;
 				}
+
+				cpu_results->CPU_utilization[cpu][stat] = (result * 100);
 			}
-			if (current_nic++ > network_interfaces)
-				break;
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
+#endif
+
+			#if PERFORMANCE_DETAILS || _DETAILS
+				cout << "CPU " << cpu << " recorded stat " << stat << " = " 
+					<< cpu_results->CPU_utilization[cpu][stat] << endl;
+			#endif
 		}
 	}
-	return;
 }
 
 
-void Performance::Get_TCP_Counters(int snapshot)
-{
-	struct opthdr			*opthdr;
-	struct T_optmgmt_req	*optreq;
-#ifndef SOLARIS
-	struct T_optmgmt_ack	*optack;
-	struct T_error_ack		*errack;
-#endif
-	int						flags = 0, retval;
 
 
-	// We have already taken care of this in the constructor.
-	// streamfd will be -1 iff !superuser.
-	if (streamfd == -1)
-	{
-		raw_tcp_data[TCP_SEGMENTS_RESENT][snapshot] = 0;
-		return;
-	}
 
-	// only root can open "/dev/ip" and push "tcp" module onto it.
-	if ((streamfd = open("/dev/ip", O_RDWR, 0600)) < 0)
+//
+// Calculate network performance statistics based on snapshots of performance counters.
+//
+void Performance::Calculate_TCP_Stats( Net_Results *net_results )
+{
+	int		stat;		// Loop control variable.
+
+	// Loop through the counters and calculate performance.
+	for ( stat = 0; stat < TCP_RESULTS; stat++ )
+	{
+		// If we've never set the counter offsets, then we've never successfully retrieved
+		// the performance data.  Set all of the values to 0.
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
+		if ( tcp_perf_counter_info[stat].offset == IOERROR )
+		{
+			net_results->tcp_stats[stat] = (double)0.0;
+		}
+		else
+		{
+			net_results->tcp_stats[stat] = Calculate_Stat( 
+				raw_tcp_data[stat][FIRST_SNAPSHOT],
+				raw_tcp_data[stat][LAST_SNAPSHOT],
+				tcp_perf_counter_info[stat].type );
+		}
+#elif defined(IOMTR_OS_SOLARIS)
+		double result;
+		result = ((double) raw_tcp_data[stat][LAST_SNAPSHOT] - 
+			raw_tcp_data[stat][FIRST_SNAPSHOT]) / timediff;
+		result *= clock_tick;		// note that timediff is in CLK_TCKs and not seconds
+		net_results->tcp_stats[stat] = result;
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
+#endif
+
+		#if PERFORMANCE_DETAILS || _DETAILS
+			cout << "TCP recorded stat " << stat << " = " 
+				<< net_results->tcp_stats[stat] << endl;
+		#endif
+	}
+}
+
+
+
+
+
+//
+// Calculate network performance statistics based on snapshots of performance counters.
+//
+void Performance::Calculate_NI_Stats( Net_Results *net_results )
+{
+	int		net, stat;		// Loop control variables.
+
+	// Loop through the counters and calculate performance.
+	net_results->ni_count = network_interfaces;
+	for ( net = 0; net < network_interfaces; net++ )
+	{
+		for ( stat = 0; stat < NI_RESULTS; stat++ )
+		{
+			// If we've never set the counter offsets, then we've never successfully retrieved
+			// the performance data.  Set all of the values to 0.
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
+			if ( ni_perf_counter_info[stat].offset == IOERROR )
+			{
+				net_results->ni_stats[net][stat] = (double)0.0;
+			}
+			else
+			{
+				net_results->ni_stats[net][stat] = Calculate_Stat( 
+					raw_ni_data[net][stat][FIRST_SNAPSHOT],
+					raw_ni_data[net][stat][LAST_SNAPSHOT],
+					ni_perf_counter_info[stat].type );
+			}
+#elif defined(IOMTR_OS_SOLARIS)
+			double result;
+			//
+			// Note:
+			//		The array time_counter[] stores time in nanoseconds.
+			// Earlier, we used to divide by the calculated value of timediff and then
+			// multiply the result by clock_ticks per second to get the NI_data per
+			// second which was theoretically correct (and mathematically same as what 
+			// we are doing now) but reported wrong values while working with such 
+			// large numbers.
+			//
+			result = ((double) raw_ni_data[net][stat][LAST_SNAPSHOT] - 
+				raw_ni_data[net][stat][FIRST_SNAPSHOT]) * 1000000000.0 / 
+				((double) time_counter[LAST_SNAPSHOT] - time_counter[FIRST_SNAPSHOT]);
+
+			net_results->ni_stats[net][stat] = result;
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
+#endif
+
+			#if PERFORMANCE_DETAILS || _DETAILS
+				cout << "   Network interface " << net << " recorded stat " << stat << " = " 
+					<< net_results->ni_stats[net][stat] << endl;
+			#endif
+		}
+	}
+}
+
+
+
+
+
+#if defined(IOMTR_OS_SOLARIS)
+void Performance::Get_CPU_Counters(int snapshot)
+{
+	kstat_t		*ksp;
+	cpu_stat_t	*cpu_stat;
+	int		 current_cpu = 0;
+	
+	for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next)
+	{
+		if (ksp->ks_type != KSTAT_TYPE_RAW)
+			continue;
+
+		// cpu_stat is raw data.
+		if (strcmp(ksp->ks_module, "cpu_stat") == 0)
+		{
+			// found a cpu_stat.
+			if (-1 == kstat_read(kc, ksp, NULL))
+			{
+				cout << "kstat_read() failed with error " << errno << endl;
+				exit(1);
+			}
+			// else kstat_read thru..
+			cpu_stat = (cpu_stat_t *)ksp->ks_data;
+			// store the cpu_data
+			raw_cpu_data[current_cpu][CPU_TOTAL_UTILIZATION][snapshot] =
+				cpu_stat->cpu_sysinfo.cpu[CPU_USER] + cpu_stat->cpu_sysinfo.cpu[CPU_KERNEL];
+			raw_cpu_data[current_cpu][CPU_USER_UTILIZATION][snapshot] =
+				cpu_stat->cpu_sysinfo.cpu[CPU_USER];
+			raw_cpu_data[current_cpu][CPU_PRIVILEGED_UTILIZATION][snapshot] =
+				cpu_stat->cpu_sysinfo.cpu[CPU_KERNEL];
+			raw_cpu_data[current_cpu][CPU_DPC_UTILIZATION][snapshot] = 0;
+			raw_cpu_data[current_cpu][CPU_IRQ_UTILIZATION][snapshot] = 0;
+			raw_cpu_data[current_cpu][CPU_IRQ][snapshot] = cpu_stat->cpu_sysinfo.intr;
+			if (current_cpu++ > processor_count)
+				break;
+		}
+	}
+	return;
+}
+
+
+
+void Performance::Get_TCP_Counters(int snapshot)
+{
+	struct opthdr		*opthdr;
+	struct T_optmgmt_req	*optreq;
+	int			 flags = 0, retval;
+
+	// We have already taken care of this in the constructor.
+	// streamfd will be -1 iff !superuser.
+	if (streamfd == -1)
+	{
+		raw_tcp_data[TCP_SEGMENTS_RESENT][snapshot] = 0;
+		return;
+	}
+
+	// only root can open "/dev/ip" and push "tcp" module onto it.
+	if ((streamfd = open("/dev/ip", O_RDWR, 0600)) < 0)
 	{
 		cout << "unable to open /dev/ip" << endl;
 		streamfd = -1;
@@ -899,10 +1014,56 @@
 	close(streamfd);
 	return;
 }
-#endif
 
 
-#if defined (_WIN32) || defined (_WIN64)
+
+void Performance::Get_NI_Counters(int snapshot)
+{
+	kstat_t		*ksp;
+	kstat_named_t *knamed;
+	int			current_nic = 0 , i;
+
+	for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next)
+	{
+		if (ksp->ks_type != KSTAT_TYPE_NAMED)
+			continue;
+
+		// NET data is NAMED data.
+		if (strcmp(ksp->ks_name, nic_names[current_nic]) == 0)
+		{
+			// found the interface we are looking for.
+			if (0 > kstat_read(kc, ksp, NULL))
+			{
+				cout << "kstat_read() failed with error " << errno << endl;
+				exit(1);
+			}
+			// store data into raw_ni_data. First initialize for this snapshot to 
+			// prevent a buildup of values.
+			raw_ni_data[current_nic][NI_PACKETS][snapshot] = 0;
+			raw_ni_data[current_nic][NI_ERRORS][snapshot] = 0;
+
+			for (i=0; i < ksp->ks_ndata; i++)
+			{
+				knamed = KSTAT_NAMED_PTR(ksp)  + i;
+				if (strcmp(knamed->name, "opackets") == 0)
+					raw_ni_data[current_nic][NI_PACKETS][snapshot] += knamed->value.ui32;
+				if (strcmp(knamed->name, "ipackets") == 0)
+					raw_ni_data[current_nic][NI_PACKETS][snapshot] += knamed->value.ui32;
+				if (strcmp(knamed->name, "oerrors") == 0)
+					raw_ni_data[current_nic][NI_ERRORS][snapshot] += knamed->value.ui32;
+				if (strcmp(knamed->name, "ierrors") == 0)
+				{
+					raw_ni_data[current_nic][NI_IN_ERRORS][snapshot] = knamed->value.ui32;
+					raw_ni_data[current_nic][NI_ERRORS][snapshot] += knamed->value.ui32;
+				}
+			}
+			if (current_nic++ > network_interfaces)
+				break;
+		}
+	}
+	return;
+}
+#elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 //
 // Obtaining the desired performance counters from the returned performance data.
 //
@@ -944,101 +1105,194 @@
 }
 
 
+
 //
-// Locating the desired performance object from the returned performance data.
+// Extracting counters for NT CPU performance data.
 //
-BOOL Performance::Locate_Perf_Object( DWORD perf_object_index )
+void Performance::Extract_CPU_Counters( int snapshot )
 {
-	PERF_DATA_BLOCK		*pperf_data;	// short-cut pointer to returned performance data
-	DWORD				object_offset;	// offset to current object
-	int i;
-
-	pperf_data = (PERF_DATA_BLOCK*)perf_data;
-	object_offset = pperf_data->HeaderLength;
+	char	cpu_name[3], cpu_reg_name[3];
+	int		cpu, stat, i;
 
-	// Search through all returned objects until we find the desired one.
-	for ( i = 0; i < (int)pperf_data->NumObjectTypes; i++ )
+	// Loop through all processors and record performance information.
+	for ( cpu = 0; cpu < processor_count; cpu++ )
 	{
-		perf_object = (PERF_OBJECT_TYPE*)((LPBYTE)pperf_data + object_offset);
-		if ( perf_object->ObjectNameTitleIndex == perf_object_index )
-		{
-			break;	// This is the object we want.
-		}
-		else
-		{
-			object_offset += perf_object->TotalByteLength;	// Not it, check next object.
-		}
-	}
+		// Find the desired processor instance.
+		if ( !Locate_Perf_Instance( cpu ) )
+			return;
 
-	// If we didn't find the desired object, set the pointer to NULL and signify error.
-	// This is normal for performance data disabled by default (e.g. network interface).
-	if ( i >= (int)pperf_data->NumObjectTypes )
-	{
-		perf_object = NULL;
-		#if PERFORMANCE_DETAILS || _DEBUG
-			cout << "No current performance object to retrieve counters from." << endl 
-				<< "   Searching for " << perf_object_index << endl << flush;
-		#endif
-		return FALSE;
-	}
-	return TRUE;
-}
+		// Verify that the instance found is for the current processor, 
+		// otherwise perform an enhaustive search.
+		_itoa( cpu, cpu_name, 10 );
 
+                strcpy((char*)cpu_reg_name, (char*)((LPBYTE)perf_instance + perf_instance->NameOffset));
 
-//
-// Setting the offsets and size of the specific performance counters.
-// You must call Locate_Perf_Object before calling this function to locate a
-// valid performance object.
-//
-BOOL Performance::Set_Counter_Info( DWORD perf_data_type )
-{
-	PERF_COUNTER_DEFINITION	*counter_def;	// pointer to a specific counter definition
-	int					number_of_counters;	// number of counters to find offsets for
-	int					counter;			// number current counter from returned list
-	Perf_Counter_Info	*counter_info;		// pointer to array of counter information
+                if (perf_instance->NameLength = 6)
+                {
+                        strcat((char*)cpu_reg_name, 
+				(char*)((LPBYTE)perf_instance +
+                              	perf_instance->NameOffset)+2);
+                }
 
-	// Setting pointers to specific counters based on type of performance data returned.
-	// This is used to keep the code for finding the offsets (see below) more general.
-	switch ( perf_data_type )
+                if ( strncmp( cpu_name, cpu_reg_name, 2 ) )
+                {
+			#if _DEBUG
+				cout << "Performing exhaustive search for processor instance " << cpu << endl;
+			#endif
+
+			// Check all processor instances and 
+			// try to match one with the desired processor.
+			for ( i = 0; i < perf_object->NumInstances; i++ )
+			{
+			if ( !Locate_Perf_Instance( i ) )
+				return;
+			#if PERFORMANCE_DETAILS || _DETAILS
+                        cout << "Looking at processor name: " 
+				<< (char *)cpu_reg_name << endl;
+			#endif
+			// Match the name of the current instance with 
+			// 	the name of the desired cpu.
+			if ( !strncmp( cpu_name, (char*)((LPBYTE)perf_instance+ 
+					perf_instance->NameOffset), 2 ) )
+			break;	// Found the correct instance.
+			}
+			if ( i == perf_object->NumInstances )
+			{
+			cout << "*** Unable to locate performance instance of processor " << cpu_name << endl;
+			return;
+			}
+		}
+
+		// Saving CPU specific counters.
+		for ( stat = 0; stat < CPU_RESULTS; stat++ )
+		{
+			#if PERFORMANCE_DETAILS || _DETAILS
+				cout << "Extracting CPU stat " << stat 
+					<< " for CPU " << cpu_name << endl;
+			#endif
+			raw_cpu_data[cpu][stat][snapshot] = 
+				Extract_Counter( &(cpu_perf_counter_info[stat]) );
+		}
+	}
+}
+
+
+
+//
+// Extracting counters for NT network performance data.
+//
+void Performance::Extract_TCP_Counters( int snapshot )
+{
+	int		stat;
+
+	// Saving network TCP specific counters.
+	if ( !Locate_Perf_Instance() )
+		return;
+	for ( stat = 0; stat < TCP_RESULTS; stat++ )
 	{
-	case PERF_PROCESSOR:
-		// Find offsets for processor specific data.
-		number_of_counters = CPU_RESULTS;
-		counter_info = (Perf_Counter_Info*)(&(cpu_perf_counter_info[0]));
-		break;
-	case PERF_NETWORK_TCP:
-		number_of_counters = TCP_RESULTS;
-		counter_info = (Perf_Counter_Info*)(&(tcp_perf_counter_info[0]));
-		break;
-	case PERF_NETWORK_INTERFACE:
-		number_of_counters = NI_RESULTS;
-		counter_info = (Perf_Counter_Info*)(&(ni_perf_counter_info[0]));
-		break;
-	default:
-		cout << "*** Unknown performance data requested: " << perf_data_type << endl << flush;
-		return FALSE;
+		#if PERFORMANCE_DETAILS || _DETAILS
+			cout << "Extracting TCP stat " << stat << endl;
+		#endif
+		raw_tcp_data[stat][snapshot] = Extract_Counter( &(tcp_perf_counter_info[stat]) );
 	}
+}
 
-	// Set a pointer to the first counter defition.
-	// This uses the performance object previously found by Locate_Perf_Object.
-	counter_def = (PERF_COUNTER_DEFINITION*)((LPBYTE)perf_object + perf_object->HeaderLength);
 
-	// Check all returned counters and match to desired ones.
-	for ( counter = 0; counter < (int)perf_object->NumCounters; counter++ )
+
+//
+// Extracting counters for NT network interface performance data.
+//
+void Performance::Extract_NI_Counters( int snapshot )
+{
+	int		stat;
+
+	// Automatically setting the number of network interfaces that data is available for.
+	network_interfaces = 0;
+	do
 	{
-		// Walk through list of desired counters to find offsets for them.
-		for ( int i = 0; i < number_of_counters; i++ )
+		// Find the desired network NI interface instance.
+		if ( !Locate_Perf_Instance(network_interfaces) )
+			return;
+
+		// Saving network NI specific counters.
+		for ( stat = 0; stat < NI_RESULTS; stat++ )
 		{
-			if ( counter_def->CounterNameTitleIndex == counter_info[i].index )
-			{
-				// We found the counter that we're looking for.  Record needed information.
-				counter_info[i].offset = counter_def->CounterOffset;
-				counter_info[i].type = counter_def->CounterType;
-				break;
-			}
+			#if PERFORMANCE_DETAILS || _DETAILS
+				cout << "Extracting NI stat " << stat << " for NI " 
+					<< network_interfaces << endl;
+			#endif
+			raw_ni_data[network_interfaces][stat][snapshot] = 
+				Extract_Counter( &(ni_perf_counter_info[stat]) );
 		}
-		// Move to the next counter  definition.
-		counter_def = (PERF_COUNTER_DEFINITION*)((LPBYTE)counter_def + counter_def->ByteLength);
+		network_interfaces++;
+	} while ( network_interfaces < perf_object->NumInstances );
+}
+
+
+
+//
+// Extracting and returning a performance counter.  Perf_counter must already be set to a valid
+// performance counter block by calling Locate_Perf_Instance.
+//
+_int64 Performance::Extract_Counter( const Perf_Counter_Info *counter_info )
+{
+	// Verify that we know where to locate the counter.
+	if ( counter_info->offset == IOERROR )
+	{
+		cout << "*** Unable to extract performance counter, offset not set." << endl << flush;
+		return (_int64)0;
+	}
+
+	switch ( counter_info->type & PERF_SIZE_MASK )
+	{
+	case PERF_SIZE_LARGE:
+		return (_int64)((LARGE_INTEGER*)((LPBYTE)perf_counters + counter_info->offset))->QuadPart;
+	case PERF_SIZE_DWORD:
+		return (_int64)*((DWORD*)((LPBYTE)perf_counters + counter_info->offset));
+	default:					// other counter types exist, but are not currently used - signal error
+		cout << "*** Unknown size of performance data." << endl << flush;
+	}
+	return (_int64)0;
+}
+
+
+
+//
+// Locating the desired performance object from the returned performance data.
+//
+BOOL Performance::Locate_Perf_Object( DWORD perf_object_index )
+{
+	PERF_DATA_BLOCK		*pperf_data;	// short-cut pointer to returned performance data
+	DWORD				object_offset;	// offset to current object
+	int i;
+
+	pperf_data = (PERF_DATA_BLOCK*)perf_data;
+	object_offset = pperf_data->HeaderLength;
+
+	// Search through all returned objects until we find the desired one.
+	for ( i = 0; i < (int)pperf_data->NumObjectTypes; i++ )
+	{
+		perf_object = (PERF_OBJECT_TYPE*)((LPBYTE)pperf_data + object_offset);
+		if ( perf_object->ObjectNameTitleIndex == perf_object_index )
+		{
+			break;	// This is the object we want.
+		}
+		else
+		{
+			object_offset += perf_object->TotalByteLength;	// Not it, check next object.
+		}
+	}
+
+	// If we didn't find the desired object, set the pointer to NULL and signify error.
+	// This is normal for performance data disabled by default (e.g. network interface).
+	if ( i >= (int)pperf_data->NumObjectTypes )
+	{
+		perf_object = NULL;
+		#if PERFORMANCE_DETAILS || _DEBUG
+			cout << "No current performance object to retrieve counters from." << endl 
+				<< "   Searching for " << perf_object_index << endl << flush;
+		#endif
+		return FALSE;
 	}
 	return TRUE;
 }
@@ -1093,36 +1347,65 @@
 
 
 //
-// Extracting and returning a performance counter.  Perf_counter must already be set to a valid
-// performance counter block by calling Locate_Perf_Instance.
+// Setting the offsets and size of the specific performance counters.
+// You must call Locate_Perf_Object before calling this function to locate a
+// valid performance object.
 //
-_int64 Performance::Extract_Counter( const Perf_Counter_Info *counter_info )
+BOOL Performance::Set_Counter_Info( DWORD perf_data_type )
 {
-	// Verify that we know where to locate the counter.
-	if ( counter_info->offset == IOERROR )
+	PERF_COUNTER_DEFINITION	*counter_def;	// pointer to a specific counter definition
+	int					number_of_counters;	// number of counters to find offsets for
+	int					counter;			// number current counter from returned list
+	Perf_Counter_Info	*counter_info;		// pointer to array of counter information
+
+	// Setting pointers to specific counters based on type of performance data returned.
+	// This is used to keep the code for finding the offsets (see below) more general.
+	switch ( perf_data_type )
 	{
-		cout << "*** Unable to extract performance counter, offset not set." << endl << flush;
-		return (_int64)0;
+	case PERF_PROCESSOR:
+		// Find offsets for processor specific data.
+		number_of_counters = CPU_RESULTS;
+		counter_info = (Perf_Counter_Info*)(&(cpu_perf_counter_info[0]));
+		break;
+	case PERF_NETWORK_TCP:
+		number_of_counters = TCP_RESULTS;
+		counter_info = (Perf_Counter_Info*)(&(tcp_perf_counter_info[0]));
+		break;
+	case PERF_NETWORK_INTERFACE:
+		number_of_counters = NI_RESULTS;
+		counter_info = (Perf_Counter_Info*)(&(ni_perf_counter_info[0]));
+		break;
+	default:
+		cout << "*** Unknown performance data requested: " << perf_data_type << endl << flush;
+		return FALSE;
 	}
 
-	switch ( counter_info->type & PERF_SIZE_MASK )
+	// Set a pointer to the first counter defition.
+	// This uses the performance object previously found by Locate_Perf_Object.
+	counter_def = (PERF_COUNTER_DEFINITION*)((LPBYTE)perf_object + perf_object->HeaderLength);
+
+	// Check all returned counters and match to desired ones.
+	for ( counter = 0; counter < (int)perf_object->NumCounters; counter++ )
 	{
-	case PERF_SIZE_LARGE:
-		return (_int64)((LARGE_INTEGER*)((LPBYTE)perf_counters + counter_info->offset))->QuadPart;
-	case PERF_SIZE_DWORD:
-		return (_int64)*((DWORD*)((LPBYTE)perf_counters + counter_info->offset));
-	default:					// other counter types exist, but are not currently used - signal error
-		cout << "*** Unknown size of performance data." << endl << flush;
+		// Walk through list of desired counters to find offsets for them.
+		for ( int i = 0; i < number_of_counters; i++ )
+		{
+			if ( counter_def->CounterNameTitleIndex == counter_info[i].index )
+			{
+				// We found the counter that we're looking for.  Record needed information.
+				counter_info[i].offset = counter_def->CounterOffset;
+				counter_info[i].type = counter_def->CounterType;
+				break;
+			}
+		}
+		// Move to the next counter  definition.
+		counter_def = (PERF_COUNTER_DEFINITION*)((LPBYTE)counter_def + counter_def->ByteLength);
 	}
-	return (_int64)0;
+	return TRUE;
 }
-#endif
 
 
-//
-// Calculating the performance value for a given counter pair based on its saved information.
-//
-#if defined (_WIN32) || defined (_WIN64)
+
 double Performance::Calculate_Stat( _int64 start_value, _int64 end_value, DWORD counter_type )
 {
 	double	count_difference;	// Difference between two snapshots of a counter.
@@ -1290,309 +1573,14 @@
 		return (double)0.0;
 	}
 }
+#elif defined(IOMTR_OS_LINUX)
+ // nop
+#else    
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 
 
 
-#if defined (_WIN32) || defined (_WIN64)
-//
-// Extracting counters for NT CPU performance data.
-//
-void Performance::Extract_CPU_Counters( int snapshot )
-{
-	char	cpu_name[3], cpu_reg_name[3];
-	int		cpu, stat, i;
-
-	// Loop through all processors and record performance information.
-	for ( cpu = 0; cpu < processor_count; cpu++ )
-	{
-		// Find the desired processor instance.
-		if ( !Locate_Perf_Instance( cpu ) )
-			return;
-
-		// Verify that the instance found is for the current processor, 
-		// otherwise perform an enhaustive search.
-		_itoa( cpu, cpu_name, 10 );
-
-                strcpy((char*)cpu_reg_name, (char*)((LPBYTE)perf_instance + perf_instance->NameOffset));
-
-                if (perf_instance->NameLength = 6)
-                {
-                        strcat((char*)cpu_reg_name, 
-				(char*)((LPBYTE)perf_instance +
-                              	perf_instance->NameOffset)+2);
-                }
-
-                if ( strncmp( cpu_name, cpu_reg_name, 2 ) )
-                {
-			#if _DEBUG
-				cout << "Performing exhaustive search for processor instance " << cpu << endl;
-			#endif
-
-			// Check all processor instances and 
-			// try to match one with the desired processor.
-			for ( i = 0; i < perf_object->NumInstances; i++ )
-			{
-			if ( !Locate_Perf_Instance( i ) )
-				return;
-			#if PERFORMANCE_DETAILS || _DETAILS
-                        cout << "Looking at processor name: " 
-				<< (char *)cpu_reg_name << endl;
-			#endif
-			// Match the name of the current instance with 
-			// 	the name of the desired cpu.
-			if ( !strncmp( cpu_name, (char*)((LPBYTE)perf_instance+ 
-					perf_instance->NameOffset), 2 ) )
-			break;	// Found the correct instance.
-			}
-			if ( i == perf_object->NumInstances )
-			{
-			cout << "*** Unable to locate performance instance of processor " << cpu_name << endl;
-			return;
-			}
-		}
-
-		// Saving CPU specific counters.
-		for ( stat = 0; stat < CPU_RESULTS; stat++ )
-		{
-			#if PERFORMANCE_DETAILS || _DETAILS
-				cout << "Extracting CPU stat " << stat 
-					<< " for CPU " << cpu_name << endl;
-			#endif
-			raw_cpu_data[cpu][stat][snapshot] = 
-				Extract_Counter( &(cpu_perf_counter_info[stat]) );
-		}
-	}
-}
-#endif
-
-
-//
-// Calculating CPU statistics based on snapshots of performance counters.
-//
-void Performance::Calculate_CPU_Stats( CPU_Results *cpu_results )
-{
-	int		cpu, stat;		// Loop control variables.
-
-	// Loop though all CPUs and determine various utilization statistics.
-	cpu_results->count = processor_count;
-	for ( cpu = 0; cpu < processor_count; cpu++ )
-	{
-		// Loop through the counters and calculate performance.
-		for ( stat = 0; stat < CPU_RESULTS; stat++ )
-		{
-			#if PERFORMANCE_DETAILS
-				cout << "Calculating stat " << stat << " for CPU " << cpu << endl;
-			#endif
-
-#if defined (_WIN32) || defined (_WIN64)
-			// If we've never set the counter offsets, then we've never successfully retrieved
-			// the performance data.  Set all of the values to 0.
-			if ( cpu_perf_counter_info[stat].offset == IOERROR )
-			{
-				cout << "*** Offset to CPU performance counter not defined for stat " 
-					 << stat << "." << endl;
-				cpu_results->CPU_utilization[cpu][stat] = (double)0.0;
-			}
-			else
-			{
-				cpu_results->CPU_utilization[cpu][stat] = Calculate_Stat( 
-					raw_cpu_data[cpu][stat][FIRST_SNAPSHOT],
-					raw_cpu_data[cpu][stat][LAST_SNAPSHOT],
-					cpu_perf_counter_info[stat].type );
-			}
-#else // UNIX
-			double result;
-			if (stat == CPU_IRQ)
-			{
-				// we have to calculate Interrupts/sec.
-				// This is similar to calculating Network packets per second
-				// but we are more fortunate here.
-				// See the corresponding Notes at the end of this file for a description.
-				//
-				result = ((double) raw_cpu_data[cpu][stat][LAST_SNAPSHOT]
-						 - raw_cpu_data[cpu][stat][FIRST_SNAPSHOT]) * 
-						 clock_tick / timediff;
-				cpu_results->CPU_utilization[cpu][stat] = result;	
-			}
-			else
-			{
-				// All other CPU statistics.
-				result = ((double) raw_cpu_data[cpu][stat][LAST_SNAPSHOT]
-							- raw_cpu_data[cpu][stat][FIRST_SNAPSHOT]) / timediff;
-
-				if (result < 0.0) 
-				{
-					result = 0.0;
-					//
-					// CPU Utilization figures are outside valid range far too often.
-					// Ok, not in every cycle but frequent still.
-					// So, it is better to comment it out rather than have the message
-					// pop up on the screen at regular intervals.
-					//
-					// cout << "***** Error : CPU utilization outside valid range 0% - 100% *****" << endl;
-				}
-				if  (result > 1.0)
-				{
-					result = 1.0;
-				}
-
-				cpu_results->CPU_utilization[cpu][stat] = (result * 100);
-			}
-#endif
-			#if PERFORMANCE_DETAILS || _DETAILS
-				cout << "CPU " << cpu << " recorded stat " << stat << " = " 
-					<< cpu_results->CPU_utilization[cpu][stat] << endl;
-			#endif
-		}
-	}
-}
-
-
-#if defined (_WIN32) || defined (_WIN64)
-//
-// Extracting counters for NT network performance data.
-//
-void Performance::Extract_TCP_Counters( int snapshot )
-{
-	int		stat;
-
-	// Saving network TCP specific counters.
-	if ( !Locate_Perf_Instance() )
-		return;
-	for ( stat = 0; stat < TCP_RESULTS; stat++ )
-	{
-		#if PERFORMANCE_DETAILS || _DETAILS
-			cout << "Extracting TCP stat " << stat << endl;
-		#endif
-		raw_tcp_data[stat][snapshot] = Extract_Counter( &(tcp_perf_counter_info[stat]) );
-	}
-}
-#endif
-
-
-//
-// Calculate network performance statistics based on snapshots of performance counters.
-//
-void Performance::Calculate_TCP_Stats( Net_Results *net_results )
-{
-	int		stat;		// Loop control variable.
-
-	// Loop through the counters and calculate performance.
-	for ( stat = 0; stat < TCP_RESULTS; stat++ )
-	{
-		// If we've never set the counter offsets, then we've never successfully retrieved
-		// the performance data.  Set all of the values to 0.
-#if defined (_WIN32) || defined (_WIN64)
-		if ( tcp_perf_counter_info[stat].offset == IOERROR )
-		{
-			net_results->tcp_stats[stat] = (double)0.0;
-		}
-		else
-		{
-			net_results->tcp_stats[stat] = Calculate_Stat( 
-				raw_tcp_data[stat][FIRST_SNAPSHOT],
-				raw_tcp_data[stat][LAST_SNAPSHOT],
-				tcp_perf_counter_info[stat].type );
-		}
-#else
-		double result;
-		result = ((double) raw_tcp_data[stat][LAST_SNAPSHOT] - 
-			raw_tcp_data[stat][FIRST_SNAPSHOT]) / timediff;
-		result *= clock_tick;		// note that timediff is in CLK_TCKs and not seconds
-		net_results->tcp_stats[stat] = result;
-#endif
-
-		#if PERFORMANCE_DETAILS || _DETAILS
-			cout << "TCP recorded stat " << stat << " = " 
-				<< net_results->tcp_stats[stat] << endl;
-		#endif
-	}
-}
-
-
-#if defined (_WIN32) || defined (_WIN64)
-//
-// Extracting counters for NT network interface performance data.
-//
-void Performance::Extract_NI_Counters( int snapshot )
-{
-	int		stat;
-
-	// Automatically setting the number of network interfaces that data is available for.
-	network_interfaces = 0;
-	do
-	{
-		// Find the desired network NI interface instance.
-		if ( !Locate_Perf_Instance(network_interfaces) )
-			return;
-
-		// Saving network NI specific counters.
-		for ( stat = 0; stat < NI_RESULTS; stat++ )
-		{
-			#if PERFORMANCE_DETAILS || _DETAILS
-				cout << "Extracting NI stat " << stat << " for NI " 
-					<< network_interfaces << endl;
-			#endif
-			raw_ni_data[network_interfaces][stat][snapshot] = 
-				Extract_Counter( &(ni_perf_counter_info[stat]) );
-		}
-		network_interfaces++;
-	} while ( network_interfaces < perf_object->NumInstances );
-}
-#endif
-
-
-//
-// Calculate network performance statistics based on snapshots of performance counters.
-//
-void Performance::Calculate_NI_Stats( Net_Results *net_results )
-{
-	int		net, stat;		// Loop control variables.
-
-	// Loop through the counters and calculate performance.
-	net_results->ni_count = network_interfaces;
-	for ( net = 0; net < network_interfaces; net++ )
-	{
-		for ( stat = 0; stat < NI_RESULTS; stat++ )
-		{
-			// If we've never set the counter offsets, then we've never successfully retrieved
-			// the performance data.  Set all of the values to 0.
-#if defined (_WIN32) || defined (_WIN64)
-			if ( ni_perf_counter_info[stat].offset == IOERROR )
-			{
-				net_results->ni_stats[net][stat] = (double)0.0;
-			}
-			else
-			{
-				net_results->ni_stats[net][stat] = Calculate_Stat( 
-					raw_ni_data[net][stat][FIRST_SNAPSHOT],
-					raw_ni_data[net][stat][LAST_SNAPSHOT],
-					ni_perf_counter_info[stat].type );
-			}
-#else // UNIX
-			double result;
-			//
-			// Note:
-			//		The array time_counter[] stores time in nanoseconds.
-			// Earlier, we used to divide by the calculated value of timediff and then
-			// multiply the result by clock_ticks per second to get the NI_data per
-			// second which was theoretically correct (and mathematically same as what 
-			// we are doing now) but reported wrong values while working with such 
-			// large numbers.
-			//
-			result = ((double) raw_ni_data[net][stat][LAST_SNAPSHOT] - 
-				raw_ni_data[net][stat][FIRST_SNAPSHOT]) * 1000000000.0 / 
-				((double) time_counter[LAST_SNAPSHOT] - time_counter[FIRST_SNAPSHOT]);
 
-			net_results->ni_stats[net][stat] = result;
-#endif
-			#if PERFORMANCE_DETAILS || _DETAILS
-				cout << "   Network interface " << net << " recorded stat " << stat << " = " 
-					<< net_results->ni_stats[net][stat] << endl;
-			#endif
-		}
-	}
-}
 
-#endif /* !Linux */
+#endif   // !IOMTR_OS_LINUX
--- Pulsar.cpp	Sun Jul 27 20:28:44 2003
+++ Pulsar.cpp.mod	Sat Aug  2 17:18:50 2003
@@ -50,7 +50,10 @@
 /* ##                                                                     ## */
 /* ## ------------------------------------------------------------------- ## */
 /* ##                                                                     ## */
-/* ##  Changes ...: 2003-07-27 (daniel.scheibli@edelbyte.org)             ## */
+/* ##  Changes ...: 2003-08-02 (daniel.scheibli@edelbyte.org)             ## */
+/* ##               - Moved to the use of the IOMTR_[OSFAMILY|OS|CPU]_*   ## */
+/* ##                 global defines.                                     ## */
+/* ##               2003-07-27 (daniel.scheibli@edelbyte.org)             ## */
 /* ##               - Implemented a test call of the IsBigEndian()        ## */
 /* ##                 function to ensure, that we are able to detect      ## */
 /* ##                 the endian type of the CPU.                         ## */
@@ -70,16 +73,26 @@
 /* ##                                                                     ## */
 /* ######################################################################### */
 
+
 #include "IOCommon.h"
 #include "IOManager.h"
-#ifdef UNIX
-#include <sys/resource.h>
-#include <ctype.h>
-#endif
-#ifdef SOLARIS
-#include <synch.h>
+
+#if defined(IOMTR_OSFAMILY_UNIX)
+ #include <sys/resource.h>
+ #include <ctype.h>
+ #if defined(IOMTR_OS_SOLARIS)
+  #include <synch.h>
+ #elif defined(IOMTR_OS_LINUX)
+  // nop
+ #else
+  #warning ===> WARNING: You have to do some coding here to get the port done!
+ #endif
 #endif
 
+
+
+
+
 /////////////////////////////////////////////////////////////////////////////
 // Forward declarations
 /////////////////////////////////////////////////////////////////////////////
@@ -101,7 +114,7 @@
 {
 	Manager	manager;
 	char	iometer[MAX_NETWORK_NAME];
-#ifdef LINUX
+#if defined(IOMTR_OS_LINUX)
 	struct aioinit aioDefaults;
 
 	memset(&aioDefaults, 0, sizeof(aioDefaults));
@@ -148,12 +161,14 @@
          }
 	cout << endl;
 
-#ifdef UNIX
-#ifdef LINUX
+#if defined(IOMTR_OSFAMILY_UNIX)
+ #if defined(IOMTR_OS_LINUX)
 	signal(SIGALRM, SIG_IGN);
-#else
+ #elif defined(IOMTR_OS_SOLARIS)
 	sigignore(SIGALRM);
-#endif
+ #else
+  #warning ===> WARNING: You have to do some coding here to get the port done!
+ #endif 
 
 	// Initialize the lock on UNIX platforms.
 	if (pthread_mutex_init(&lock_mt, NULL))
@@ -221,7 +236,7 @@
 		cout << "       ************ WARNING **************" << endl;
 	}
 #endif // DYNAMO_DESTRUCTIVE
-#endif // UNIX
+#endif // IOMTR_OSFAMILY_UNIX
 
 	// Ensure, that the endian type of the CPU is detectable
 	if ( (IsBigEndian() != 0) && (IsBigEndian() != 1) )
@@ -266,11 +281,13 @@
 	cout << endl;
 	cout << "SYNTAX" << endl;
 	cout << endl;
-#ifndef SOLARIS
+#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 	cout << "dynamo /?" << endl;
-#else
+#elif defined(IOMTR_OS_SOLARIS)
 	// Solaris 2.7 must have the switch (? is used for its own purpose).
 	cout << "dynamo \\?" << endl;
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
 #endif
 	cout << "dynamo [iometer_computer_name [manager_name [manager_network_name]]]" << endl;
 	cout << "dynamo [/i iometer_computer_name] [/n manager_name] [/m manager_network_name]" << endl;
@@ -293,9 +310,9 @@
 	cout << "      NIC." << endl;
 	cout << endl;
 	cout << "   excluded_fs_type - type of filesystems to exclude from device search" << endl;
-         cout << "      This string should contian the filesystem types that are not reported" << endl;
-         cout << "      to Iometer. The default is \"" << DEFAULT_EXCLUDE_FILESYS << "\"." << endl;
-         cout << endl;
+        cout << "      This string should contian the filesystem types that are not reported" << endl;
+        cout << "      to Iometer. The default is \"" << DEFAULT_EXCLUDE_FILESYS << "\"." << endl;
+        cout << endl;
 
 	
 	exit( 0 );
@@ -395,15 +412,17 @@
 		default:
 			{
 				char tmpary[2] = {last_switch, 0};
-#if defined (_WIN32) || defined (_WIN64)
+#if defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
 				Syntax("Unrecognized switch: " + (CString)tmpary + ".");
-#else // !WIN32 || _WIN64
+#elif defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
 				char temp_array[128];
 				strcpy(temp_array, "Unrecognized switch: ");
 				strcat(temp_array, tmpary);
 				strcat(temp_array, ".");
 				Syntax(temp_array);
-#endif // WIN32 || _WIN64
+#else
+ #warning ===> WARNING: You have to do some coding here to get the port done!
+#endif
 			}
 			return;
 		}
