Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IGNITE-5461 Added collecting of memory metrics.
- Loading branch information
1 parent
57bfba7
commit 29c2693
Showing
7 changed files
with
287 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,175 @@ | |||
/* | |||
* 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 org.apache.ignite.internal.visor.cache; | |||
|
|||
import java.io.IOException; | |||
import java.io.ObjectInput; | |||
import java.io.ObjectOutput; | |||
import org.apache.ignite.MemoryMetrics; | |||
import org.apache.ignite.internal.util.typedef.internal.S; | |||
import org.apache.ignite.internal.util.typedef.internal.U; | |||
import org.apache.ignite.internal.visor.VisorDataTransferObject; | |||
|
|||
/** | |||
* Data transfer object for {@link MemoryMetrics} | |||
*/ | |||
public class VisorMemoryMetrics extends VisorDataTransferObject { | |||
/** */ | |||
private static final long serialVersionUID = 0L; | |||
|
|||
/** */ | |||
private String name; | |||
|
|||
/** */ | |||
private long totalAllocatedPages; | |||
|
|||
/** */ | |||
private float allocationRate; | |||
|
|||
/** */ | |||
private float evictionRate; | |||
|
|||
/** */ | |||
private float largeEntriesPagesPercentage; | |||
|
|||
/** */ | |||
private float pagesFillFactor; | |||
|
|||
/** */ | |||
private long dirtyPages; | |||
|
|||
/** */ | |||
private float pageReplaceRate; | |||
|
|||
/** */ | |||
private long physicalMemoryPages; | |||
|
|||
/** | |||
* Default constructor. | |||
*/ | |||
public VisorMemoryMetrics() { | |||
// No-op. | |||
} | |||
|
|||
/** | |||
* @param m Metrics instance to create DTO. | |||
*/ | |||
public VisorMemoryMetrics(MemoryMetrics m) { | |||
name = m.getName(); | |||
totalAllocatedPages = m.getTotalAllocatedPages(); | |||
allocationRate = m.getAllocationRate(); | |||
evictionRate = m.getEvictionRate(); | |||
largeEntriesPagesPercentage = m.getLargeEntriesPagesPercentage(); | |||
pagesFillFactor = m.getPagesFillFactor(); | |||
dirtyPages = m.getDirtyPages(); | |||
pageReplaceRate = m.getPagesReplaceRate(); | |||
physicalMemoryPages = m.getPhysicalMemoryPages(); | |||
} | |||
|
|||
/** | |||
* @return Name of the memory region. | |||
*/ | |||
public String getName() { | |||
return name; | |||
} | |||
|
|||
/** | |||
* @return Total number of allocated pages. | |||
*/ | |||
public long getTotalAllocatedPages() { | |||
return totalAllocatedPages; | |||
} | |||
|
|||
/** | |||
* @return Number of allocated pages per second. | |||
*/ | |||
public float getAllocationRate() { | |||
return allocationRate; | |||
} | |||
|
|||
/** {@inheritDoc} */ | |||
public float getEvictionRate() { | |||
return evictionRate; | |||
} | |||
|
|||
/** | |||
* @return Number of evicted pages per second. | |||
*/ | |||
public float getLargeEntriesPagesPercentage() { | |||
return largeEntriesPagesPercentage; | |||
} | |||
|
|||
/** | |||
* @return Percentage of pages fully occupied by large entities. | |||
*/ | |||
public float getPagesFillFactor() { | |||
return pagesFillFactor; | |||
} | |||
|
|||
/** | |||
* @return Current number of dirty pages. | |||
*/ | |||
public long getDirtyPages() { | |||
return dirtyPages; | |||
} | |||
|
|||
/** | |||
* @return Pages per second replace rate. | |||
*/ | |||
public float getPagesReplaceRate() { | |||
return pageReplaceRate; | |||
} | |||
|
|||
/** | |||
* @return Total number of pages loaded to RAM. | |||
*/ | |||
public long getPhysicalMemoryPages() { | |||
return physicalMemoryPages; | |||
} | |||
|
|||
/** {@inheritDoc} */ | |||
@Override protected void writeExternalData(ObjectOutput out) throws IOException { | |||
U.writeString(out, name); | |||
out.writeLong(totalAllocatedPages); | |||
out.writeFloat(allocationRate); | |||
out.writeFloat(evictionRate); | |||
out.writeFloat(largeEntriesPagesPercentage); | |||
out.writeFloat(pagesFillFactor); | |||
out.writeLong(dirtyPages); | |||
out.writeFloat(pageReplaceRate); | |||
out.writeLong(physicalMemoryPages); | |||
} | |||
|
|||
/** {@inheritDoc} */ | |||
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { | |||
name = U.readString(in); | |||
totalAllocatedPages = in.readLong(); | |||
allocationRate = in.readFloat(); | |||
evictionRate = in.readFloat(); | |||
largeEntriesPagesPercentage = in.readFloat(); | |||
pagesFillFactor = in.readFloat(); | |||
dirtyPages = in.readLong(); | |||
pageReplaceRate = in.readFloat(); | |||
physicalMemoryPages = in.readLong(); | |||
} | |||
|
|||
/** {@inheritDoc} */ | |||
@Override public String toString() { | |||
return S.toString(VisorMemoryMetrics.class, this); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.