use of com.orientechnologies.common.util.ORawPair in project orientdb by orientechnologies.
the class OPerformanceStatisticManager method fetchComponentCounters.
/**
* Iterates over all live threads and accumulates performance statics gathered form threads for provided component,
* also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.
*
* @param componentCountersHolder Holder which is used to accumulate all performance statistic data for given component
* @param componentName Name of component
*/
private void fetchComponentCounters(String componentName, PerformanceCountersHolder componentCountersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to componentCountersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<ORawPair<Thread, PerformanceSnapshot>>(statistics.size());
final List<Thread> threadsToRemove = new ArrayList<Thread>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<Thread, PerformanceSnapshot>(thread, statistic.getSnapshot()));
}
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
final PerformanceCountersHolder holder = snapshot.countersByComponent.get(componentName);
if (holder != null)
holder.pushData(componentCountersHolder);
} else {
threadsToRemove.add(thread);
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove);
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final PerformanceCountersHolder dch = ds.countersByComponents.get(componentName);
if (dch != null) {
dch.pushData(componentCountersHolder);
}
}
}
use of com.orientechnologies.common.util.ORawPair in project orientdb by orientechnologies.
the class OPerformanceStatisticManager method fetchWALCounters.
/**
* Iterates over all live threads and accumulates write ahead log performance statics gathered form threads,
* also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.
*
* @return Aggregated write ahead log performance statistic
*/
private WALCountersHolder fetchWALCounters() {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to countersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<ORawPair<Thread, PerformanceSnapshot>>(statistics.size());
final Collection<Thread> threadsToRemove = new ArrayList<Thread>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<Thread, PerformanceSnapshot>(thread, statistic.getSnapshot()));
}
WALCountersHolder holder = null;
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
if (snapshot.walCountersHolder != null) {
if (holder == null)
holder = new WALCountersHolder();
snapshot.walCountersHolder.pushData(holder);
}
} else {
threadsToRemove.add(thread);
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove);
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final WALCountersHolder wch = ds.walCountersHolder;
if (wch != null) {
if (holder == null)
holder = new WALCountersHolder();
wch.pushData(holder);
}
}
return holder;
}
use of com.orientechnologies.common.util.ORawPair in project orientdb by orientechnologies.
the class OPerformanceStatisticManager method fetchStorageCounters.
/**
* Iterates over all live threads and accumulates storage performance statics gathered form threads,
* also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.
*
* @return Aggregated storage performance statistic
*/
private StorageCountersHolder fetchStorageCounters() {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to countersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<ORawPair<Thread, PerformanceSnapshot>>(statistics.size());
final Collection<Thread> threadsToRemove = new ArrayList<Thread>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<Thread, PerformanceSnapshot>(thread, statistic.getSnapshot()));
}
StorageCountersHolder holder = null;
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
if (snapshot.storageCountersHolder != null) {
if (holder == null)
holder = new StorageCountersHolder();
snapshot.storageCountersHolder.pushData(holder);
}
} else {
threadsToRemove.add(thread);
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove);
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final StorageCountersHolder sch = ds.storageCountersHolder;
if (sch != null) {
if (holder == null)
holder = new StorageCountersHolder();
sch.pushData(holder);
}
}
return holder;
}
use of com.orientechnologies.common.util.ORawPair in project orientdb by orientechnologies.
the class OPerformanceStatisticManager method fetchWriteCacheCounters.
/**
* Iterates over all live threads and accumulates write performance statics gathered form threads,
* also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.
*
* @return Aggregated write cache performance statistic
*/
private WritCacheCountersHolder fetchWriteCacheCounters() {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to countersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<ORawPair<Thread, PerformanceSnapshot>>(statistics.size());
final Collection<Thread> threadsToRemove = new ArrayList<Thread>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<Thread, PerformanceSnapshot>(thread, statistic.getSnapshot()));
}
WritCacheCountersHolder holder = null;
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
if (snapshot.writCacheCountersHolder != null) {
if (holder == null)
holder = new WritCacheCountersHolder();
snapshot.writCacheCountersHolder.pushData(holder);
}
} else {
threadsToRemove.add(thread);
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove);
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final WritCacheCountersHolder wch = ds.writCacheCountersHolder;
if (wch != null) {
if (holder == null)
holder = new WritCacheCountersHolder();
wch.pushData(holder);
}
}
return holder;
}
use of com.orientechnologies.common.util.ORawPair in project orientdb by orientechnologies.
the class OPerformanceStatisticManager method fetchSystemCounters.
/**
* Iterates over all live threads and accumulates performance statics gathered form threads on system level,
* also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.
*
* @param countersHolder Holder which is used to accumulate all performance statistic data
*/
private void fetchSystemCounters(PerformanceCountersHolder countersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
//will be aggregated to countersHolder
//To decrease inter thread communication delay we fetch snapshots first
//and only after that we aggregate data from immutable snapshots
final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<ORawPair<Thread, PerformanceSnapshot>>(statistics.size());
final Collection<Thread> threadsToRemove = new ArrayList<Thread>();
for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
final Thread thread = entry.getKey();
final OSessionStoragePerformanceStatistic statistic = entry.getValue();
snapshots.add(new ORawPair<Thread, PerformanceSnapshot>(thread, statistic.getSnapshot()));
}
for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
final Thread thread = pair.getFirst();
if (thread.isAlive()) {
final PerformanceSnapshot snapshot = pair.getSecond();
snapshot.performanceCountersHolder.pushData(countersHolder);
} else {
threadsToRemove.add(thread);
}
}
if (!threadsToRemove.isEmpty()) {
updateDeadThreadsStatistic(threadsToRemove);
}
final ImmutableStatistic ds = deadThreadsStatistic;
if (ds != null) {
final PerformanceCountersHolder dch = ds.countersHolder;
dch.pushData(countersHolder);
}
}
Aggregations