net.lightbody.bmp.core.har.HarTimings Java Examples

The following examples show how to use net.lightbody.bmp.core.har.HarTimings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DCResponse.java    From Dream-Catcher with MIT License 6 votes vote down vote up
@Nullable
@Override
public Network.ResourceTiming getTiming() {
    HarTimings timings = harEntry.getTimings();

    Network.ResourceTiming resourceTiming = new Network.ResourceTiming();
    resourceTiming.requestTime = harEntry.getRequestTime();
    resourceTiming.proxyStart = timings.getWait();
    resourceTiming.proxyEnd = resourceTiming.proxyStart;
    resourceTiming.dnsStart = resourceTiming.proxyEnd;
    resourceTiming.dnsEnd = resourceTiming.dnsStart + timings.getDns();
    resourceTiming.connectStart = resourceTiming.dnsEnd;
    resourceTiming.connectEnd = resourceTiming.connectStart + timings.getConnect();
    resourceTiming.sslStart = resourceTiming.connectEnd;
    resourceTiming.sslEnd = resourceTiming.sslStart + timings.getSsl();
    resourceTiming.sendStart = resourceTiming.sslEnd;
    resourceTiming.sendEnd = resourceTiming.sendStart + timings.getSend();
    resourceTiming.receiveHeadersEnd = harEntry.getTotalTime();
    return resourceTiming;
}
 
Example #2
Source File: HttpConnectHarCaptureFilter.java    From CapturePacket with MIT License 5 votes vote down vote up
/**
 * Populates timing information in the specified harEntry for failed rquests. Populates as much timing information
 * as possible, up to the point of failure.
 *
 * @param harEntry HAR entry to populate timing information in
 */
private void populateTimingsForFailedCONNECT(HarEntry harEntry) {
    HarTimings timings = harEntry.getTimings();

    if (connectionQueuedNanos > 0L && dnsResolutionStartedNanos > 0L) {
        timings.setBlocked(dnsResolutionStartedNanos - connectionQueuedNanos, TimeUnit.NANOSECONDS);
    }

    if (dnsResolutionStartedNanos > 0L && dnsResolutionFinishedNanos > 0L) {
        timings.setDns(dnsResolutionFinishedNanos - dnsResolutionStartedNanos, TimeUnit.NANOSECONDS);
    }

    if (connectionStartedNanos > 0L && connectionSucceededTimeNanos > 0L) {
        timings.setConnect(connectionSucceededTimeNanos - connectionStartedNanos, TimeUnit.NANOSECONDS);

        if (sslHandshakeStartedNanos > 0L) {
            timings.setSsl(connectionSucceededTimeNanos - this.sslHandshakeStartedNanos, TimeUnit.NANOSECONDS);
        }
    }

    if (sendStartedNanos > 0L && sendFinishedNanos >= 0L) {
        timings.setSend(sendFinishedNanos - sendStartedNanos, TimeUnit.NANOSECONDS);
    }

    if (sendFinishedNanos > 0L && responseReceiveStartedNanos >= 0L) {
        timings.setWait(responseReceiveStartedNanos - sendFinishedNanos, TimeUnit.NANOSECONDS);
    }

    // since this method is for HTTP CONNECT failures only, we can't populate a "received" time, since that would
    // require the CONNECT to be successful, in which case this method wouldn't be called.
}
 
Example #3
Source File: HttpConnectHarCaptureFilter.java    From Dream-Catcher with MIT License 5 votes vote down vote up
/**
 * Populates timing information in the specified harEntry for failed rquests. Populates as much timing information
 * as possible, up to the point of failure.
 *
 * @param harEntry HAR entry to populate timing information in
 */
private void populateTimingsForFailedCONNECT(HarEntry harEntry) {
    HarTimings timings = harEntry.getTimings();

    if (connectionQueuedNanos > 0L && dnsResolutionStartedNanos > 0L) {
        timings.setBlocked(dnsResolutionStartedNanos - connectionQueuedNanos, TimeUnit.NANOSECONDS);
    }

    if (dnsResolutionStartedNanos > 0L && dnsResolutionFinishedNanos > 0L) {
        timings.setDns(dnsResolutionFinishedNanos - dnsResolutionStartedNanos, TimeUnit.NANOSECONDS);
    }

    if (connectionStartedNanos > 0L && connectionSucceededTimeNanos > 0L) {
        timings.setConnect(connectionSucceededTimeNanos - connectionStartedNanos, TimeUnit.NANOSECONDS);

        if (sslHandshakeStartedNanos > 0L) {
            timings.setSsl(connectionSucceededTimeNanos - this.sslHandshakeStartedNanos, TimeUnit.NANOSECONDS);
        }
    }

    if (sendStartedNanos > 0L && sendFinishedNanos >= 0L) {
        timings.setSend(sendFinishedNanos - sendStartedNanos, TimeUnit.NANOSECONDS);
    }

    if (sendFinishedNanos > 0L && responseReceiveStartedNanos >= 0L) {
        timings.setWait(responseReceiveStartedNanos - sendFinishedNanos, TimeUnit.NANOSECONDS);
    }

    // since this method is for HTTP CONNECT failures only, we can't populate a "received" time, since that would
    // require the CONNECT to be successful, in which case this method wouldn't be called.
}
 
Example #4
Source File: HttpConnectHarCaptureFilter.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
/**
 * Populates timing information in the specified harEntry for failed rquests. Populates as much timing information
 * as possible, up to the point of failure.
 *
 * @param harEntry HAR entry to populate timing information in
 */
private void populateTimingsForFailedCONNECT(HarEntry harEntry) {
    HarTimings timings = harEntry.getTimings();

    if (connectionQueuedNanos > 0L && dnsResolutionStartedNanos > 0L) {
        timings.setBlocked(dnsResolutionStartedNanos - connectionQueuedNanos, TimeUnit.NANOSECONDS);
    }

    if (dnsResolutionStartedNanos > 0L && dnsResolutionFinishedNanos > 0L) {
        timings.setDns(dnsResolutionFinishedNanos - dnsResolutionStartedNanos, TimeUnit.NANOSECONDS);
    }

    if (connectionStartedNanos > 0L && connectionSucceededTimeNanos > 0L) {
        timings.setConnect(connectionSucceededTimeNanos - connectionStartedNanos, TimeUnit.NANOSECONDS);

        if (sslHandshakeStartedNanos > 0L) {
            timings.setSsl(connectionSucceededTimeNanos - this.sslHandshakeStartedNanos, TimeUnit.NANOSECONDS);
        }
    }

    if (sendStartedNanos > 0L && sendFinishedNanos >= 0L) {
        timings.setSend(sendFinishedNanos - sendStartedNanos, TimeUnit.NANOSECONDS);
    }

    if (sendFinishedNanos > 0L && responseReceiveStartedNanos >= 0L) {
        timings.setWait(responseReceiveStartedNanos - sendFinishedNanos, TimeUnit.NANOSECONDS);
    }

    // since this method is for HTTP CONNECT failures only, we can't populate a "received" time, since that would
    // require the CONNECT to be successful, in which case this method wouldn't be called.
}