protected void updateProfiler(final OCommandContext iContext, final OIndex<?> index, final List<Object> keyParams, final OIndexDefinition indexDefinition) { if (iContext.isRecordingMetrics()) iContext.updateMetric("compositeIndexUsed", +1); final OProfiler profiler = Orient.instance().getProfiler(); if (profiler.isRecording()) { profiler.updateCounter(profiler.getDatabaseMetric(index.getDatabaseName(), "query.indexUsed"), "Used index in query", +1); int params = indexDefinition.getParamCount(); if (params > 1) { final String profiler_prefix = profiler.getDatabaseMetric(index.getDatabaseName(), "query.compositeIndexUsed"); profiler.updateCounter(profiler_prefix, "Used composite index in query", +1); profiler.updateCounter(profiler_prefix + "." + params, "Used composite index in query with " + params + " params", +1); profiler.updateCounter(profiler_prefix + "." + params + '.' + keyParams.size(), "Used composite index in query with " + params + " params and " + keyParams.size() + " keys", +1); } } }
protected void revertProfiler(final OCommandContext iContext, final OIndex<?> index, final List<Object> keyParams, final OIndexDefinition indexDefinition) { if (iContext.isRecordingMetrics()) { iContext.updateMetric("compositeIndexUsed", -1); } final OProfiler profiler = Orient.instance().getProfiler(); if (profiler.isRecording()) { profiler.updateCounter(profiler.getDatabaseMetric(index.getDatabaseName(), "query.indexUsed"), "Used index in query", -1); int params = indexDefinition.getParamCount(); if (params > 1) { final String profiler_prefix = profiler.getDatabaseMetric(index.getDatabaseName(), "query.compositeIndexUsed"); profiler.updateCounter(profiler_prefix, "Used composite index in query", -1); profiler.updateCounter(profiler_prefix + "." + params, "Used composite index in query with " + params + " params", -1); profiler.updateCounter(profiler_prefix + "." + params + '.' + keyParams.size(), "Used composite index in query with " + params + " params and " + keyParams.size() + " keys", -1); } } }
/** * Looks up for record in cache by it's identifier. Optionally look up in secondary cache and update primary with found record * * @param rid * unique identifier of record * @return record stored in cache if any, otherwise - {@code null} */ public ORecord findRecord(final ORID rid) { ORecord record; record = underlying.get(rid); if (record != null) Orient.instance().getProfiler().updateCounter(CACHE_HIT, "Record found in Level1 Cache", 1L, "db.*.cache.level1.cache.found"); else Orient.instance().getProfiler().updateCounter(CACHE_MISS, "Record not found in Level1 Cache", 1L, "db.*.cache.level1.cache.notFound"); return record; }
/** * Register statistic information about usage of index in {@link OProfilerStub}. * * @param index which usage is registering. */ private void updateStatistic(OIndex<?> index) { final OProfiler profiler = Orient.instance().getProfiler(); if (profiler.isRecording()) { Orient.instance().getProfiler() .updateCounter(profiler.getDatabaseMetric(index.getDatabaseName(), "query.indexUsed"), "Used index in query", +1); final int paramCount = index.getDefinition().getParamCount(); if (paramCount > 1) { final String profiler_prefix = profiler.getDatabaseMetric(index.getDatabaseName(), "query.compositeIndexUsed"); profiler.updateCounter(profiler_prefix, "Used composite index in query", +1); profiler .updateCounter(profiler_prefix + "." + paramCount, "Used composite index in query with " + paramCount + " params", +1); } } }
protected void revertSubclassesProfiler(final OCommandContext iContext, int num) { final OProfiler profiler = Orient.instance().getProfiler(); if (profiler.isRecording()) { profiler.updateCounter(profiler.getDatabaseMetric(getDatabase().getName(), "query.indexUseAttemptedAndReverted"), "Reverted index usage in query", num); } }
if (profiler.isRecording()) { profiler .updateCounter(profiler.getDatabaseMetric(database.getName(), "query.indexUsed"), "Used index in query", +1);
profiler.updateCounter(profiler.getDatabaseMetric(databaseName, "queryCache.hit"), "Results returned by Query Cache", +1); .updateCounter(profiler.getDatabaseMetric(databaseName, "queryCache.miss"), "Results not returned by Query Cache", +1);