geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [10/23] incubator-geode git commit: GEODE-1781: repackage internal statistics classes and refactor statistics tests
Date Mon, 15 Aug 2016 18:43:38 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXProcessStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXProcessStats.java
new file mode 100644
index 0000000..7af725f
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXProcessStats.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.*;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.statistics.HostStatHelper;
+import com.gemstone.gemfire.internal.statistics.LocalStatisticsImpl;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+
+/**
+ * <P>This class provides the interface for statistics about a
+ * Mac OS X operating system process that is using a GemFire system.
+ */
+public class OSXProcessStats
+{
+//  private final static int imageSizeINT = 0;
+//  private final static int rssSizeINT = 1;
+
+  private final static StatisticsType myType;
+
+  private static void checkOffset(String name, int offset) {
+    int id = myType.nameToId(name);
+    Assert.assertTrue(offset == id, "Expected the offset for " + name + " to be " + offset + " but it was " + id);
+  }
+  
+  static {
+    StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    myType = f.createType("OSXProcessStats",
+                          "Statistics on a OS X process.",
+                          new StatisticDescriptor[] {
+                              f.createIntGauge("dummyStat",
+                                            "Placeholder",
+                                             "megabytes")
+//                              f.createIntGauge("imageSize",
+//                                             "The size of the process's image in megabytes.",
+//                                             "megabytes"),
+//                            f.createIntGauge("rssSize",
+//                                             "The size of the process's resident set size in megabytes.",
+//                                             "megabytes"),
+                          });
+//    checkOffset("imageSize", imageSizeINT);
+//    checkOffset("rssSize", rssSizeINT);
+  }
+
+  private OSXProcessStats() {
+    // no instances allowed
+  }
+  public static StatisticsType getType() {
+    return myType;
+  }
+
+  /**
+   * Returns a <code>ProcessStats</code> that wraps OS X process
+   * <code>Statistics</code>. 
+   *
+   * @since GemFire 3.5
+   */
+  public static ProcessStats createProcessStats(final Statistics stats) { // TODO: was package-protected
+    if (stats instanceof LocalStatisticsImpl) {
+      HostStatHelper.refresh((LocalStatisticsImpl) stats);
+    } // otherwise its a Dummy implementation so do nothing
+    return new ProcessStats(stats) {
+      @Override
+        public long getProcessSize() {
+//          return stats.getInt(rssSizeINT);
+            return 0L;
+        }
+      };
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXSystemStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXSystemStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXSystemStats.java
new file mode 100644
index 0000000..3f782bc
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OSXSystemStats.java
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.*;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+
+/**
+ * <P>This class provides the interface for statistics about the 
+ * OS X machine a GemFire system is running on.
+ */
+public class OSXSystemStats
+{
+
+  // shared fields
+//  private final static int allocatedSwapINT = 0;
+//  private final static int bufferMemoryINT = 1;
+//  private final static int contextSwitchesINT = 2;
+//  private final static int cpuActiveINT = 3;
+//  private final static int cpuIdleINT = 4;
+//  private final static int cpuNiceINT = 5;
+//  private final static int cpuSystemINT = 6;
+//  private final static int cpuUserINT = 7;
+//  private final static int cpusINT = 8;
+//  private final static int freeMemoryINT = 9;
+//  private final static int pagesPagedInINT = 10;
+//  private final static int pagesPagedOutINT = 11;
+//  private final static int pagesSwappedInINT = 12;
+//  private final static int pagesSwappedOutINT = 13;
+//  private final static int physicalMemoryINT = 14;
+//  private final static int processCreatesINT = 15;
+//  private final static int processesINT = 16;
+//  private final static int sharedMemoryINT = 17;
+//  private final static int unallocatedSwapINT = 18;
+//
+//  private final static int loopbackPacketsLONG = 0;
+//  private final static int loopbackBytesLONG = 1;
+//  private final static int recvPacketsLONG = 2;
+//  private final static int recvBytesLONG = 3;
+//  private final static int recvErrorsLONG = 4;
+//  private final static int recvDropsLONG = 5;
+//  private final static int xmitPacketsLONG = 6;
+//  private final static int xmitBytesLONG = 7;
+//  private final static int xmitErrorsLONG = 8;
+//  private final static int xmitDropsLONG = 9;
+//  private final static int xmitCollisionsLONG = 10;
+//
+//  private final static int loadAverage1DOUBLE = 0;
+//  private final static int loadAverage15DOUBLE = 1;
+//  private final static int loadAverage5DOUBLE = 2;
+
+  private final static StatisticsType myType;
+
+  private static void checkOffset(String name, int offset) {
+    int id = myType.nameToId(name);
+    Assert.assertTrue(offset == id, "Expected the offset for " + name + " to be " + offset + " but it was " + id);
+  }
+
+  static {
+    StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    myType = f.createType("OSXSystemStats",
+                          "Statistics on an OS X machine.",
+                          new StatisticDescriptor[] {
+                            f.createIntGauge("dummyStat",
+                                                "Place holder statistic until Stats are implimented for the Mac OS X Platform.",
+                                                "megabytes"),
+//                            f.createIntGauge("allocatedSwap",
+//                                                "The number of megabytes of swap space have actually been written to. Swap space must be reserved before it can be allocated.",
+//                                                "megabytes"),
+//                            f.createIntGauge("bufferMemory",
+//                                                "The number of megabytes of memory allocated to buffers.",
+//                                                "megabytes"),
+//                            f.createIntCounter("contextSwitches",
+//                                                "The total number of context switches from one thread to another on the computer.  Thread switches can occur either inside of a single process or across processes.  A thread switch may be caused either by one thread asking another for information, or by a thread being preempted by another, higher priority thread becoming ready to run.",
+//                                                "operations", false),
+//                            f.createIntGauge("cpuActive",
+//                                                "The percentage of the total available time that has been used in a non-idle state.",
+//                                                "%"),
+//                            f.createIntGauge("cpuIdle",
+//                                                "The percentage of the total available time that has been spent sleeping.",
+//                                                "%", true),
+//                            f.createIntGauge("cpuNice",
+//                                                "The percentage of the total available time that has been used to execute user code in processes with low priority.",
+//                                                "%"),
+//                            f.createIntGauge("cpuSystem",
+//                                                "The percentage of the total available time that has been used to execute system (i.e. kernel) code.",
+//                                                "%"),
+//                            f.createIntGauge("cpuUser",
+//                                                "The percentage of the total available time that has been used to execute user code.",
+//                                                "%"),
+//                            f.createIntGauge("cpus",
+//                                                "The number of online cpus on the local machine.",
+//                                                "items"),
+//                            f.createIntGauge("freeMemory",
+//                                                "The number of megabytes of unused memory on the machine.",
+//                                                "megabytes", true),
+//                            f.createIntCounter("pagesPagedIn",
+//                                                "The total number of pages that have been brought into memory from disk by the operating system's memory manager.",
+//                                                "pages", false),
+//                            f.createIntCounter("pagesPagedOut",
+//                                                "The total number of pages that have been flushed from memory to disk by the operating system's memory manager.",
+//                                                "pages", false),
+//                            f.createIntCounter("pagesSwappedIn",
+//                                                "The total number of swap pages that have been read in from disk by the operating system's memory manager.",
+//                                                "pages", false),
+//                            f.createIntCounter("pagesSwappedOut",
+//                                                "The total number of swap pages that have been written out to disk by the operating system's memory manager.",
+//                                                "pages", false),
+//                            f.createIntGauge("physicalMemory",
+//                                                "The actual amount of total physical memory on the machine.",
+//                                                "megabytes", true),
+//                            f.createIntCounter("processCreates",
+//                                                "The total number of times a process has been created.",
+//                                                "operations", false),
+//                            f.createIntGauge("processes",
+//                                                "The number of processes in the computer at the time of data collection.  Notice that this is an instantaneous count, not an average over the time interval.  Each process represents the running of a program.",
+//                                                "processes"),
+//                            f.createIntGauge("sharedMemory",
+//                                                "The number of megabytes of shared memory on the machine.",
+//                                                "megabytes", true),
+//                            f.createIntGauge("unallocatedSwap",
+//                                                "The number of megabytes of swap space that have not been allocated.",
+//                                                "megabytes", true),
+//
+//                            f.createLongCounter("loopbackPackets",
+//                                             "The number of network packets sent (or received) on the loopback interface",
+//                                             "packets", false),
+//                            f.createLongCounter("loopbackBytes",
+//                                             "The number of network bytes sent (or received) on the loopback interface",
+//                                             "bytes", false),
+//			    f.createLongCounter("recvPackets",
+//					     "The total number of network packets received (excluding loopback)",
+//					     "packets", false),
+//                            f.createLongCounter("recvBytes",
+//                                              "The total number of network bytes received (excluding loopback)",
+//                                              "bytes", false),
+//			    f.createLongCounter("recvErrors",
+//					     "The total number of network receive errors",
+//					     "errors", false),
+//                            f.createLongCounter("recvDrops",
+//                                             "The total number network receives dropped",
+//                                             "packets", false),
+//			    f.createLongCounter("xmitPackets",
+//					     "The total number of network packets transmitted (excluding loopback)",
+//					     "packets", false),
+//                            f.createLongCounter("xmitBytes",
+//                                             "The total number of network bytes transmitted (excluding loopback)",
+//                                             "bytes", false),
+//			    f.createLongCounter("xmitErrors",
+//					     "The total number of network transmit errors",
+//					     "errors", false),
+//			    f.createLongCounter("xmitDrops",
+//					     "The total number of network transmits dropped",
+//					     "packets", false),
+//			    f.createLongCounter("xmitCollisions",
+//					    "The total number of network transmit collisions",
+//					     "collisions", false),
+//
+//
+//                            f.createDoubleGauge("loadAverage1",
+//                                                "The average number of threads in the run queue or waiting for disk I/O over the last minute.",
+//                                                "threads"),
+//                            f.createDoubleGauge("loadAverage15",
+//                                                "The average number of threads in the run queue or waiting for disk I/O over the last fifteen minutes.",
+//                                                "threads"),
+//                            f.createDoubleGauge("loadAverage5",
+//                                                "The average number of threads in the run queue or waiting for disk I/O over the last five minutes.",
+//                                                "threads"),
+                          });
+
+//    checkOffset("allocatedSwap", allocatedSwapINT);
+//    checkOffset("bufferMemory", bufferMemoryINT);
+//    checkOffset("contextSwitches", contextSwitchesINT);
+//    checkOffset("cpuActive", cpuActiveINT);
+//    checkOffset("cpuIdle", cpuIdleINT);
+//    checkOffset("cpuNice", cpuNiceINT);
+//    checkOffset("cpuSystem", cpuSystemINT);
+//    checkOffset("cpuUser", cpuUserINT);
+//    checkOffset("cpus", cpusINT);
+//    checkOffset("freeMemory", freeMemoryINT);
+//    checkOffset("pagesPagedIn", pagesPagedInINT);
+//    checkOffset("pagesPagedOut", pagesPagedOutINT);
+//    checkOffset("pagesSwappedIn", pagesSwappedInINT);
+//    checkOffset("pagesSwappedOut", pagesSwappedOutINT);
+//    checkOffset("physicalMemory", physicalMemoryINT);
+//    checkOffset("processCreates", processCreatesINT);
+//    checkOffset("processes", processesINT);
+//    checkOffset("sharedMemory", sharedMemoryINT);
+//    checkOffset("unallocatedSwap", unallocatedSwapINT);
+//
+//    checkOffset("loopbackPackets", loopbackPacketsLONG);
+//    checkOffset("loopbackBytes", loopbackBytesLONG);
+//    checkOffset("recvPackets", recvPacketsLONG);
+//    checkOffset("recvBytes", recvBytesLONG);
+//    checkOffset("recvErrors", recvErrorsLONG);
+//    checkOffset("recvDrops", recvDropsLONG);
+//    checkOffset("xmitPackets", xmitPacketsLONG);
+//    checkOffset("xmitBytes", xmitBytesLONG);
+//    checkOffset("xmitErrors", xmitErrorsLONG);
+//    checkOffset("xmitDrops", xmitDropsLONG);
+//    checkOffset("xmitCollisions", xmitCollisionsLONG);
+//
+//    checkOffset("loadAverage1", loadAverage1DOUBLE);
+//    checkOffset("loadAverage15", loadAverage15DOUBLE);
+//    checkOffset("loadAverage5", loadAverage5DOUBLE);
+  }
+    
+  private OSXSystemStats() {
+    // no instances allowed
+  }
+  public static StatisticsType getType() {
+    return myType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OsStatisticsFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OsStatisticsFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OsStatisticsFactory.java
new file mode 100644
index 0000000..0ec1f5a
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/OsStatisticsFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.*;
+
+/**
+ * Instances of this interface provide methods that create operating system
+ * instances of {@link com.gemstone.gemfire.Statistics}. Its for internal use 
+ * only.
+ *
+ * {@link com.gemstone.gemfire.distributed.DistributedSystem} is an OS 
+ * statistics factory.
+ * <P>
+ * @see <A href="package-summary.html#statistics">Package introduction</A>
+ *
+ *
+ * @since GemFire 3.0
+ */
+public interface OsStatisticsFactory {
+  /**
+   * Creates and returns a OS {@link Statistics} instance of the given {@link StatisticsType type}, <code>textId</code>, <code>numericId</code>, and <code>osStatFlags</code>..
+   * <p>
+   * The created instance may not be {@link Statistics#isAtomic atomic}.
+   */
+  public Statistics createOsStatistics(StatisticsType type, String textId, long numericId, int osStatFlags);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/ProcessStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/ProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/ProcessStats.java
new file mode 100644
index 0000000..0c4465e
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/ProcessStats.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.Statistics;
+
+/**
+ * Abstracts the process statistics that are common on all platforms.
+ * This is necessary for monitoring the health of GemFire components.
+ *
+ *
+ * @since GemFire 3.5
+ * */
+public abstract class ProcessStats {
+
+  /** The underlying statistics */
+  private final Statistics stats;
+
+  /**
+   * Creates a new <code>ProcessStats</code> that wraps the given
+   * <code>Statistics</code>. 
+   */
+  ProcessStats(Statistics stats) {
+    this.stats = stats;
+  }
+
+  /**
+   * Closes these process stats
+   *
+   * @see Statistics#close
+   */
+  public final void close() {
+    this.stats.close();
+  }
+
+  public final Statistics getStatistics() {
+    return this.stats;
+  }
+  
+  /**
+   * Returns the size of this process (resident set on UNIX or working
+   * set on Windows) in megabytes
+   */
+  public abstract long getProcessSize();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisProcessStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisProcessStats.java
new file mode 100644
index 0000000..c9b6746
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisProcessStats.java
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.*;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.statistics.HostStatHelper;
+import com.gemstone.gemfire.internal.statistics.LocalStatisticsImpl;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+import com.gemstone.gemfire.internal.statistics.platform.ProcessStats;
+
+/**
+ * <P>This class provides the interface for statistics about a
+ * Solaris operating system process that is using a GemFire system.
+ */
+public class SolarisProcessStats
+{
+  private final static int allOtherSleepTimeINT = 0;
+  private final static int characterIoINT = 1;
+  private final static int dataFaultSleepTimeINT = 2;
+  private final static int heapSizeINT = 3;
+  private final static int imageSizeINT = 4;
+  private final static int involContextSwitchesINT = 5;
+  private final static int kernelFaultSleepTimeINT = 6;
+  private final static int lockWaitSleepTimeINT = 7;
+  private final static int lwpCurCountINT = 8;
+  private final static int lwpTotalCountINT = 9;
+  private final static int majorFaultsINT = 10;
+  private final static int messagesRecvINT = 11;
+  private final static int messagesSentINT = 12;
+  private final static int minorFaultsINT = 13;
+  private final static int rssSizeINT = 14;
+  private final static int signalsReceivedINT = 15;
+  private final static int systemCallsINT = 16;
+  private final static int stackSizeINT = 17;
+  private final static int stoppedTimeINT = 18;
+  private final static int systemTimeINT = 19;
+  private final static int textFaultSleepTimeINT = 20;
+  private final static int trapTimeINT = 21;
+  private final static int userTimeINT = 22;
+  private final static int volContextSwitchesINT = 23;
+  private final static int waitCpuTimeINT = 24;
+
+  private final static int activeTimeLONG = 0;
+
+  private final static int cpuUsedDOUBLE = 0;
+  private final static int memoryUsedDOUBLE = 1;
+
+  private final static StatisticsType myType;
+
+  private static void checkOffset(String name, int offset) {
+    int id = myType.nameToId(name);
+    Assert.assertTrue(offset == id, "Expected the offset for " + name + " to be " + offset + " but it was " + id);
+  }
+
+  static {
+    StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    myType = f.createType("SolarisProcessStats",
+                          "Statistics on a Solaris process.",
+                          new StatisticDescriptor[] {
+                            f.createIntCounter("allOtherSleepTime",
+                                                "The number of milliseconds the process has been sleeping for some reason not tracked by any other stat. Note that all lwp's contribute to this stat's value so check lwpCurCount to understand large values.",
+                                                "milliseconds", false),
+                            f.createIntCounter("characterIo",
+                                                "The number of characters read and written.",
+                                                "bytes"),
+                            f.createIntCounter("dataFaultSleepTime",
+                                                "The number of milliseconds the process has been faulting in data pages.",
+                                                "milliseconds", false),
+                            f.createIntGauge("heapSize",
+                                                "The size of the process's heap in megabytes.",
+                                                "megabytes"),
+                            f.createIntGauge("imageSize",
+                                                "The size of the process's image in megabytes.",
+                                                "megabytes"),
+                            f.createIntCounter("involContextSwitches",
+                                                "The number of times the process was forced to do a context switch.",
+                                                "operations", false),
+                            f.createIntCounter("kernelFaultSleepTime",
+                                                "The number of milliseconds the process has been faulting in kernel pages.",
+                                                "milliseconds", false),
+                            f.createIntCounter("lockWaitSleepTime",
+                                                "The number of milliseconds the process has been waiting for a user lock. Note that all lwp's contribute to this stat's value so check lwpCurCount to understand large values.",
+                                                "milliseconds", false),
+                            f.createIntGauge("lwpCurCount",
+                                                "The current number of light weight processes that exist in the process.",
+                                                "threads"),
+                            f.createIntCounter("lwpTotalCount",
+                                                "The total number of light weight processes that have ever contributed to the process's statistics.",
+                                                "threads", false),
+                            f.createIntCounter("majorFaults",
+                                                "The number of times the process has had a page fault that needed disk access.",
+                                                "operations", false),
+                            f.createIntCounter("messagesRecv",
+                                                "The number of messages received by the process.",
+                                                "messages"),
+                            f.createIntCounter("messagesSent",
+                                                "The number of messages sent by the process.",
+                                                "messages"),
+                            f.createIntCounter("minorFaults",
+                                                "The number of times the process has had a page fault that did not need disk access.",
+                                                "operations", false),
+                            f.createIntGauge("rssSize",
+                                                "The size of the process's resident set size in megabytes.",
+                                                "megabytes"),
+                            f.createIntCounter("signalsReceived",
+                                                "The total number of operating system signals this process has received.",
+                                                "signals", false),
+                            f.createIntCounter("systemCalls",
+                                                "The total number system calls done by this process.",
+                                                "operations"),
+                            f.createIntGauge("stackSize",
+                                                "The size of the process's stack in megabytes.",
+                                                "megabytes"),
+                            f.createIntCounter("stoppedTime",
+                                                "The number of milliseconds the process has been stopped.",
+                                                "milliseconds", false),
+                            f.createIntCounter("systemTime",
+                                                "The number of milliseconds the process has been using the CPU to execute system calls.",
+                                                "milliseconds", false),
+                            f.createIntCounter("textFaultSleepTime",
+                                                "The number of milliseconds the process has been faulting in text pages.",
+                                                "milliseconds", false),
+                            f.createIntCounter("trapTime",
+                                                "The number of milliseconds the process has been in system traps.",
+                                                "milliseconds", false),
+                            f.createIntCounter("userTime",
+                                                "The number of milliseconds the process has been using the CPU to execute user code.",
+                                                "milliseconds", false),
+                            f.createIntCounter("volContextSwitches",
+                                                "The number of voluntary context switches done by the process.",
+                                                "operations", false),
+                            f.createIntCounter("waitCpuTime",
+                                                "The number of milliseconds the process has been waiting for a CPU due to latency.",
+                                                "milliseconds", false),
+
+
+                            f.createLongCounter("activeTime",
+                                                "The number of milliseconds the process has been using the CPU to execute user or system code.",
+                                                "milliseconds", false),
+
+
+                            f.createDoubleGauge("cpuUsed",
+                                                "The percentage of recent cpu time used by the process.",
+                                                "%"),
+                            f.createDoubleGauge("memoryUsed",
+                                                "The percentage of real memory used by the process.",
+                                                "%")
+                          });
+
+    checkOffset("allOtherSleepTime", allOtherSleepTimeINT);
+    checkOffset("characterIo", characterIoINT);
+    checkOffset("dataFaultSleepTime", dataFaultSleepTimeINT);
+    checkOffset("heapSize", heapSizeINT);
+    checkOffset("imageSize", imageSizeINT);
+    checkOffset("involContextSwitches", involContextSwitchesINT);
+    checkOffset("kernelFaultSleepTime", kernelFaultSleepTimeINT);
+    checkOffset("lockWaitSleepTime", lockWaitSleepTimeINT);
+    checkOffset("lwpCurCount", lwpCurCountINT);
+    checkOffset("lwpTotalCount", lwpTotalCountINT);
+    checkOffset("majorFaults", majorFaultsINT);
+    checkOffset("messagesRecv", messagesRecvINT);
+    checkOffset("messagesSent", messagesSentINT);
+    checkOffset("minorFaults", minorFaultsINT);
+    checkOffset("rssSize", rssSizeINT);
+    checkOffset("signalsReceived", signalsReceivedINT);
+    checkOffset("systemCalls", systemCallsINT);
+    checkOffset("stackSize", stackSizeINT);
+    checkOffset("stoppedTime", stoppedTimeINT);
+    checkOffset("systemTime", systemTimeINT);
+    checkOffset("textFaultSleepTime", textFaultSleepTimeINT);
+    checkOffset("trapTime", trapTimeINT);
+    checkOffset("userTime", userTimeINT);
+    checkOffset("volContextSwitches", volContextSwitchesINT);
+    checkOffset("waitCpuTime", waitCpuTimeINT);
+
+    checkOffset("activeTime", activeTimeLONG);
+
+    checkOffset("cpuUsed", cpuUsedDOUBLE);
+    checkOffset("memoryUsed", memoryUsedDOUBLE);
+  }
+
+  private SolarisProcessStats() {
+    // no instances allowed
+  }
+  public static StatisticsType getType() {
+    return myType;
+  }
+
+  /**
+   * Returns a <code>ProcessStats</code> that wraps Solaris process
+   * <code>Statistics</code>. 
+   *
+   * @since GemFire 3.5
+   */
+  public static ProcessStats createProcessStats(final Statistics stats) { // TODO: was package-protected
+    if (stats instanceof LocalStatisticsImpl) {
+      HostStatHelper.refresh((LocalStatisticsImpl) stats);
+    } // otherwise its a Dummy implementation so do nothing
+    return new ProcessStats(stats) {
+      @Override
+        public long getProcessSize() {
+          return stats.getInt(rssSizeINT);
+        }
+      };
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisSystemStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisSystemStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisSystemStats.java
new file mode 100644
index 0000000..3fe4495
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/SolarisSystemStats.java
@@ -0,0 +1,430 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.*;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+
+/**
+ * <P>This class provides the interface for statistics about the 
+ * Solaris machine a GemFire system is running on.
+ */
+public class SolarisSystemStats
+{
+  private final static int allocatedSwapINT = 0;
+  private final static int cpuActiveINT = 1;
+  private final static int cpuIdleINT = 2;
+  private final static int cpuIoWaitINT = 3;
+  private final static int cpuSwapWaitINT = 4;
+  private final static int cpuSystemINT = 5;
+  private final static int cpuUserINT = 6;
+  private final static int cpuWaitingINT = 7;
+  private final static int cpusINT = 8;
+  private final static int freeMemoryINT = 9;
+  private final static int physicalMemoryINT = 10;
+  private final static int processesINT = 11;
+  private final static int reservedSwapINT = 12;
+  private final static int schedulerRunCountINT = 13;
+  private final static int schedulerSwapCountINT = 14;
+  private final static int schedulerWaitCountINT = 15;
+  private final static int unreservedSwapINT = 16;
+  private final static int unallocatedSwapINT = 17;
+
+  private final static int anonymousPagesFreedLONG = 0;
+  private final static int anonymousPagesPagedInLONG = 1;
+  private final static int anonymousPagesPagedOutLONG = 2;
+  private final static int contextSwitchesLONG = 3;
+  private final static int execPagesFreedLONG = 4;
+  private final static int execPagesPagedInLONG = 5;
+  private final static int execPagesPagedOutLONG = 6;
+  private final static int failedMutexEntersLONG = 7;
+  private final static int failedReaderLocksLONG = 8;
+  private final static int failedWriterLocksLONG = 9;
+  private final static int fileSystemPagesFreedLONG = 10;
+  private final static int fileSystemPagesPagedInLONG = 11;
+  private final static int fileSystemPagesPagedOutLONG = 12;
+  private final static int hatMinorFaultsLONG = 13;
+  private final static int interruptsLONG = 14;
+  private final static int involContextSwitchesLONG = 15;
+  private final static int majorPageFaultsLONG = 16;
+  private final static int messageCountLONG = 17;
+  private final static int pageDaemonCyclesLONG = 18;
+  private final static int pageInsLONG = 19;
+  private final static int pageOutsLONG = 20;
+  private final static int pagerRunsLONG = 21;
+  private final static int pagesPagedInLONG = 22;
+  private final static int pagesPagedOutLONG = 23;
+  private final static int pagesScannedLONG = 24;
+  private final static int procsInIoWaitLONG = 25;
+  private final static int protectionFaultsLONG = 26;
+  private final static int semphoreOpsLONG = 27;
+  private final static int softwareLockFaultsLONG = 28;
+  private final static int systemCallsLONG = 29;
+  private final static int systemMinorFaultsLONG = 30;
+  private final static int threadCreatesLONG = 31;
+  private final static int trapsLONG = 32;
+  private final static int userMinorFaultsLONG = 33;
+  private final static int loopbackInputPacketsLONG = 34;
+  private final static int loopbackOutputPacketsLONG = 35;
+  private final static int inputPacketsLONG = 36;
+  private final static int inputErrorsLONG = 37;
+  private final static int outputPacketsLONG = 38;
+  private final static int outputErrorsLONG = 39;
+  private final static int collisionsLONG = 40;
+  private final static int inputBytesLONG = 41;
+  private final static int outputBytesLONG = 42;
+  private final static int multicastInputPacketsLONG = 43;
+  private final static int multicastOutputPacketsLONG = 44;
+  private final static int broadcastInputPacketsLONG = 45;
+  private final static int broadcastOutputPacketsLONG = 46;
+  private final static int inputPacketsDiscardedLONG = 47;
+  private final static int outputPacketsDiscardedLONG = 48;
+
+  private final static int loadAverage1DOUBLE = 0;
+  private final static int loadAverage15DOUBLE = 1;
+  private final static int loadAverage5DOUBLE = 2;
+
+  private final static StatisticsType myType;
+
+  private static void checkOffset(String name, int offset) {
+    int id = myType.nameToId(name);
+    Assert.assertTrue(offset == id, "Expected the offset for " + name + " to be " + offset + " but it was " + id);
+  }
+
+  /*
+	     "\n  Segments ConnectionsEstablished ConnectionsActive"
+	     "\n  ConnectionsPassive ConnectionFailures ConnectionsReset"
+	     "\n  SegmentsReceived SegmentsSent SegmentsRetransmitted"
+	     "\n  SentTcpBytes RetransmittedTcpBytes AcksSent DelayedAcksSent"
+	     "\n  ControlSegmentsSent"
+	     "\n  AcksReceived AckedBytes DuplicateAcks AcksForUnsentData "
+	     "\n  ReceivedInorderBytes ReceivedOutOfOrderBytes ReceivedDuplicateBytes ReceivedPartialDuplicateBytes "
+	     "\n  RetransmitTimeouts RetransmitTimeoutDrops"
+	     "\n  KeepAliveTimeouts KeepAliveProbes KeepAliveDrops"
+	     "\n  ListenQueueFull HalfOpenQueueFull HalfOpenDrops"
+	     "\n) ");
+      sprintf(buff, "%d", typeCount);
+      TcpTypeCount = typeCount;
+      typeCount++;
+      strcat(res, buff);
+  }
+
+  */
+
+  static {
+    StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    myType = f.createType("SolarisSystemStats",
+                          "Statistics on a Solaris machine.",
+                          new StatisticDescriptor[] {
+                            f.createIntGauge("allocatedSwap",
+                                                "The number of megabytes of swap space have actually been written to. Swap space must be reserved before it can be allocated.",
+                                                "megabytes"),
+                            f.createIntGauge("cpuActive",
+                                                "The percentage of the total available time that has been used to execute user or system code.",
+                                                "%"),
+                            f.createIntGauge("cpuIdle",
+                                                "The percentage of the total available time that has been spent sleeping.",
+                                                "%", true),
+                            f.createIntGauge("cpuIoWait",
+                                                "The percentage of the total available time that has been spent waiting for disk io to complete.",
+                                                "%"),
+                            f.createIntGauge("cpuSwapWait",
+                                                "The percentage of the total available time that has been spent waiting for paging and swapping to complete.",
+                                                "%"),
+                            f.createIntGauge("cpuSystem",
+                                                "The percentage of the total available time that has been used to execute system (i.e. kernel) code.",
+                                                "%"),
+                            f.createIntGauge("cpuUser",
+                                                "The percentage of the total available time that has been used to execute user code.",
+                                                "%"),
+                            f.createIntGauge("cpuWaiting",
+                                                "The percentage of the total available time that has been spent waiting for io, paging, or swapping.",
+                                                "%"),
+                            f.createIntGauge("cpus",
+                                                "The number of online cpus on the local machine.",
+                                                "items"),
+                            f.createIntGauge("freeMemory",
+                                                "The number of megabytes of unused memory on the machine.",
+                                                "megabytes", true),
+                            f.createIntGauge("physicalMemory",
+                                                "The actual amount of total physical memory on the machine.",
+                                                "megabytes", true),
+                            f.createIntGauge("processes",
+                                                "The number of processes in the computer at the time of data collection.  Notice that this is an instantaneous count, not an average over the time interval.  Each process represents the running of a program.",
+                                                "processes"),
+                            f.createIntGauge("reservedSwap",
+                                                "The number of megabytes of swap space reserved for allocation by a particular process.",
+                                                "megabytes"),
+                            f.createIntCounter("schedulerRunCount",
+                                                "The total number of times the system scheduler has put a thread in its run queue.",
+                                                "operations", false),
+                            f.createIntCounter("schedulerSwapCount",
+                                                "The total number of times the system scheduler has swapped out an idle process.",
+                                                "operations", false),
+                            f.createIntCounter("schedulerWaitCount",
+                                                "The total number of times the system scheduler has removed a thread from the run queue because it was waiting for a resource.",
+                                                "operations", false),
+                            f.createIntGauge("unreservedSwap",
+                                                "The number of megabytes of swap space that are free. If this value goes to zero new processes can no longer be created.",
+                                                "megabytes", true),
+                            f.createIntGauge("unallocatedSwap",
+                                                "The number of megabytes of swap space that have not been allocated.",
+                                                "megabytes", true),
+
+
+                            f.createLongCounter("anonymousPagesFreed",
+                                                "The total number pages that contain heap, stack, or other changeable data that have been removed from memory and added to the free list.",
+                                                "pages"),
+                            f.createLongCounter("anonymousPagesPagedIn",
+                                                "The total number pages that contain heap, stack, or other changeable data that have been allocated in memory and possibly copied from disk.",
+                                                "pages", false),
+                            f.createLongCounter("anonymousPagesPagedOut",
+                                                "The total number pages that contain heap, stack, or other changeable data that have been removed from memory and copied to disk.",
+                                                "pages", false),
+                            f.createLongCounter("contextSwitches",
+                                                "The total number of context switches from one thread to another on the computer.  Thread switches can occur either inside of a single process or across processes.  A thread switch may be caused either by one thread asking another for information, or by a thread being preempted by another, higher priority thread becoming ready to run.",
+                                                "operations", false),
+                            f.createLongCounter("execPagesFreed",
+                                                "The total number readonly pages that contain code or data that have been removed from memory and returned to the free list.",
+                                                "pages"),
+                            f.createLongCounter("execPagesPagedIn",
+                                                "The total number readonly pages that contain code or data that have been copied from disk to memory.",
+                                                "pages", false),
+                            f.createLongCounter("execPagesPagedOut",
+                                                "The total number readonly pages that contain code or data that have been removed from memory and will need to be paged in when used again.",
+                                                "pages", false),
+                            f.createLongCounter("failedMutexEnters",
+                                                "The total number of times a thread entering a mutex had to wait for the mutex to be unlocked.",
+                                                "operations", false),
+                            f.createLongCounter("failedReaderLocks",
+                                                "The total number of times readers failed to obtain a readers/writer locks on their first try. When this happens the reader has to wait for the current writer to release the lock.",
+                                                "operations", false),
+                            f.createLongCounter("failedWriterLocks",
+                                                "The total number of times writers failed to obtain a readers/writer locks on their first try. When this happens the writer has to wait for all the current readers or the single writer to release the lock.",
+                                                "operations", false),
+                            f.createLongCounter("fileSystemPagesFreed",
+                                                "The total number of pages, that contained the contents of a file due to the file being read from a file system, that   have been removed from memory and put on the free list.",
+                                                "pages"),
+                            f.createLongCounter("fileSystemPagesPagedIn",
+                                                "The total number of pages that contain the contents of a file due to the file being read from a file system.",
+                                                "pages", false),
+                            f.createLongCounter("fileSystemPagesPagedOut",
+                                                "The total number of pages, that contained the contents of a file due to the file being read from a file system, that   have been removed from memory and copied to disk.",
+                                                "pages", false),
+                            f.createLongCounter("hatMinorFaults",
+                                                "The total number of hat faults. You only get these on systems with software memory management units.",
+                                                "operations", false),
+                            f.createLongCounter("interrupts",
+                                                "The total number of interrupts that have occurred on the computer.",
+                                                "operations", false),
+                            f.createLongCounter("involContextSwitches",
+                                                "The total number of times a thread was forced to give up the cpu even though it was still ready to run.",
+                                                "operations", false),
+                            f.createLongCounter("majorPageFaults",
+                                                "The total number of times a page fault required disk io to get the page",
+                                                "operations", false),
+                            f.createLongCounter("messageCount",
+                                                "The total number of msgrcv() and msgsnd() system calls.",
+                                                "messages"),
+                            f.createLongCounter("pageDaemonCycles",
+                                                "The total number of revolutions of the page daemon's scan \"clock hand\".",
+                                                "operations", false),
+                            f.createLongCounter("pageIns",
+                                                "The total number of times pages have been brought into memory from disk by the operating system's memory manager.",
+                                                "operations", false),
+                            f.createLongCounter("pageOuts",
+                                                "The total number of times pages have been flushed from memory to disk by the operating system's memory manager.",
+                                                "operations", false),
+                            f.createLongCounter("pagerRuns",
+                                                "The total number of times the pager daemon has been scheduled to run.",
+                                                "operations", false),
+                            f.createLongCounter("pagesPagedIn",
+                                                "The total number of pages that have been brought into memory from disk by the operating system's memory manager.",
+                                                "pages", false),
+                            f.createLongCounter("pagesPagedOut",
+                                                "The total number of pages that have been flushed from memory to disk by the operating system's memory manager.",
+                                                "pages", false),
+                            f.createLongCounter("pagesScanned",
+                                                "The total number pages examined by the pageout daemon. When the amount of free memory gets below a certain size, the daemon start to look for inactive memory pages to steal from processes. So I high scan rate is a good indication of needing more memory.",
+                                                "pages", false),
+                            f.createLongGauge("procsInIoWait",
+                                                "The number of processes waiting for block I/O at this instant in time.",
+                                                "processes"),
+                            f.createLongCounter("protectionFaults",
+                                                "The total number of times memory has been accessed in a way that was not allowed. This results in a segementation violation and in most cases a core dump.",
+                                                "operations", false),
+                            f.createLongCounter("semphoreOps",
+                                                "The total number of semaphore operations.",
+                                                "operations"),
+                            f.createLongCounter("softwareLockFaults",
+                                                "The total number of faults caused by software locks held on memory pages.",
+                                                "operations", false),
+                            f.createLongCounter("systemCalls",
+                                                "The total number system calls.",
+                                                "operations"),
+                            f.createLongCounter("systemMinorFaults",
+                                                "The total number of minor page faults in kernel code. Minor page faults do not require disk access.",
+                                                "operations", false),
+                            f.createLongCounter("threadCreates",
+                                                "The total number of times a thread has been created.",
+                                                "operations", false),
+                            f.createLongCounter("traps",
+                                                "The total number of traps that have occurred on the computer.",
+                                                "operations", false),
+                            f.createLongCounter("userMinorFaults",
+                                                "The total number of minor page faults in non-kernel code. Minor page faults do not require disk access.",
+                                                "operatations", false),
+                            f.createLongCounter("loopbackInputPackets",
+                                                "The total number of input packets received over the loopback network adaptor.",
+                                                "packets"),
+                            f.createLongCounter("loopbackOutputPackets",
+                                                "The total number of output packets sent over the loopback network adaptor.",
+                                                "packets"),
+                            f.createLongCounter("inputPackets",
+                                                "packets received (Solaris kstat 'ipackets')",
+                                                "packets"),
+                            f.createLongCounter("inputErrors",
+                                                "input errors (Solaris kstat 'ierrors')",
+                                                "errors", false),
+                            f.createLongCounter("outputPackets",
+                                                "Solaris kstat 'opackets'",
+                                                "packets"),
+                            f.createLongCounter("outputErrors",
+                                                "output errors (Solaris kstat 'oerrors')",
+                                                "errors", false),
+                            f.createLongCounter("collisions",
+                                                "Solaris kstat 'collisions'",
+                                                "collisions", false),
+                            f.createLongCounter("inputBytes",
+                                                "octets received (Solaris kstat 'rbytes')",
+                                                "bytes"),
+                            f.createLongCounter("outputBytes",
+                                                "octats transmitted (Solaris kstat 'obytes')",
+                                                "bytes"),
+                            f.createLongCounter("multicastInputPackets",
+                                                "multicast received (Solaris kstat 'multircv')",
+                                                "packets"),
+                            f.createLongCounter("multicastOutputPackets",
+                                                "multicast requested to be sent (Solaris kstat 'multixmt')",
+                                                "packets"),
+                            f.createLongCounter("broadcastInputPackets",
+                                                "broadcast received (Solaris kstat 'brdcstrcv')",
+                                                "packets"),
+                            f.createLongCounter("broadcastOutputPackets",
+                                                "broadcast requested to be sent (Solaris kstat 'brdcstxmt')",
+                                                "packets"),
+                            f.createLongCounter("inputPacketsDiscarded",
+                                                "number receive packets discarded (Solaris kstat 'norcvbuf')",
+                                                "packets"),
+                            f.createLongCounter("outputPacketsDiscarded",
+                                               "packets that could not be sent up because the queue was flow controlled (Solaris kstat 'noxmtbuf')",
+                                                "packets"),
+
+
+                            f.createDoubleGauge("loadAverage1",
+                                                "The average number of threads ready to run over the last minute.",
+                                                "threads"),
+                            f.createDoubleGauge("loadAverage15",
+                                                "The average number of threads ready to run over the last fifteen minutes.",
+                                                "threads"),
+                            f.createDoubleGauge("loadAverage5",
+                                                "The average number of threads ready to run over the last five minutes.",
+                                                "threads")
+                          });
+    checkOffset("allocatedSwap", allocatedSwapINT);
+    checkOffset("cpuActive", cpuActiveINT);
+    checkOffset("cpuIdle", cpuIdleINT);
+    checkOffset("cpuIoWait", cpuIoWaitINT);
+    checkOffset("cpuSwapWait", cpuSwapWaitINT);
+    checkOffset("cpuSystem", cpuSystemINT);
+    checkOffset("cpuUser", cpuUserINT);
+    checkOffset("cpuWaiting", cpuWaitingINT);
+    checkOffset("cpus", cpusINT);
+    checkOffset("freeMemory", freeMemoryINT);
+    checkOffset("physicalMemory", physicalMemoryINT);
+    checkOffset("processes", processesINT);
+    checkOffset("reservedSwap", reservedSwapINT);
+    checkOffset("schedulerRunCount", schedulerRunCountINT);
+    checkOffset("schedulerSwapCount", schedulerSwapCountINT);
+    checkOffset("schedulerWaitCount", schedulerWaitCountINT);
+    checkOffset("unreservedSwap", unreservedSwapINT);
+    checkOffset("unallocatedSwap", unallocatedSwapINT);
+
+    checkOffset("anonymousPagesFreed", anonymousPagesFreedLONG);
+    checkOffset("anonymousPagesPagedIn", anonymousPagesPagedInLONG);
+    checkOffset("anonymousPagesPagedOut", anonymousPagesPagedOutLONG);
+    checkOffset("contextSwitches", contextSwitchesLONG);
+    checkOffset("execPagesFreed", execPagesFreedLONG);
+    checkOffset("execPagesPagedIn", execPagesPagedInLONG);
+    checkOffset("execPagesPagedOut", execPagesPagedOutLONG);
+    checkOffset("failedMutexEnters", failedMutexEntersLONG);
+    checkOffset("failedReaderLocks", failedReaderLocksLONG);
+    checkOffset("failedWriterLocks", failedWriterLocksLONG);
+    checkOffset("fileSystemPagesFreed", fileSystemPagesFreedLONG);
+    checkOffset("fileSystemPagesPagedIn", fileSystemPagesPagedInLONG);
+    checkOffset("fileSystemPagesPagedOut", fileSystemPagesPagedOutLONG);
+    checkOffset("hatMinorFaults", hatMinorFaultsLONG);
+    checkOffset("interrupts", interruptsLONG);
+    checkOffset("involContextSwitches", involContextSwitchesLONG);
+    checkOffset("majorPageFaults", majorPageFaultsLONG);
+    checkOffset("messageCount", messageCountLONG);
+    checkOffset("pageDaemonCycles", pageDaemonCyclesLONG);
+    checkOffset("pageIns", pageInsLONG);
+    checkOffset("pageOuts", pageOutsLONG);
+    checkOffset("pagerRuns", pagerRunsLONG);
+    checkOffset("pagesPagedIn", pagesPagedInLONG);
+    checkOffset("pagesPagedOut", pagesPagedOutLONG);
+    checkOffset("pagesScanned", pagesScannedLONG);
+    checkOffset("procsInIoWait", procsInIoWaitLONG);
+    checkOffset("protectionFaults", protectionFaultsLONG);
+    checkOffset("semphoreOps", semphoreOpsLONG);
+    checkOffset("softwareLockFaults", softwareLockFaultsLONG);
+    checkOffset("systemCalls", systemCallsLONG);
+    checkOffset("systemMinorFaults", systemMinorFaultsLONG);
+    checkOffset("threadCreates", threadCreatesLONG);
+    checkOffset("traps", trapsLONG);
+    checkOffset("userMinorFaults", userMinorFaultsLONG);
+    checkOffset("loopbackInputPackets", loopbackInputPacketsLONG);
+    checkOffset("loopbackOutputPackets", loopbackOutputPacketsLONG);
+    checkOffset("inputPackets", inputPacketsLONG);
+    checkOffset("inputErrors", inputErrorsLONG);
+    checkOffset("outputPackets", outputPacketsLONG); 
+    checkOffset("outputErrors", outputErrorsLONG);
+    checkOffset("collisions", collisionsLONG);
+    checkOffset("inputBytes", inputBytesLONG);
+    checkOffset("outputBytes", outputBytesLONG);
+    checkOffset("multicastInputPackets", multicastInputPacketsLONG);
+    checkOffset("multicastOutputPackets", multicastOutputPacketsLONG);
+    checkOffset("broadcastInputPackets", broadcastInputPacketsLONG);
+    checkOffset("broadcastOutputPackets", broadcastOutputPacketsLONG);
+    checkOffset("inputPacketsDiscarded", inputPacketsDiscardedLONG);
+    checkOffset("outputPacketsDiscarded", outputPacketsDiscardedLONG);
+
+    checkOffset("loadAverage1", loadAverage1DOUBLE);
+    checkOffset("loadAverage15", loadAverage15DOUBLE);
+    checkOffset("loadAverage5", loadAverage5DOUBLE);
+  }
+
+  private SolarisSystemStats() {
+    // no instances allowed
+  }
+  public static StatisticsType getType() {
+    return myType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/866bacec/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/WindowsProcessStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/WindowsProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/WindowsProcessStats.java
new file mode 100644
index 0000000..5082316
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/statistics/platform/WindowsProcessStats.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.statistics.platform;
+
+import com.gemstone.gemfire.*;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.statistics.HostStatHelper;
+import com.gemstone.gemfire.internal.statistics.LocalStatisticsImpl;
+import com.gemstone.gemfire.internal.statistics.StatisticsTypeFactoryImpl;
+import com.gemstone.gemfire.internal.statistics.platform.ProcessStats;
+
+/**
+ * <P>This class provides the interface for statistics about a
+ * windows operating system process that is using a GemFire system.
+ */
+public class WindowsProcessStats
+{
+  private final static int handlesINT = 0;
+  private final static int priorityBaseINT = 1;
+  private final static int threadsINT = 2;
+
+  private final static int activeTimeLONG = 0;
+  private final static int pageFaultsLONG = 1;
+  private final static int pageFileSizeLONG = 2;
+  private final static int pageFileSizePeakLONG = 3;
+  private final static int privateSizeLONG = 4;
+  private final static int systemTimeLONG = 5;
+  private final static int userTimeLONG = 6;
+  private final static int virtualSizeLONG = 7;
+  private final static int virtualSizePeakLONG = 8;
+  private final static int workingSetSizeLONG = 9;
+  private final static int workingSetSizePeakLONG = 10;
+
+  private final static StatisticsType myType;
+
+  private static void checkOffset(String name, int offset) {
+    int id = myType.nameToId(name);
+    Assert.assertTrue(offset == id, "Expected the offset for " + name + " to be " + offset + " but it was " + id);
+  }
+
+  static {
+    StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+    myType = f
+        .createType(
+            "WindowsProcessStats",
+            "Statistics on a Microsoft Window's process.",
+            new StatisticDescriptor[] {
+                f.createIntGauge(
+                        "handles",
+                        "The total number of handles currently open by this process. This number is the sum of the handles currently open by each thread in this process.",
+                        "items"),
+                f.createIntGauge(
+                        "priorityBase",
+                        "The current base priority of the process. Threads within a process can raise and lower their own base priority relative to the process's base priority",
+                        "priority"),
+                f.createIntGauge(
+                        "threads",
+                        "Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread.",
+                        "threads"),
+
+                f.createLongCounter(
+                        "activeTime",
+                        "The elapsed time in milliseconds that all of the threads of this process used the processor to execute instructions. An instruction is the basic unit of execution in a computer, a thread is the object that executes instructions, and a process is the object created when a program is run. Code executed to handle some hardware interrupts and trap conditions are included in this count.",
+                        "milliseconds", false),
+
+                f.createLongCounter(
+                        "pageFaults",
+                        "The total number of Page Faults by the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. This will not cause the page to be fetched from disk if it is on the standby list and hence already in main memory, or if it is in use by another process with whom the page is shared.",
+                        "operations", false),
+                f.createLongGauge(
+                        "pageFileSize",
+                        "The current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.",
+                        "bytes"),
+                f.createLongGauge(
+                        "pageFileSizePeak",
+                        "The maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.",
+                        "bytes"),
+                f.createLongGauge(
+                        "privateSize",
+                        "The current number of bytes this process has allocated that cannot be shared with other processes.",
+                        "bytes"),
+                f.createLongCounter(
+                        "systemTime",
+                        "The elapsed time in milliseconds that the threads of the process have spent executing code in privileged mode. When a Windows system service is called, the service will often run in Privileged Mode to gain access to system-private data. Such data is protected from access by threads executing in user mode. Calls to the system can be explicit or implicit, such as page faults or interrupts. Unlike some early operating systems, Windows uses process boundaries for subsystem protection in addition to the traditional protection of user and privileged modes. These subsystem processes provide additional protection. Therefore, some work done by Windows on behalf of your application might appear in other subsystem processes in addition to the privileged time in your process.",
+                        "milliseconds", false),
+                f.createLongCounter(
+                        "userTime",
+                        "The elapsed time in milliseconds that this process's threads have spent executing code in user mode. Applications, environment subsystems, and integral subsystems execute in user mode. Code executing in User Mode cannot damage the integrity of the Windows Executive, Kernel, and device drivers. Unlike some early operating systems, Windows uses process boundaries for subsystem protection in addition to the traditional protection of user and privileged modes. These subsystem processes provide additional protection. Therefore, some work done by Windows on behalf of your application might appear in other subsystem processes in addition to the privileged time in your process.",
+                        "milliseconds", false),
+                f.createLongGauge(
+                        "virtualSize",
+                        "Virtual Bytes is the current size in bytes of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite, and by using too much, the process can limit its ability to load libraries.",
+                        "bytes"),
+                f.createLongGauge(
+                        "virtualSizePeak",
+                        "The maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is however finite, and by using too much, the process might limit its ability to load libraries.",
+                        "bytes"),
+                f.createLongGauge(
+                        "workingSetSize",
+                        "The current number of bytes in the Working Set of this process. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before they are paged out out to disk.",
+                        "bytes"),
+                f.createLongGauge(
+                        "workingSetSizePeak",
+                        "The maximum number of bytes in the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before they leave main memory.",
+                        "bytes"),
+
+            });
+    checkOffset("handles", handlesINT);
+    checkOffset("priorityBase", priorityBaseINT);
+    checkOffset("threads", threadsINT);
+
+    checkOffset("activeTime", activeTimeLONG);
+    checkOffset("pageFaults", pageFaultsLONG);
+    checkOffset("pageFileSize", pageFileSizeLONG);
+    checkOffset("pageFileSizePeak", pageFileSizePeakLONG);
+    checkOffset("privateSize", privateSizeLONG);
+    checkOffset("systemTime", systemTimeLONG);
+    checkOffset("userTime", userTimeLONG);
+    checkOffset("virtualSize", virtualSizeLONG);
+    checkOffset("virtualSizePeak", virtualSizePeakLONG);
+    checkOffset("workingSetSize", workingSetSizeLONG);
+    checkOffset("workingSetSizePeak", workingSetSizePeakLONG);
+  }
+
+  private WindowsProcessStats() {
+    // no instances allowed
+  }
+  public static StatisticsType getType() {
+    return myType;
+  }
+
+  /**
+   * Returns a <code>ProcessStats</code> that wraps Windows process
+   * <code>Statistics</code>.
+   * 
+   * @since GemFire 3.5
+   */
+  public static ProcessStats createProcessStats(final Statistics stats) { // TODO: was package-protected
+    if (stats instanceof LocalStatisticsImpl) {
+      HostStatHelper.refresh((LocalStatisticsImpl) stats);
+    } // otherwise its a Dummy implementation so do nothing
+    return new ProcessStats(stats) {
+      @Override
+        public long getProcessSize() {
+          return stats.getLong(workingSetSizeLONG) / (1024*1024);
+        }
+      };
+  }
+
+}


Mime
View raw message