use of com.orientechnologies.orient.core.storage.impl.local.statistic.OSessionStoragePerformanceStatistic 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);
}
}
use of com.orientechnologies.orient.core.storage.impl.local.statistic.OSessionStoragePerformanceStatistic in project orientdb by orientechnologies.
the class LocalCreateBinaryDocumentSpeedTest method cycle.
@Override
@Test(enabled = false)
public void cycle() {
final OStorage storage = database.getStorage();
((OAbstractPaginatedStorage) storage).startGatheringPerformanceStatisticForCurrentThread();
record = new ORecordBytes(database, payload);
record.save();
if (data.getCyclesDone() == data.getCycles() - 1)
database.commit();
OSessionStoragePerformanceStatistic sessionStoragePerformanceStatistic = ((OAbstractPaginatedStorage) storage).completeGatheringPerformanceStatisticForCurrentThread();
System.out.println(sessionStoragePerformanceStatistic.toDocument().toJSON("prettyPrint"));
}
Aggregations