Search in sources :

Example 1 with SearcherTimer

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

the class ElapsedTime method detailedReport.

public String detailedReport() {
    Map<String, TimeTracker.SearcherTimer> raw = new LinkedHashMap<>();
    StringBuilder report = new StringBuilder();
    int preLen;
    report.append("Time use per searcher: ");
    for (TimeTracker t : tracks) {
        if (t.searcherTracking() == null) {
            continue;
        }
        SearcherTimer[] searchers = t.searcherTracking();
        for (SearcherTimer s : searchers) {
            SearcherTimer sum;
            if (raw.containsKey(s.getName())) {
                sum = raw.get(s.getName());
            } else {
                sum = new SearcherTimer(s.getName());
                raw.put(s.getName(), sum);
            }
            sum.merge(s);
        }
    }
    preLen = report.length();
    for (TimeTracker.SearcherTimer value : raw.values()) {
        if (report.length() > preLen) {
            report.append(",\n    ");
        }
        report.append(value.toString());
    }
    report.append(".");
    return report.toString();
}
Also used : SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer) LinkedHashMap(java.util.LinkedHashMap) SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer)

Example 2 with SearcherTimer

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

the class ElapsedTimeTestCase method testBasicBreakdown.

public void testBasicBreakdown() {
    TimeTracker t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
    t.injectTimeSource(new CreativeTimeSource(new long[] { 1L, 2L, 3L, 4L, 5L, 6L, 7L }));
    t.sampleSearch(0, true);
    t.sampleSearch(1, true);
    t.sampleSearch(2, true);
    t.sampleSearch(3, true);
    t.sampleSearchReturn(2, true, null);
    t.sampleSearchReturn(1, true, null);
    t.sampleSearchReturn(0, true, null);
    SearcherTimer[] searchers = t.searcherTracking();
    checkTiming(searchers);
}
Also used : TimeTracker(com.yahoo.search.statistics.TimeTracker) Searcher(com.yahoo.search.Searcher) SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer)

Example 3 with SearcherTimer

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

the class ElapsedTimeTestCase method testBasicBreakdownFullyWiredIn.

// This test is to make sure the other tests correctly simulate the call
// order into the TimeTracker
public void testBasicBreakdownFullyWiredIn() {
    Chain<? extends Searcher> chain = new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third"));
    Execution exec = new Execution(chain, Execution.Context.createContextStub());
    exec.timer().injectTimeSource(new CreativeTimeSource(SEARCH_TIMESEQUENCE));
    exec.context().setDetailedDiagnostics(true);
    exec.search(new Query());
    SearcherTimer[] searchers = exec.timer().searcherTracking();
    checkTiming(searchers);
}
Also used : Chain(com.yahoo.component.chain.Chain) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer)

Example 4 with SearcherTimer

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

the class ElapsedTimeTestCase method testMixedActivity.

public void testMixedActivity() {
    TimeTracker t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
    runSomeTraffic(t);
    SearcherTimer[] searchers = t.searcherTracking();
    assertEquals(Long.valueOf(1L), searchers[0].getInvoking(Activity.SEARCH));
    assertNull(searchers[0].getInvoking(Activity.FILL));
    assertEquals(Long.valueOf(2L), searchers[0].getReturning(Activity.SEARCH));
    assertEquals(Long.valueOf(2L), searchers[0].getReturning(Activity.FILL));
    assertEquals(Long.valueOf(2L), searchers[1].getInvoking(Activity.SEARCH));
    assertEquals(Long.valueOf(2L), searchers[1].getInvoking(Activity.FILL));
    assertEquals(Long.valueOf(2L), searchers[1].getReturning(Activity.SEARCH));
    assertEquals(Long.valueOf(2L), searchers[1].getReturning(Activity.FILL));
    assertEquals(Long.valueOf(2L), searchers[2].getInvoking(Activity.SEARCH));
    assertEquals(Long.valueOf(2L), searchers[2].getInvoking(Activity.FILL));
    assertNull(searchers[2].getReturning(Activity.SEARCH));
    assertNull(searchers[2].getReturning(Activity.FILL));
}
Also used : TimeTracker(com.yahoo.search.statistics.TimeTracker) Searcher(com.yahoo.search.Searcher) SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer)

Example 5 with SearcherTimer

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

the class ElapsedTimeTestCase method testBasicBreakdownReturnInsideSearchChain.

public void testBasicBreakdownReturnInsideSearchChain() {
    TimeTracker t = new TimeTracker(new Chain<Searcher>(new UselessSearcher("first"), new UselessSearcher("second"), new UselessSearcher("third")));
    t.injectTimeSource(new CreativeTimeSource(new long[] { 1L, 2L, 3L, 4L, 5L, 6L }));
    t.sampleSearch(0, true);
    t.sampleSearch(1, true);
    t.sampleSearch(2, true);
    t.sampleSearchReturn(2, true, null);
    t.sampleSearchReturn(1, true, null);
    t.sampleSearchReturn(0, true, null);
    SearcherTimer[] searchers = t.searcherTracking();
    assertEquals(Long.valueOf(1L), searchers[0].getInvoking(Activity.SEARCH));
    assertEquals(Long.valueOf(1L), searchers[1].getInvoking(Activity.SEARCH));
    assertEquals(Long.valueOf(1L), searchers[2].getInvoking(Activity.SEARCH));
    assertNull(searchers[2].getReturning(Activity.SEARCH));
    assertEquals(Long.valueOf(1L), searchers[1].getReturning(Activity.SEARCH));
    assertEquals(Long.valueOf(1L), searchers[0].getReturning(Activity.SEARCH));
}
Also used : TimeTracker(com.yahoo.search.statistics.TimeTracker) Searcher(com.yahoo.search.Searcher) SearcherTimer(com.yahoo.search.statistics.TimeTracker.SearcherTimer)

Aggregations

SearcherTimer (com.yahoo.search.statistics.TimeTracker.SearcherTimer)7 Searcher (com.yahoo.search.Searcher)4 TimeTracker (com.yahoo.search.statistics.TimeTracker)4 Chain (com.yahoo.component.chain.Chain)2 Query (com.yahoo.search.Query)2 Execution (com.yahoo.search.searchchain.Execution)2 Result (com.yahoo.search.Result)1 LinkedHashMap (java.util.LinkedHashMap)1