TSHttpTxnMilestoneGet

Get a specified milestone timer value for the current transaction.

概要

#include <ts/ts.h>
TSReturnCode TSHttpTxnMilestoneGet(TSHttpTxn txnp, TSMilestonesType milestone, TSHRTime *time)

解説

TSHttpTxnMilestoneGet() will fetch a specific milestone timer value for the transaction txnp. These timers are calculated during the lifetime of a transaction and are measured in nanoseconds from the beginning of the transaction. time is used a pointer to storage to update if the call is successful.

enum TSMilestonesType

An enumeration of the valid indices of transaction milestone data.

enumerator TS_MILESTONE_SM_START

Transaction state machine is initialized.

enumerator TS_MILESTONE_UA_BEGIN

The client connection is accepted.

enumerator TS_MILESTONE_UA_READ_HEADER_DONE

The request header from the client has been read and parsed.

enumerator TS_MILESTONE_CACHE_OPEN_READ_BEGIN

Initiate read of the cache.

enumerator TS_MILESTONE_CACHE_OPEN_READ_END

Initial cache read has resolved.

enumerator TS_MILESTONE_CACHE_OPEN_WRITE_BEGIN

Start open for cache write.

enumerator TS_MILESTONE_CACHE_OPEN_WRITE_END

Cache has been opened for write.

enumerator TS_MILESTONE_DNS_LOOKUP_BEGIN

Initiate host resolution in HostDB

enumerator TS_MILESTONE_DNS_LOOKUP_END

Host resolution resolves.

enumerator TS_MILESTONE_SERVER_FIRST_CONNECT

First time origin server connect attempted or shared session attached.

enumerator TS_MILESTONE_SERVER_CONNECT

Most recent time origin server connect attempted or shared session attached.

enumerator TS_MILESTONE_SERVER_CONNECT_END

More recent time a connection attempt was resolved.

enumerator TS_MILESTONE_SERVER_BEGIN_WRITE

First byte is written to the origin server connection.

enumerator TS_MILESTONE_SERVER_FIRST_READ

First byte is read from connection to origin server.

enumerator TS_MILESTONE_SERVER_READ_HEADER_DONE

Origin server response has been read and parsed.

enumerator TS_MILESTONE_UA_BEGIN_WRITE

The response header write to the client starts.

enumerator TS_MILESTONE_SERVER_CLOSE

Last I/O activity on origin server connection.

enumerator TS_MILESTONE_UA_CLOSE

Last I/O activity on the client socket, or connection abort.

enumerator TS_MILESTONE_SM_FINISH

Transaction has finished, state machine final logging has started.

enumerator TS_MILESTONE_PLUGIN_ACTIVE

Amount of time plugins were active (running plugin code).

enumerator TS_MILESTONE_PLUGIN_TOTAL

Amount of time spent in or waiting for plugins.

enumerator TS_MILESTONE_TLS_HANDSHAKE_START

Timestamp when the server starts the TLS handshake. 0 if no handshake is performed (connection reuse).

enumerator TS_MILESTONE_TLS_HANDSHAKE_END

Timestamp when the server completes the TLS handshake. 0 if no handshake is performed (connection reuse).

enumerator TS_MILESTONE_LAST_ENTRY

A pseudo index which is set to be one more than the last valid index. This is useful for looping over the data.

  • The server connect times predate the transmission of the SYN packet. That is, before a connection to the origin server is completed.

  • A connection attempt is resolved when no more connection related activity remains to be done, and the connection is either established or has failed.

  • TS_MILESTONE_UA_CLOSE and TS_MILESTONE_SERVER_CLOSE are updated continuously during the life of the transaction, every time there is I/O activity. The updating stops when the corresponding connection is closed, leaving the last I/O time as the final value.

  • The cache OPEN milestones time only the initial setup, the open, not the full read or write.

  • TS_MILESTONE_PLUGIN_ACTIVE and TS_MILESTONE_PLUGIN_TOTAL are different from the other milestones as they measure elapsed time, not event time. The value is the elapsed time plus TS_MILESTONE_SM_START. This was decided to be more convenient because then these milestones can be handled / displayed in the same way as the other milestones, as offsets from TS_MILESTONE_SM_START.

    TS_MILESTONE_PLUGIN_ACTIVE value is the amount of time the plugin was active, that is performing computation. TS_MILESTONE_PLUGIN_TOTAL is the wall time which includes any time the transaction was blocked while a plugin was active. For instance if a plugin waits on an external event, that waiting time will be in TS_MILESTONE_PLUGIN_TOTAL but not in TS_MILESTONE_PLUGIN_ACTIVE.

Return Values

TS_SUCCESS if successful and time was updated, otherwise TS_ERROR.

参照

TSAPI(3ts)