Codota Logo
Microtiming.isEnabled
Code IndexAdd Codota to your IDE (free)

How to use
isEnabled
method
in
sirius.kernel.health.Microtiming

Best Java code snippets using sirius.kernel.health.Microtiming.isEnabled (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: com.scireum/sirius-db

private void handleTracingAndReporting(String collection, Watch w) {
  mongo.callDuration.addValue(w.elapsedMillis());
  if (Microtiming.isEnabled()) {
    w.submitMicroTiming(KEY_MONGO, "FIND ALL - " + collection + ": " + filterObject);
  }
  traceIfRequired(collection, w);
}
origin: com.scireum/sirius-kernel

@Override
public void execute(Output output, String... params) throws Exception {
  if (params.length == 1 && Strings.isFilled(params[0])) {
    parseParameters(output, params[0]);
  } else {
    if (Microtiming.isEnabled()) {
      generateOutput(output);
    } else {
      output.line("Microtiming is disabled! Use: 'timing +' to enable.");
    }
  }
}
origin: com.scireum/sirius-db

/**
 * Executes one or more Redis commands and returns a value of the given type.
 *
 * @param description a description of the actions performed used for debugging and tracing
 * @param task        the actual task to perform using redis
 * @param <T>         the generic type of the result
 * @return a result computed by <tt>task</tt>
 */
public <T> T query(Supplier<String> description, Function<Jedis, T> task) {
  Watch w = Watch.start();
  try (Operation op = new Operation(description, Duration.ofSeconds(10)); Jedis redis = getConnection()) {
    return task.apply(redis);
  } catch (Exception e) {
    throw Exceptions.handle(Redis.LOG, e);
  } finally {
    redisInstance.callDuration.addValue(w.elapsedMillis());
    if (Microtiming.isEnabled()) {
      w.submitMicroTiming("redis", description.get());
    }
  }
}
origin: com.scireum/sirius-kernel

private void enableTiming(Output output) {
  if (Microtiming.isEnabled()) {
    generateOutput(output);
    Microtiming.setEnabled(false);
    output.line("Resetting Microtiming...");
  } else {
    output.line("Enabling Microtiming...");
  }
  Microtiming.setEnabled(true);
}
origin: com.scireum/sirius-search

private void delete(boolean force) {
  try {
    if (forceFail) {
      return;
    }
    Watch w = Watch.start();
    deleteByIteration(force);
    if (Microtiming.isEnabled()) {
      w.submitMicroTiming("ES", "DELETE: " + toString(true));
    }
  } catch (Exception e) {
    throw Exceptions.handle(IndexAccess.LOG, e);
  }
}
origin: com.scireum/sirius-db

@Override
public void truncate() {
  Watch w = Watch.start();
  Compiler compiler = compileDELETE();
  try {
    try (Connection c = db.getConnection()) {
      try (PreparedStatement stmt = compiler.prepareStatement(c)) {
        stmt.executeUpdate();
      }
    } finally {
      if (Microtiming.isEnabled()) {
        w.submitMicroTiming("OMA", compiler.toString());
      }
    }
  } catch (Exception e) {
    throw queryError(compiler, e);
  }
}
origin: com.scireum/sirius-db

if (Microtiming.isEnabled()) {
  w.submitMicroTiming(KEY_MONGO,
            "AGGREGATE - " + collection + "." + field + " (" + operator + "): " + filterObject);
origin: com.scireum/sirius-db

/**
 * Counts the number of documents in the result of the given query.
 * <p>
 * Note that limits are ignored for this query.
 *
 * @param collection the collection to search in
 * @return the number of documents found
 */
public long countIn(String collection) {
  Watch w = Watch.start();
  try {
    return mongo.db().getCollection(collection).count(filterObject);
  } finally {
    mongo.callDuration.addValue(w.elapsedMillis());
    if (Microtiming.isEnabled()) {
      w.submitMicroTiming(KEY_MONGO, "COUNT - " + collection + ": " + filterObject);
    }
    traceIfRequired(collection, w);
  }
}
origin: com.scireum/sirius-db

  /**
   * Executes the insert statement into the given collection.
   *
   * @param collection the collection to insert the document into
   * @return the inserted document
   */
  public Doc into(String collection) {
    if (Mongo.LOG.isFINE()) {
      Mongo.LOG.FINE("INSERT: %s\nObject: %s", collection, obj);
    }

    Watch w = Watch.start();

    mongo.db().getCollection(collection).insertOne(obj);
    mongo.callDuration.addValue(w.elapsedMillis());
    if (Microtiming.isEnabled()) {
      w.submitMicroTiming("mongo", "INSERT - " + collection + ": " + obj);
    }
    return new Doc(obj);
  }
}
origin: com.scireum/sirius-db

@Override
public long count() {
  Watch w = Watch.start();
  Compiler compiler = compileCOUNT();
  try {
    try (Connection c = db.getConnection()) {
      return execCount(compiler, c);
    } finally {
      if (Microtiming.isEnabled()) {
        w.submitMicroTiming("OMA", compiler.toString());
      }
    }
  } catch (Exception e) {
    throw queryError(compiler, e);
  }
}
origin: com.scireum/sirius-db

/**
 * Executes the delete statement on the given collection.
 *
 * @param collection the name of the collection to delete documents from
 * @return the result of the delete operation
 */
public DeleteResult singleFrom(String collection) {
  Watch w = Watch.start();
  try {
    if (Mongo.LOG.isFINE()) {
      Mongo.LOG.FINE("DELETE: %s\nFilter: %s", collection, filterObject);
    }
    return mongo.db().getCollection(collection).deleteOne(filterObject);
  } finally {
    mongo.callDuration.addValue(w.elapsedMillis());
    if (Microtiming.isEnabled()) {
      w.submitMicroTiming("mongo", "DELETE - " + collection + ": " + filterObject);
    }
    traceIfRequired(collection, w);
  }
}
origin: com.scireum/sirius-db

if (Microtiming.isEnabled()) {
  w.submitMicroTiming(KEY_MONGO, "FIND ONE - " + collection + ": " + filterObject);
origin: com.scireum/sirius-search

/**
 * Internal execution of the query along with the transformation of the result for a count of entities
 *
 * @param builder the completed query
 * @return the result of the query
 */
protected long transformCount(SearchRequestBuilder builder) {
  Watch w = Watch.start();
  SearchResponse res = builder.execute().actionGet();
  if (IndexAccess.LOG.isFINE()) {
    IndexAccess.LOG.FINE("COUNT: %s.%s: SUCCESS: %d",
               indexAccess.getIndex(clazz),
               indexAccess.getDescriptor(clazz).getType(),
               res.getHits().getTotalHits());
  }
  if (Microtiming.isEnabled()) {
    w.submitMicroTiming("ES", "COUNT: " + toString(true));
  }
  return res.getHits().getTotalHits();
}
origin: com.scireum/sirius-db

  /**
   * Executes the delete statement on the given collection.
   *
   * @param collection the name of the collection to delete documents from
   * @return the result of the delete operation
   */
  public DeleteResult manyFrom(String collection) {
    Watch w = Watch.start();
    try {
      if (Mongo.LOG.isFINE()) {
        Mongo.LOG.FINE("DELETE: %s\nFilter: %s", collection, filterObject);
      }

      return mongo.db().getCollection(collection).deleteMany(filterObject);
    } finally {
      mongo.callDuration.addValue(w.elapsedMillis());
      if (Microtiming.isEnabled()) {
        w.submitMicroTiming("mongo", "DELETE - " + collection + ": " + filterObject);
      }
      traceIfRequired(collection, w);
    }
  }
}
origin: com.scireum/sirius-db

@Override
public void iterate(Function<E, Boolean> handler) {
  Compiler compiler = compileSELECT();
  try {
    Watch w = Watch.start();
    try (Connection c = db.getConnection(); PreparedStatement stmt = compiler.prepareStatement(c)) {
      Limit limit = getLimit();
      boolean nativeLimit = db.hasCapability(Capability.LIMIT);
      tuneStatement(stmt, limit, nativeLimit);
      try (ResultSet rs = stmt.executeQuery()) {
        execIterate(handler, compiler, limit, nativeLimit, rs);
      }
    } finally {
      if (Microtiming.isEnabled()) {
        w.submitMicroTiming("OMA", compiler.toString());
      }
    }
  } catch (Exception e) {
    throw queryError(compiler, e);
  }
}
origin: com.scireum/sirius-db

/**
 * Executes the update on the given collection.
 *
 * @param collection the collection to update
 * @return the result of the update
 */
public UpdateResult executeFor(String collection) {
  Document updateObject = prepareUpdate(collection);
  Watch w = Watch.start();
  try {
    if (Mongo.LOG.isFINE()) {
      Mongo.LOG.FINE("UPDATE: %s\nFilter: %s\n Update:%s", collection, filterObject, updateObject);
    }
    UpdateOptions updateOptions = new UpdateOptions().upsert(this.upsert);
    if (many) {
      return mongo.db().getCollection(collection).updateMany(filterObject, updateObject, updateOptions);
    } else {
      return mongo.db().getCollection(collection).updateOne(filterObject, updateObject, updateOptions);
    }
  } finally {
    mongo.callDuration.addValue(w.elapsedMillis());
    if (Microtiming.isEnabled()) {
      w.submitMicroTiming("mongo", "UPDATE - " + collection + ": " + filterObject);
    }
    traceIfRequired(collection, w);
  }
}
origin: com.scireum/sirius-db

} finally {
  elastic.callDuration.addValue(w.elapsedMillis());
  if (Microtiming.isEnabled()) {
    w.submitMicroTiming("elastic", method + ": " + uri);
origin: com.scireum/sirius-search

             searchResponse.getTook().millis());
if (Microtiming.isEnabled()) {
  w.submitMicroTiming("ES", "FIRST: " + toString(true));
origin: com.scireum/sirius-search

             searchResponse.getTook().millis());
if (Microtiming.isEnabled()) {
  w.submitMicroTiming("ES", "LIST: " + toString(true));
origin: com.scireum/sirius-search

if (Microtiming.isEnabled()) {
  w.submitMicroTiming("ES", "RAW: " + toString(true));
sirius.kernel.healthMicrotimingisEnabled

Javadoc

Checks whether the timing is enabled.

Popular methods of Microtiming

  • getLastReset
    Returns the timestamp of the last reset
  • getTimings
    Returns a list of recorded timings. This will only report timings, which changed since the last call
  • setEnabled
    Enables/Disables the timing.
  • submit
    Submits a new timing for the given key. Adds the average to the "live set" which will be output on t

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Path (java.nio.file)
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now