class RunningQueryTimingImpl implements RunningQueryTiming {

    @Override
    public boolean shouldReturnPartialResults(int pageSize, int maxPageSize, long timeInCall) {
        
        // only return prematurely if we have at least 1 result
        if (pageSize > 0) {
            
            // if after the page size short circuit check time
            if (timeInCall >= pageSizeShortCircuitCheckTimeMs) {
                float percentTimeComplete = (float) timeInCall / (float) (this.maxCallMs);
                float percentResultsComplete = (float) pageSize / (float) maxPageSize;
                // if the percent results complete is less than the percent time complete, then break out
                if (percentResultsComplete < percentTimeComplete) {
                    return true;
                }
            }
            
            // if after the page short circuit timeout, then break out
            if (timeInCall >= this.pageShortCircuitTimeoutMs) {
                return true;
            }
            
        }
        
        return false;
    }

    public  RunningQueryTimingImpl(QueryExpirationConfiguration conf, int pageTimeout);
    public  RunningQueryTimingImpl(long maxCallMs, long pageSizeShortCircuitCheckTimeMs, long pageShortCircuitTimeoutMs);

}