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();
}
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);
}
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);
}
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));
}
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));
}
Aggregations