aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/container/handler/Timing.java
blob: 2f7a882a2adbb59d5e8c9553ba71c4203238b1fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.handler;


/**
 * <p>A wrapper for timing of events in the course of a query evaluation. Advanced
 * database searches and similar could use these structures as well.</p>
 *
 * <p>Not adding this object will lead to less exact entries in the query
 * log. It is legal to set only queryStartTime and set the other values
 * to zero.</p>
 *
 * <p>If you do not understand the fields, just avoid creating this object
 * in you handler.</p>
 *
 * @author Steinar Knutsen
 */
public class Timing {

    private final long summaryStartTime;

    private final long queryStartTime;

    private final long timeout;

    /**
     * Do consider using
     * com.yahoo.search.handler.SearchResponse.createTiming(Query, Result) if
     * instead of this constructor if you are creating a Timing instance in a
     * search context.
     *
     * @param summaryStartTime when fetching of document contents started
     * @param queryStartTime when the request started
     * @param timeout maximum allowed lifetime of the request
     */
    public Timing(long summaryStartTime, long ignored, long queryStartTime, long timeout) {
        super();
        this.summaryStartTime = summaryStartTime;
        this.queryStartTime = queryStartTime;
        this.timeout = timeout;
    }

    /**
     * Summary start time is when the fetching of hit/document contents
     * start. (As opposed to just analyzing hit relevancies.)
     *
     * @return the start time of summary fetching or 0
     */
    public long getSummaryStartTime() {
        return summaryStartTime;
    }

    /**
     * This is the start of the server's evaluation of a query
     * or request, after full reception of it through the network.
     * It will usually be intialized implicitly from the value
     * generated by the com.yahoo.search.Query constructor.
     *
     * @return the starting time of query construction
     */
    public long getQueryStartTime() {
        return queryStartTime;
    }

    /**
     * This is the timeout that was given to this query.
     *
     * @return The timeout given allowed to the query.
     */
    public long getTimeout() {
        return timeout;
    }

}