refactor census_timestamp

pull/2668/head
Alistair Veitch 9 years ago
parent 0879df2755
commit f886985d2c
  1. 12
      include/grpc/census.h
  2. 8
      src/core/census/operation.c

@ -129,10 +129,14 @@ void census_set_trace_mask(int trace_mask);
each logical operation. */
/**
This structure (opaquely) represents a timestamp as used by census to
record the time at which an RPC operation begins.
This structure represents a timestamp as used by census to record the time
at which an operation begins.
*/
typedef struct census_timestamp census_timestamp;
typedef struct {
/* Use gpr_timespec for default implementation. High performance
* implementations should use a cycle-counter based timestamp. */
gpr_timespec ts;
} census_timestamp;
/**
Mark the beginning of an RPC operation. The information required to call the
@ -148,7 +152,7 @@ typedef struct census_timestamp census_timestamp;
@return A timestamp representing the operation start time.
*/
census_timestamp *census_start_rpc_op_timestamp(void);
census_timestamp census_start_rpc_op_timestamp(void);
/**
Represent functions to map RPC name ID to service/method names. Census

@ -34,7 +34,13 @@
/* TODO(aveitch): These are all placeholder implementations. */
census_timestamp *census_start_rpc_op_timestamp(void) { return NULL; }
census_timestamp census_start_rpc_op_timestamp(void) {
census_timestamp ct;
/* TODO(aveitch): assumes gpr_timespec implementation of census_timestamp. */
ct.ts = gpr_now(GPR_CLOCK_MONOTONIC);
return ct;
}
census_context *census_start_client_rpc_op(
const census_context *context, gpr_int64 rpc_name_id,
const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask,

Loading…
Cancel
Save