Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 027D8200B74 for ; Thu, 18 Aug 2016 01:11:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 00EA0160ABB; Wed, 17 Aug 2016 23:11:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7EFB4160AB5 for ; Thu, 18 Aug 2016 01:11:11 +0200 (CEST) Received: (qmail 17277 invoked by uid 500); 17 Aug 2016 23:11:10 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 17268 invoked by uid 99); 17 Aug 2016 23:11:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Aug 2016 23:11:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 161B71A0178 for ; Wed, 17 Aug 2016 23:11:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 44IPIemUUZz7 for ; Wed, 17 Aug 2016 23:11:01 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id D70CB60D94 for ; Wed, 17 Aug 2016 23:10:52 +0000 (UTC) Received: (qmail 15491 invoked by uid 99); 17 Aug 2016 23:10:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Aug 2016 23:10:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E7208EEF43; Wed, 17 Aug 2016 23:10:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klund@apache.org To: commits@geode.incubator.apache.org Date: Wed, 17 Aug 2016 23:11:09 -0000 Message-Id: In-Reply-To: <96c00bd4e23a47ef82c36815cd28dd18@git.apache.org> References: <96c00bd4e23a47ef82c36815cd28dd18@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [20/24] incubator-geode git commit: GEODE-1781: refactor internal statistics classes archived-at: Wed, 17 Aug 2016 23:11:14 -0000 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsFactory.java deleted file mode 100644 index 6f8315a..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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; - -import org.apache.logging.log4j.Logger; - -import com.gemstone.gemfire.CancelCriterion; -import com.gemstone.gemfire.Statistics; -import com.gemstone.gemfire.StatisticsFactory; -import com.gemstone.gemfire.StatisticsType; -import com.gemstone.gemfire.internal.i18n.LocalizedStrings; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage; -import com.gemstone.gemfire.internal.logging.log4j.LogMarker; - -/** - * A standalone implementation of {@link StatisticsFactory}. - * It can be used in contexts that do not have the GemFire product - * or in vm's that do not have a distributed system nor a gemfire connection. - * - */ -public class LocalStatisticsFactory extends AbstractStatisticsFactory - implements StatisticsFactory, StatisticsManager { - - private static final Logger logger = LogService.getLogger(); - - public static final String STATS_DISABLE_NAME_PROPERTY = "stats.disable"; - - private final SimpleStatSampler sampler; - private final boolean statsDisabled; - - public LocalStatisticsFactory(CancelCriterion stopper) { - super(initId(), initName(), initStartTime()); - - this.statsDisabled = Boolean.getBoolean(STATS_DISABLE_NAME_PROPERTY); - if (statsDisabled) { - this.sampler = null; - logger.info(LogMarker.STATISTICS, LocalizedMessage.create(LocalizedStrings.LocalStatisticsFactory_STATISTIC_COLLECTION_IS_DISABLED_USE_DSTATSDISABLEFALSE_TO_TURN_ON_STATISTICS)); - } else if (stopper != null) { - this.sampler = new SimpleStatSampler(stopper, this); - this.sampler.start(); - } else { - this.sampler = null; - } - } - - protected static long initId() { - return Thread.currentThread().hashCode(); - } - - protected static String initName() { - return System.getProperty("stats.name", Thread.currentThread().getName()); - } - - protected static long initStartTime() { - return System.currentTimeMillis(); - } - - protected SimpleStatSampler getStatSampler() { - return this.sampler; - } - - @Override - public void close() { - if (this.sampler != null) { - this.sampler.stop(); - } - } - - @Override - protected Statistics createOsStatistics(StatisticsType type, String textId, long numericId, int osStatFlags) { - if (this.statsDisabled) { - return new DummyStatisticsImpl(type, textId, numericId); - } - return super.createOsStatistics(type, textId, numericId, osStatFlags); - } - - @Override - public Statistics createAtomicStatistics(StatisticsType type, String textId, long numericId) { - if (this.statsDisabled) { - return new DummyStatisticsImpl(type, textId, numericId); - } - return super.createAtomicStatistics(type, textId, numericId); - } -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsImpl.java deleted file mode 100644 index cf59e1f..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/LocalStatisticsImpl.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * 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; - -import com.gemstone.gemfire.*; -//import com.gemstone.gemfire.util.IntArray; -//import com.gemstone.gemfire.util.LongArray; - -/** - * An implementation of {@link Statistics} that stores its statistics - * in local java memory. - * - * @see Package introduction - * - * - * @since GemFire 3.0 - * - */ -public class LocalStatisticsImpl extends StatisticsImpl { - - /** In JOM Statistics, the values of the int statistics */ - private final int[] intStorage; - - /** In JOM Statistics, the values of the long statistics */ - private final long[] longStorage; - - /** In JOM Statistics, the values of the double statistics */ - private final double[] doubleStorage; - - /** An array containing the JOM object used to lock a int statistic when - * it is incremented. */ - private transient final Object[] intLocks; - - /** An array containing the JOM object used to lock a long statistic when - * it is incremented. */ - private transient final Object[] longLocks; - - /** An array containing the JOM object used to lock a double statistic when - * it is incremented. */ - private transient final Object[] doubleLocks; - - /** The StatisticsFactory that created this instance */ - private final StatisticsManager dSystem; - - /////////////////////// Constructors /////////////////////// - - /** - * Creates a new statistics instance of the given type - * - * @param type - * A description of the statistics - * @param textId - * Text that identifies this statistic when it is monitored - * @param numericId - * A number that displayed when this statistic is monitored - * @param uniqueId - * A number that uniquely identifies this instance - * @param atomicIncrements - * Are increment operations atomic? If only one application - * thread increments a statistic, then a false - * value may yield better performance. - * @param osStatFlags - * Non-zero if stats require system calls to collect them; for internal use only - * @param system - * The distributed system that determines whether or not these - * statistics are stored (and collected) in GemFire shared - * memory or in the local VM - */ - public LocalStatisticsImpl(StatisticsType type, String textId, - long numericId, - long uniqueId, - boolean atomicIncrements, - int osStatFlags, - StatisticsManager system) { - super(type, calcTextId(system, textId), calcNumericId(system, numericId), - uniqueId, osStatFlags); - - this.dSystem = system; - - StatisticsTypeImpl realType = (StatisticsTypeImpl)type; - int intCount = realType.getIntStatCount(); - int longCount = realType.getLongStatCount(); - int doubleCount = realType.getDoubleStatCount(); - - if (intCount > 0) { - this.intStorage = new int[intCount]; - if (atomicIncrements) { - this.intLocks = new Object[intCount]; - for (int i = 0; i < intLocks.length; i++) { - intLocks[i] = new Object(); - } - } else { - this.intLocks = null; - } - } else { - this.intStorage = null; - this.intLocks = null; - } - - if (longCount > 0) { - this.longStorage = new long[longCount]; - if (atomicIncrements) { - this.longLocks = new Object[longCount]; - for (int i = 0; i < longLocks.length; i++) { - longLocks[i] = new Object(); - } - } else { - this.longLocks = null; - } - } else { - this.longStorage = null; - this.longLocks = null; - } - - if (doubleCount > 0) { - this.doubleStorage = new double[doubleCount]; - if (atomicIncrements) { - this.doubleLocks = new Object[doubleCount]; - for (int i = 0; i < doubleLocks.length; i++) { - doubleLocks[i] = new Object(); - } - } else { - this.doubleLocks = null; - } - } else { - this.doubleStorage = null; - this.doubleLocks = null; - } - } - - ////////////////////// Static Methods ////////////////////// - - private static long calcNumericId(StatisticsManager system, long userValue) { - if (userValue != 0) { - return userValue; - } else { - long result = OSProcess.getId(); // fix for bug 30239 - if (result == 0) { - if (system != null) { - result = system.getId(); - } - } - return result; - } - } - - private static String calcTextId(StatisticsManager system, String userValue) { - if (userValue != null && !userValue.equals("")) { - return userValue; - } else { - if (system != null) { - return system.getName(); - } else { - return ""; - } - } - } - - ////////////////////// Instance Methods ////////////////////// - - @Override - public final boolean isAtomic() { - return intLocks != null || longLocks != null || doubleLocks != null; - } - - @Override - public void close() { - super.close(); - if (this.dSystem != null) { - dSystem.destroyStatistics(this); - } - } - - //////////////////////// store() Methods /////////////////////// - - @Override - protected final void _setInt(int offset, int value) { - this.intStorage[offset] = value; - } - - @Override - protected final void _setLong(int offset, long value) { - this.longStorage[offset] = value; - } - - @Override - protected final void _setDouble(int offset, double value) { - this.doubleStorage[offset] = value; - } - - /////////////////////// get() Methods /////////////////////// - - @Override - protected final int _getInt(int offset) { - return this.intStorage[offset]; - } - - @Override - protected final long _getLong(int offset) { - return this.longStorage[offset]; - } - - @Override - protected final double _getDouble(int offset) { - return this.doubleStorage[offset]; - } - - //////////////////////// inc() Methods //////////////////////// - - @Override - protected final void _incInt(int offset, int delta) { - if (this.intLocks != null) { - synchronized (this.intLocks[offset]) { - this.intStorage[offset] += delta; - } - } else { - this.intStorage[offset] += delta; - } - } - - @Override - protected final void _incLong(int offset, long delta) { - if (this.longLocks != null) { - synchronized (this.longLocks[offset]) { - this.longStorage[offset] += delta; - } - } else { - this.longStorage[offset] += delta; - } - } - - @Override - protected final void _incDouble(int offset, double delta) { - if (this.doubleLocks != null) { - synchronized (this.doubleLocks[offset]) { - this.doubleStorage[offset] += delta; - } - } else { - this.doubleStorage[offset] += delta; - } - } - - /////////////////// internal package methods ////////////////// - - final int[] _getIntStorage() { - return this.intStorage; - } - final long[] _getLongStorage() { - return this.longStorage; - } - final double[] _getDoubleStorage() { - return this.doubleStorage; - } -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXProcessStats.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXProcessStats.java deleted file mode 100644 index 0706c7b..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXProcessStats.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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; - -import com.gemstone.gemfire.*; - -/** - *

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 ProcessStats that wraps OS X process - * Statistics. - * - * @since GemFire 3.5 - */ - static ProcessStats createProcessStats(final Statistics stats) { - 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/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXSystemStats.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXSystemStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXSystemStats.java deleted file mode 100644 index 8d440ca..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/OSXSystemStats.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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; - -import com.gemstone.gemfire.*; - -/** - *

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/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/OsStatisticsFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/OsStatisticsFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/OsStatisticsFactory.java deleted file mode 100644 index 7dac90e..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/OsStatisticsFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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; - -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. - *

- * @see Package introduction - * - * - * @since GemFire 3.0 - */ -public interface OsStatisticsFactory { - /** - * Creates and returns a OS {@link Statistics} instance of the given {@link StatisticsType type}, textId, numericId, and osStatFlags.. - *

- * 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/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/ProcessStats.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/ProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/ProcessStats.java deleted file mode 100644 index c80e340..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/ProcessStats.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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; - -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 ProcessStats that wraps the given - * Statistics. - */ - 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/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/SimpleStatSampler.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/SimpleStatSampler.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/SimpleStatSampler.java deleted file mode 100644 index b3cc56b..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/SimpleStatSampler.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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; - -import java.io.File; - -import org.apache.logging.log4j.Logger; - -import com.gemstone.gemfire.CancelCriterion; -import com.gemstone.gemfire.internal.i18n.LocalizedStrings; -import com.gemstone.gemfire.internal.logging.LogService; -import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage; -import com.gemstone.gemfire.internal.logging.log4j.LogMarker; - -/** - * SimpleStatSampler is a functional implementation of HostStatSampler - * that samples statistics stored in local java memory and does not - * require any native code or additional GemFire features. - *

- * The StatisticsManager may be implemented by LocalStatisticsFactory and does - * not require a GemFire connection. - - */ -public class SimpleStatSampler extends HostStatSampler { - - private static final Logger logger = LogService.getLogger(); - - public static final String ARCHIVE_FILE_NAME_PROPERTY = "stats.archive-file"; - public static final String FILE_SIZE_LIMIT_PROPERTY = "stats.file-size-limit"; - public static final String DISK_SPACE_LIMIT_PROPERTY = "stats.disk-space-limit"; - public static final String SAMPLE_RATE_PROPERTY = "stats.sample-rate"; - - public static final String DEFAULT_ARCHIVE_FILE_NAME = "stats.gfs"; - public static final long DEFAULT_FILE_SIZE_LIMIT = 0; - public static final long DEFAULT_DISK_SPACE_LIMIT = 0; - public static final int DEFAULT_SAMPLE_RATE = 1000; - - private final File archiveFileName = new File(System.getProperty(ARCHIVE_FILE_NAME_PROPERTY, DEFAULT_ARCHIVE_FILE_NAME)); - private final long archiveFileSizeLimit = Long.getLong(FILE_SIZE_LIMIT_PROPERTY, DEFAULT_FILE_SIZE_LIMIT).longValue() * (1024*1024); - private final long archiveDiskSpaceLimit = Long.getLong(DISK_SPACE_LIMIT_PROPERTY, DEFAULT_DISK_SPACE_LIMIT).longValue() * (1024*1024); - private final int sampleRate = Integer.getInteger(SAMPLE_RATE_PROPERTY, DEFAULT_SAMPLE_RATE).intValue(); - - private final StatisticsManager sm; - - public SimpleStatSampler(CancelCriterion stopper, StatisticsManager sm) { - super(stopper, new StatSamplerStats(sm, sm.getId())); - this.sm = sm; - logger.info(LogMarker.STATISTICS, LocalizedMessage.create(LocalizedStrings.SimpleStatSampler_STATSSAMPLERATE_0, getSampleRate())); - } - - @Override - protected void checkListeners() { - // do nothing - } - - @Override - public File getArchiveFileName() { - return this.archiveFileName; - } - - @Override - public long getArchiveFileSizeLimit() { - if (fileSizeLimitInKB()) { - return this.archiveFileSizeLimit / 1024; - } else { - return this.archiveFileSizeLimit; - } - } - - @Override - public long getArchiveDiskSpaceLimit() { - if (fileSizeLimitInKB()) { - return this.archiveDiskSpaceLimit / 1024; - } else { - return this.archiveDiskSpaceLimit; - } - } - - @Override - public String getProductDescription() { - return "Unknown product"; - } - - @Override - protected StatisticsManager getStatisticsManager() { - return this.sm; - } - - @Override - protected int getSampleRate() { - return this.sampleRate; - } - - @Override - public boolean isSamplingEnabled() { - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisProcessStats.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisProcessStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisProcessStats.java deleted file mode 100644 index d07d398..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisProcessStats.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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; - -import com.gemstone.gemfire.*; - -/** - *

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 ProcessStats that wraps Solaris process - * Statistics. - * - * @since GemFire 3.5 - */ - static ProcessStats createProcessStats(final Statistics stats) { - 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/11507012/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisSystemStats.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisSystemStats.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisSystemStats.java deleted file mode 100644 index 9f56943..0000000 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/SolarisSystemStats.java +++ /dev/null @@ -1,428 +0,0 @@ -/* - * 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; - -import com.gemstone.gemfire.*; - -/** - *

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; - } -}