public byte[] toStream(final ORecord iRecord, boolean iOnlyDelta) { final long timer = PROFILER.startChrono(); try { return toString(iRecord, new StringBuilder(2048), null, iOnlyDelta, true).toString().getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw OException.wrapException(new OSchemaException("error encoding string"), e); } finally { PROFILER.stopChrono(PROFILER.getProcessMetric("serializer.record.string.toStream"), "Serialize record to stream", timer); } }
@Override public ORecord fromStream(final byte[] iSource, final ORecord iRecord, final String[] iFields) { final long timer = PROFILER.startChrono(); try { return fromString(new String(iSource,"UTF-8"), iRecord, iFields); } catch (UnsupportedEncodingException e) { throw OException.wrapException(new OSchemaException("Error reading record"),e); } finally { PROFILER .stopChrono(PROFILER.getProcessMetric("serializer.record.string.fromStream"), "Deserialize record from stream", timer); } }
private void evict() { final long start = Orient.instance().getProfiler().startChrono(); final int initialSize = lruList.size(); int closedFiles = 0; while (lruList.size() > openLimit) { //we may only close items in open state so we "peek" them first Iterator<OClosableEntry<K, V>> iterator = lruList.iterator(); boolean entryClosed = false; while (iterator.hasNext()) { OClosableEntry<K, V> entry = iterator.next(); if (entry.makeClosed()) { closedFiles++; iterator.remove(); entryClosed = true; countClosedFiles(); break; } } //there are no items in open state stop eviction if (!entryClosed) break; } if (closedFiles > 0) { OLogManager.instance().debug(this, "Reached maximum of opened files %d (max=%d), closed %d files. Consider to raise this limit by increasing the global setting '%s' and the OS limit on opened files per processor", initialSize, openLimit, closedFiles, OGlobalConfiguration.OPEN_FILES_LIMIT.getKey()); } Orient.instance().getProfiler() .stopChrono("disk.closeFiles", "Close the opened files because reached the configured limit", start); }
return; final long timer = PROFILER.startChrono();
@Deprecated public Object execute(final Map<Object, Object> iArgs) { final long start = Orient.instance().getProfiler().startChrono(); Object result; while (true) { try { if (callback != null) return callback.call(iArgs); final OCommandExecutorScript command = new OCommandExecutorScript(); command.parse(new OCommandScript(getLanguage(), getCode())); result = command.execute(iArgs); break; } catch (ONeedRetryException | ORetryQueryException ignore) { } } if (Orient.instance().getProfiler().isRecording()) Orient.instance().getProfiler().stopChrono("db." + ODatabaseRecordThreadLocal.instance().get().getName() + ".function.execute", "Time to execute a function", start, "db.*.function.execute"); return result; }
/** * {@inheritDoc} */ @Override public void freeze(final boolean throwException) { checkOpenness(); if (!(getStorage() instanceof OFreezableStorageComponent)) { OLogManager.instance().error(this, "Only local paginated storage supports freeze. If you are using remote client please use OServerAdmin instead", null); return; } final long startTime = Orient.instance().getProfiler().startChrono(); final OFreezableStorageComponent storage = getFreezableStorage(); if (storage != null) { storage.freeze(throwException); } Orient.instance().getProfiler() .stopChrono("db." + getName() + ".freeze", "Time to freeze the database", startTime, "db.*.freeze"); }
/** * {@inheritDoc} */ @Override public void freeze() { checkOpenness(); if (!(getStorage() instanceof OFreezableStorageComponent)) { OLogManager.instance().error(this, "Only local paginated storage supports freeze. " + "If you use remote client please use OServerAdmin instead", null); return; } final long startTime = Orient.instance().getProfiler().startChrono(); final OFreezableStorageComponent storage = getFreezableStorage(); if (storage != null) { storage.freeze(false); } Orient.instance().getProfiler() .stopChrono("db." + getName() + ".freeze", "Time to freeze the database", startTime, "db.*.freeze"); }
/** * {@inheritDoc} */ @Override public void release() { checkOpenness(); if (!(getStorage() instanceof OFreezableStorageComponent)) { OLogManager.instance().error(this, "Only local paginated storage supports release. If you are using remote client please use OServerAdmin instead", null); return; } final long startTime = Orient.instance().getProfiler().startChrono(); final OFreezableStorageComponent storage = getFreezableStorage(); if (storage != null) { storage.release(); } Orient.instance().getProfiler() .stopChrono("db." + getName() + ".release", "Time to release the database", startTime, "db.*.release"); }
public synchronized void load(ODatabaseDocumentInternal database) { final long timer = PROFILER.startChrono(); try { if (!loaded) { schema.load(database); indexManager.load(database); //The Immutable snapshot should be after index and schema that require and before everything else that use it schema.forceSnapshot(database); security.load(); functionLibrary.load(database); scheduler.load(database); sequenceLibrary.load(database); schema.onPostIndexManagement(); loaded = true; } } finally { PROFILER .stopChrono(PROFILER.getDatabaseMetric(database.getStorage().getName(), "metadata.load"), "Loading of database metadata", timer, "db.*.metadata.load"); } }
final long timer = Orient.instance().getProfiler().startChrono(); final long lockId = atomicOperationsManager.freezeAtomicOperations(null, null); try {
final long timer = Orient.instance().getProfiler().startChrono(); Map<String, Object> params = new HashMap<>(2);
private OStorageOperationResult<Integer> doUpdateRecord(final ORecordId rid, final boolean updateContent, byte[] content, final int version, final byte recordType, final ORecordCallback<Integer> callback, final OCluster cluster) { Orient.instance().getProfiler().startChrono(); try {
private OStorageOperationResult<Boolean> doDeleteRecord(final ORecordId rid, final int version, final OCluster cluster) { Orient.instance().getProfiler().startChrono(); try {
@Override public final void delete() { try { final long timer = Orient.instance().getProfiler().startChrono();
final long beginTime = Orient.instance().getProfiler().startChrono();
return; final long timer = PROFILER.startChrono();