Search in sources :

Example 1 with ElapsedTime

use of com.yahoo.search.statistics.ElapsedTime in project vespa by vespa-engine.

the class ElapsedTimeTestCase method testMultiSearchAndPing.

public void testMultiSearchAndPing() {
    TimeTracker t = new TimeTracker(null);
    t.injectTimeSource(new CreativeTimeSource(new long[] { 1L, 4L, 16L, 32L, 64L, 128L, 256L }));
    Query q = new Query();
    Result r = new Result(q);
    t.sampleSearch(0, false);
    t.samplePing(0, false);
    t.sampleSearch(0, false);
    t.samplePing(0, false);
    t.sampleSearch(0, false);
    t.sampleFill(0, false);
    t.sampleSearchReturn(0, false, r);
    assertEquals(1L, t.first());
    assertEquals(256L, t.last());
    assertEquals(128L, t.firstFill());
    assertEquals(83L, t.searchTime());
    assertEquals(128L, t.fillTime());
    assertEquals(44L, t.pingTime());
    assertEquals(255L, t.totalTime());
    ElapsedTime e = new ElapsedTime();
    e.add(t);
    e.add(t);
    // multiple adds is supposed to be safe
    assertEquals(255L, t.totalTime());
    TimeTracker tx = new TimeTracker(null);
    tx.injectTimeSource(new CreativeTimeSource(new long[] { 1L, 2L, 3L, 4L }));
    Query qx = new Query();
    Result rx = new Result(qx);
    tx.sampleSearch(0, false);
    tx.sampleFill(0, false);
    tx.samplePing(0, false);
    tx.sampleSearchReturn(0, false, rx);
    e.add(tx);
    assertEquals(258L, e.totalTime());
    assertEquals(129L, e.fillTime());
    assertEquals(2L, e.firstFill());
}
Also used : Query(com.yahoo.search.Query) TimeTracker(com.yahoo.search.statistics.TimeTracker) ElapsedTime(com.yahoo.search.statistics.ElapsedTime) Result(com.yahoo.search.Result)

Example 2 with ElapsedTime

use of com.yahoo.search.statistics.ElapsedTime in project vespa by vespa-engine.

the class ElapsedTimeTestCase method testReportGeneration.

public void testReportGeneration() {
    TimeTracker t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
    runSomeTraffic(t);
    ElapsedTime elapsed = new ElapsedTime();
    elapsed.add(t);
    t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
    runSomeTraffic(t);
    elapsed.add(t);
    assertEquals(true, elapsed.hasDetailedData());
    assertEquals("Time use per searcher:" + " first(QueryProcessing(SEARCH: 2 ms), ResultProcessing(SEARCH: 4 ms, FILL: 4 ms)),\n" + "    second(QueryProcessing(SEARCH: 4 ms, FILL: 4 ms), ResultProcessing(SEARCH: 4 ms, FILL: 4 ms)),\n" + "    third(QueryProcessing(SEARCH: 4 ms, FILL: 4 ms), ResultProcessing()).", elapsed.detailedReport());
}
Also used : Chain(com.yahoo.component.chain.Chain) TimeTracker(com.yahoo.search.statistics.TimeTracker) Searcher(com.yahoo.search.Searcher) ElapsedTime(com.yahoo.search.statistics.ElapsedTime)

Example 3 with ElapsedTime

use of com.yahoo.search.statistics.ElapsedTime in project vespa by vespa-engine.

the class SearchHandler method traceExecutionTimes.

private void traceExecutionTimes(Query query, Result result) {
    if (query.getTraceLevel() < 3)
        return;
    ElapsedTime elapsedTime = result.getElapsedTime();
    long now = System.currentTimeMillis();
    if (elapsedTime.firstFill() != 0) {
        query.trace("Query time " + query + ": " + (elapsedTime.firstFill() - elapsedTime.first()) + " ms", false, 3);
        query.trace("Summary fetch time " + query + ": " + (now - elapsedTime.firstFill()) + " ms", false, 3);
    } else {
        query.trace("Total search time " + query + ": " + (now - elapsedTime.first()) + " ms", false, 3);
    }
}
Also used : ElapsedTime(com.yahoo.search.statistics.ElapsedTime)

Example 4 with ElapsedTime

use of com.yahoo.search.statistics.ElapsedTime in project vespa by vespa-engine.

the class Result method clone.

/**
 * Deep clones this result - copies are made of all hits and subgroups of hits,
 * <i>but not of the query referenced by this</i>.
 */
public Result clone() {
    Result resultClone = (Result) super.clone();
    resultClone.hits = hits.clone();
    // TODO: Kind of wrong
    resultClone.getTemplating().setRenderer(null);
    resultClone.setElapsedTime(new ElapsedTime());
    return resultClone;
}
Also used : ElapsedTime(com.yahoo.search.statistics.ElapsedTime)

Aggregations

ElapsedTime (com.yahoo.search.statistics.ElapsedTime)4 TimeTracker (com.yahoo.search.statistics.TimeTracker)2 Chain (com.yahoo.component.chain.Chain)1 Query (com.yahoo.search.Query)1 Result (com.yahoo.search.Result)1 Searcher (com.yahoo.search.Searcher)1