use of org.apache.geode.Statistics in project geode by apache.
the class AbstractStatisticsFactory method findStatisticsByTextId.
@Override
public Statistics[] findStatisticsByTextId(String textId) {
List<Statistics> hits = new ArrayList<Statistics>();
Iterator<Statistics> it = statsList.iterator();
while (it.hasNext()) {
Statistics s = (Statistics) it.next();
if (s.getTextId().equals(textId)) {
hits.add(s);
}
}
Statistics[] result = new Statistics[hits.size()];
return (Statistics[]) hits.toArray(result);
}
use of org.apache.geode.Statistics in project geode by apache.
the class GemFireStatSampler method initProcessStats.
@Override
protected void initProcessStats(long id) {
if (PureJavaMode.osStatsAreAvailable()) {
if (osStatsDisabled()) {
logger.info(LogMarker.STATISTICS, LocalizedMessage.create(LocalizedStrings.GemFireStatSampler_OS_STATISTIC_COLLECTION_DISABLED_BY_OSSTATSDISABLED_SYSTEM_PROPERTY));
} else {
int retVal = HostStatHelper.initOSStats();
if (retVal != 0) {
logger.error(LogMarker.STATISTICS, LocalizedMessage.create(LocalizedStrings.GemFireStatSampler_OS_STATISTICS_FAILED_TO_INITIALIZE_PROPERLY_SOME_STATS_MAY_BE_MISSING_SEE_BUGNOTE_37160));
}
HostStatHelper.newSystem(getOsStatisticsFactory());
String statName = getStatisticsManager().getName();
if (statName == null || statName.length() == 0) {
statName = "javaApp" + getStatisticsManager().getId();
}
Statistics stats = HostStatHelper.newProcess(getOsStatisticsFactory(), id, statName + "-proc");
this.processStats = HostStatHelper.newProcessStats(stats);
}
}
}
use of org.apache.geode.Statistics in project geode by apache.
the class HostStatSampler method sampleSpecialStats.
/**
* Collect samples of any operating system statistics
*
* @param prepareOnly set to true if you only want to call prepareForSample
*/
private void sampleSpecialStats(boolean prepareOnly) {
List<Statistics> statsList = getStatisticsManager().getStatsList();
for (Statistics s : statsList) {
if (stopRequested())
return;
if (s instanceof StatisticsImpl) {
((StatisticsImpl) s).prepareForSample();
}
}
if (!prepareOnly && this.vmStats != null) {
if (stopRequested())
return;
this.vmStats.refresh();
}
sampleProcessStats(prepareOnly);
}
use of org.apache.geode.Statistics in project geode by apache.
the class SampleCollector method cleanupResources.
private List<ResourceInstance> cleanupResources(Statistics[] resources, int ignoreCount) {
final boolean isDebugEnabled_STATISTICS = logger.isTraceEnabled(LogMarker.STATISTICS);
if (isDebugEnabled_STATISTICS) {
logger.trace(LogMarker.STATISTICS, "SampleCollector#cleanupResources resources.length={}, ignoreCount={}", resources.length, ignoreCount);
}
int resourcesToDelete = this.resourceInstMap.size() - (resources.length - ignoreCount);
if (isDebugEnabled_STATISTICS) {
logger.trace(LogMarker.STATISTICS, "SampleCollector#cleanupResources resourcesToDelete={}", resourcesToDelete);
}
if (resourcesToDelete == 0) {
return Collections.<ResourceInstance>emptyList();
}
// some resource instances need to be removed
List<ResourceInstance> resourcesRemoved = new ArrayList<ResourceInstance>();
List<Statistics> resourceList = Arrays.asList(resources);
Iterator<Map.Entry<Statistics, ResourceInstance>> it = this.resourceInstMap.entrySet().iterator();
while (it.hasNext() && resourcesToDelete > 0) {
Map.Entry<Statistics, ResourceInstance> e = it.next();
Statistics key = (Statistics) e.getKey();
if (!resourceList.contains(key)) {
key.close();
ResourceInstance inst = (ResourceInstance) e.getValue();
resourcesRemoved.add(inst);
resourcesToDelete--;
it.remove();
}
}
if (isDebugEnabled_STATISTICS) {
logger.trace(LogMarker.STATISTICS, "SampleCollector#cleanupResources resourcesRemoved={}", resourcesRemoved);
}
return resourcesRemoved;
}
use of org.apache.geode.Statistics in project geode by apache.
the class MemberMBeanBridge method addCacheStats.
public void addCacheStats(CachePerfStats cachePerfStats) {
Statistics cachePerfStatistics = cachePerfStats.getStats();
monitor.addStatisticsToMonitor(cachePerfStatistics);
}
Aggregations