@Override public void index(State state) { try { Profiler.Static.startThreadEvent(INDEX_EVENT_NAME, state); super.index(state); } finally { Profiler.Static.stopThreadEvent(); } }
@Override public void delete(State state) { try { Profiler.Static.startThreadEvent(DELETE_EVENT_NAME, state); super.delete(state); } finally { Profiler.Static.stopThreadEvent(); } }
@Override public void saveUnsafely(State state) { try { Profiler.Static.startThreadEvent(SAVE_UNSAFELY_EVENT_NAME, state); super.saveUnsafely(state); } finally { Profiler.Static.stopThreadEvent(); } }
private void startQueryEvent(String event, Query<?> query) { StackTraceElement caller = null; Profiler.Static.pauseThreadEvent(); try { StackTraceElement[] elements = new Throwable().getStackTrace(); for (int i = 2, length = elements.length; i < length; ++i) { StackTraceElement element = elements[i]; String className = element.getClassName(); Class<?> c = ObjectUtils.getClassByName(className); if (c == null || !(Database.class.isAssignableFrom(c) || Query.class.isAssignableFrom(c))) { caller = element; break; } } } finally { Profiler.Static.resumeThreadEvent(); } Object resolving = query.getOptions().get(State.REFERENCE_RESOLVING_QUERY_OPTION); if (resolving != null) { Profiler.Static.startThreadEvent( event + " (Reference Resolving)", resolving, query.getOptions().get(State.REFERENCE_FIELD_QUERY_OPTION), caller); } else { Profiler.Static.startThreadEvent(event, caller, query); } }