Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3B47617F80 for ; Tue, 2 Jun 2015 12:59:45 +0000 (UTC) Received: (qmail 89170 invoked by uid 500); 2 Jun 2015 12:59:45 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 89137 invoked by uid 500); 2 Jun 2015 12:59:45 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 89119 invoked by uid 99); 2 Jun 2015 12:59:45 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2015 12:59:45 +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 A1AF01A42DD for ; Tue, 2 Jun 2015 12:59:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.791 X-Spam-Level: * X-Spam-Status: No, score=1.791 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id FbQvKdC_Z3Jj for ; Tue, 2 Jun 2015 12:59:29 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id C5ACB27D70 for ; Tue, 2 Jun 2015 12:59:15 +0000 (UTC) Received: (qmail 84444 invoked by uid 99); 2 Jun 2015 12:59:12 -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; Tue, 02 Jun 2015 12:59:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A2C0EE0044; Tue, 2 Jun 2015 12:59:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yzhdanov@apache.org To: commits@ignite.incubator.apache.org Date: Tue, 02 Jun 2015 12:59:38 -0000 Message-Id: In-Reply-To: <2812d8a3579948a8acaf1dc25381e735@git.apache.org> References: <2812d8a3579948a8acaf1dc25381e735@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [28/50] [abbrv] incubator-ignite git commit: # regenerated PDF # regenerated PDF Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5c30f9cf Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5c30f9cf Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5c30f9cf Branch: refs/heads/ignite-745 Commit: 5c30f9cf5c490b0d6c065e89557a8b8f3040eda5 Parents: 6cd1a6e 3f012b7 Author: Yakov Zhdanov Authored: Fri May 29 18:42:16 2015 +0300 Committer: Yakov Zhdanov Committed: Fri May 29 18:42:16 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/cache/CacheMetrics.java | 187 +++++++-- .../internal/managers/GridManagerAdapter.java | 59 +-- .../processors/cache/CacheMetricsImpl.java | 305 +++++++++++++- .../cache/CacheMetricsMXBeanImpl.java | 100 +++++ .../processors/cache/CacheMetricsSnapshot.java | 380 +++++++++++++---- .../processors/cache/GridCacheSwapManager.java | 118 ++++-- .../ignite/mxbean/CacheMetricsMXBean.java | 80 ++++ .../org/apache/ignite/spi/IgniteSpiAdapter.java | 35 +- .../org/apache/ignite/spi/IgniteSpiContext.java | 47 --- .../spi/swapspace/file/FileSwapSpaceSpi.java | 8 +- ...CacheLocalOffHeapAndSwapMetricsSelfTest.java | 412 +++++++++++++++++++ .../testframework/GridSpiTestContext.java | 25 +- .../IgniteCacheMetricsSelfTestSuite.java | 1 + 13 files changed, 1457 insertions(+), 300 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c30f9cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java index af19077,3dcda3c..4e6a447 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsImpl.java @@@ -129,24 -161,162 +164,168 @@@ public class CacheMetricsImpl implement } /** {@inheritDoc} */ + @Override public long getOffHeapGets() { + return offHeapGets.get(); + } + + /** {@inheritDoc} */ + @Override public long getOffHeapPuts() { + return offHeapPuts.get(); + } + + /** {@inheritDoc} */ + @Override public long getOffHeapRemovals() { + return offHeapRemoves.get(); + } + + /** {@inheritDoc} */ + @Override public long getOffHeapEvictions() { + return offHeapEvicts.get(); + } + + /** {@inheritDoc} */ + @Override public long getOffHeapHits() { + return offHeapHits.get(); + } + + /** {@inheritDoc} */ + @Override public float getOffHeapHitPercentage() { + long hits0 = offHeapHits.get(); + long gets0 = offHeapGets.get(); + + if (hits0 == 0) + return 0; + + return (float) hits0 / gets0 * 100.0f; + } + + /** {@inheritDoc} */ + @Override public long getOffHeapMisses() { + return offHeapMisses.get(); + } + + /** {@inheritDoc} */ + @Override public float getOffHeapMissPercentage() { + long misses0 = offHeapMisses.get(); + long reads0 = offHeapGets.get(); + + if (misses0 == 0) + return 0; + + return (float) misses0 / reads0 * 100.0f; + } + + /** {@inheritDoc} */ @Override public long getOffHeapEntriesCount() { - return cctx.cache().offHeapEntriesCount(); + GridCacheAdapter cache = cctx.cache(); + + return cache != null ? cache.offHeapEntriesCount() : -1; } /** {@inheritDoc} */ + @Override public long getOffHeapPrimaryEntriesCount() { + try { + return cctx.swap().offheapEntriesCount(true, false, NONE); + } + catch (IgniteCheckedException e) { + return 0; + } + } + + /** {@inheritDoc} */ + @Override public long getOffHeapBackupEntriesCount() { + try { + return cctx.swap().offheapEntriesCount(false, true, NONE); + } + catch (IgniteCheckedException e) { + return 0; + } + } + + /** {@inheritDoc} */ @Override public long getOffHeapAllocatedSize() { - return cctx.cache().offHeapAllocatedSize(); + GridCacheAdapter cache = cctx.cache(); + + return cache != null ? cache.offHeapAllocatedSize() : -1; } /** {@inheritDoc} */ + @Override public long getOffHeapMaxSize() { + return cctx.config().getOffHeapMaxMemory(); + } + + /** {@inheritDoc} */ + @Override public long getSwapGets() { + return swapGets.get(); + } + + /** {@inheritDoc} */ + @Override public long getSwapPuts() { + return swapPuts.get(); + } + + /** {@inheritDoc} */ + @Override public long getSwapRemovals() { + return swapRemoves.get(); + } + + /** {@inheritDoc} */ + @Override public long getSwapHits() { + return swapHits.get(); + } + + /** {@inheritDoc} */ + @Override public long getSwapMisses() { + return swapMisses.get(); + } + + /** {@inheritDoc} */ + @Override public long getSwapEntriesCount() { + try { + return cctx.cache().swapKeys(); + } + catch (IgniteCheckedException e) { + return 0; + } + } + + /** {@inheritDoc} */ + @Override public long getSwapSize() { + try { + return cctx.cache().swapSize(); + } + catch (IgniteCheckedException e) { + return 0; + } + } + + /** {@inheritDoc} */ + @Override public float getSwapHitPercentage() { + long hits0 = swapHits.get(); + long gets0 = swapGets.get(); + + if (hits0 == 0) + return 0; + + return (float) hits0 / gets0 * 100.0f; + } + + /** {@inheritDoc} */ + @Override public float getSwapMissPercentage() { + long misses0 = swapMisses.get(); + long reads0 = swapGets.get(); + + if (misses0 == 0) + return 0; + + return (float) misses0 / reads0 * 100.0f; + } + + /** {@inheritDoc} */ @Override public int getSize() { - return cctx.cache().size(); + GridCacheAdapter cache = cctx.cache(); + + return cache != null ? cache.size() : 0; } /** {@inheritDoc} */ @@@ -606,11 -769,111 +797,113 @@@ /** {@inheritDoc} */ @Override public boolean isManagementEnabled() { - return cctx.config().isManagementEnabled(); + CacheConfiguration ccfg = cctx.config(); + + return ccfg != null && ccfg.isManagementEnabled(); } + /** + * Off-heap read callback. + * + * @param hit Hit or miss flag. + */ + public void onOffHeapRead(boolean hit) { + offHeapGets.incrementAndGet(); + + if (hit) + offHeapHits.incrementAndGet(); + else + offHeapMisses.incrementAndGet(); + + if (delegate != null) + delegate.onOffHeapRead(hit); + } + + /** + * Off-heap write callback. + */ + public void onOffHeapWrite() { + offHeapPuts.incrementAndGet(); + + if (delegate != null) + delegate.onOffHeapWrite(); + } + + /** + * Off-heap remove callback. + */ + public void onOffHeapRemove() { + offHeapRemoves.incrementAndGet(); + + if (delegate != null) + delegate.onOffHeapRemove(); + } + + /** + * Off-heap evict callback. + */ + public void onOffHeapEvict() { + offHeapEvicts.incrementAndGet(); + + if (delegate != null) + delegate.onOffHeapRemove(); + } + + /** + * Swap read callback. + * + * @param hit Hit or miss flag. + */ + public void onSwapRead(boolean hit) { + swapGets.incrementAndGet(); + + if (hit) + swapHits.incrementAndGet(); + else + swapMisses.incrementAndGet(); + + if (delegate != null) + delegate.onSwapRead(hit); + } + + /** + * Swap write callback. + */ + public void onSwapWrite() { + onSwapWrite(1); + } + + /** + * Swap write callback. + * + * @param cnt Amount of entries. + */ + public void onSwapWrite(int cnt) { + swapPuts.addAndGet(cnt); + + if (delegate != null) + delegate.onSwapWrite(cnt); + } + + /** + * Swap remove callback. + */ + public void onSwapRemove() { + onSwapRemove(1); + } + + /** + * Swap remove callback. + * + * @param cnt Amount of entries. + */ + public void onSwapRemove(int cnt) { + swapRemoves.addAndGet(cnt); + + if (delegate != null) + delegate.onSwapRemove(cnt); + } + /** {@inheritDoc} */ @Override public String toString() { return S.toString(CacheMetricsImpl.class, this);