Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/traffic_cop/traffic_cop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ static int init_sleep_time = cop_sleep_time; // 10 sec
#define MANAGER_FLAP_RETRY_MSEC 60000 // if flapping, don't try to restart until after this retry duration
static bool manager_flapping = false; // is the manager flapping?
static int manager_flap_count = 0; // how many times has the manager flapped?
static ink_hrtime manager_flap_interval_start_time = 0; // first time we attempted to start the manager in past little while)
static ink_hrtime manager_flap_retry_start_time = 0; // first time we attempted to start the manager in past little while)
static ts_hrtick manager_flap_interval_start_time = 0; // first time we attempted to start the manager in past little while)
static ts_hrtick manager_flap_retry_start_time = 0; // first time we attempted to start the manager in past little while)
#endif

// transient syscall error timeout
Expand Down Expand Up @@ -406,22 +406,22 @@ safe_kill(const char *lockfile_name, const char *pname, bool group)
cop_log_trace("Leaving safe_kill(%s, %s, %d)\n", lockfile_name, pname, group);
}

// ink_hrtime milliseconds()
// ts_hrtick milliseconds()
//
// Returns the result of gettimeofday converted to
// one 64bit int
//
static ink_hrtime
static ts_hrtick
milliseconds(void)
{
struct timeval now;

cop_log_trace("Entering milliseconds()\n");
now = ink_gettimeofday();
// Make liberal use of casting to ink_hrtime to ensure the
// Make liberal use of casting to ts_hrtick to ensure the
// compiler does not truncate our result
cop_log_trace("Leaving milliseconds()\n");
return ((ink_hrtime)now.tv_sec * 1000) + ((ink_hrtime)now.tv_usec / 1000);
return ((ts_hrtick)now.tv_sec * 1000) + ((ts_hrtick)now.tv_usec / 1000);
}

static void
Expand Down Expand Up @@ -1392,7 +1392,7 @@ check_programs()
safe_kill(server_lockfile, server_binary, false);
}
// Spawn the manager (check for flapping manager too)
ink_hrtime now = milliseconds();
ts_hrtick now = milliseconds();
if (!manager_flapping) {
if ((manager_flap_interval_start_time == 0) || (now - manager_flap_interval_start_time > MANAGER_FLAP_INTERVAL_MSEC)) {
// either:
Expand Down
12 changes: 6 additions & 6 deletions cmd/traffic_manager/metrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ struct EvaluatorList {
void
evaluate(lua_State *L) const
{
ink_hrtime start = ink_get_hrtime_internal();
ink_hrtime elapsed;
ts_hrtick start = ink_get_hrtime_internal();
ts_hrtick elapsed;

forv_Vec(Evaluator, e, this->evaluators) { e->eval(L); }
elapsed = ink_hrtime_diff(ink_get_hrtime_internal(), start);
Debug("lua", "evaluated %u metrics in %fmsec", evaluators.length(), ink_hrtime_to_usec(elapsed) / 1000.0);
elapsed = ts_hrtick_diff(ink_get_hrtime_internal(), start);
Debug("lua", "evaluated %u metrics in %fmsec", evaluators.length(), ts_hrtick_to_usec(elapsed) / 1000.0);
}

bool update;
Expand All @@ -169,8 +169,8 @@ update_metrics_namespace(lua_State *L)
static int64_t
timestamp_now_msec()
{
ink_hrtime now = ink_get_hrtime_internal();
return ink_hrtime_to_msec(now);
ts_hrtick now = ink_get_hrtime_internal();
return ts_hrtick_to_msec(now);
}

static int
Expand Down
8 changes: 4 additions & 4 deletions iocore/aio/AIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ aio_stats_cb(const char * /* name ATS_UNUSED */, RecDataT data_type, RecData *da
int64_t new_val = 0;
int64_t diff = 0;
int64_t count, sum;
ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
// The RecGetGlobalXXX stat functions are cheaper than the
// RecGetXXX functions. The Global ones are expensive
// for increments and decrements. But for AIO stats we
// only do Sets and Gets, so they are cheaper in our case.
RecGetGlobalRawStatSum(aio_rsb, id, &sum);
RecGetGlobalRawStatCount(aio_rsb, id, &count);

int64_t time_diff = ink_hrtime_to_msec(now - count);
int64_t time_diff = ts_hrtick_to_msec(now - count);
if (time_diff == 0) {
data->rec_float = 0.0;
return 0;
Expand Down Expand Up @@ -115,7 +115,7 @@ static AIOTestData *data;
int
AIOTestData::ink_aio_stats(int event, void *d)
{
ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
double time_msec = (double)(now - start) / (double)HRTIME_MSECOND;
int i = (aio_reqs[0] == NULL) ? 1 : 0;
for (; i < num_filedes; ++i)
Expand Down Expand Up @@ -510,7 +510,7 @@ aio_thread_main(void *arg)
op->thread->schedule_imm_signal(op);
ink_mutex_acquire(&my_aio_req->aio_mutex);
} while (1);
timespec timedwait_msec = ink_hrtime_to_timespec(Thread::get_hrtime_updated() + HRTIME_MSECONDS(net_config_poll_timeout));
timespec timedwait_msec = ts_hrtick_to_timespec(Thread::get_hrtime_updated() + HRTIME_MSECONDS(net_config_poll_timeout));
ink_cond_timedwait(&my_aio_req->aio_cond, &my_aio_req->aio_mutex, &timedwait_msec);
}
return 0;
Expand Down
4 changes: 2 additions & 2 deletions iocore/aio/P_AIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct AIO_Reqs;
struct AIOCallbackInternal : public AIOCallback {
AIOCallback *first;
AIO_Reqs *aio_req;
ink_hrtime sleep_time;
ts_nanoseconds sleep_time;
int io_complete(int event, void *data);
AIOCallbackInternal()
{
Expand Down Expand Up @@ -141,7 +141,7 @@ class AIOTestData : public Continuation
int num_req;
int num_temp;
int num_queue;
ink_hrtime start;
ts_hrtick start;

int ink_aio_stats(int event, void *data);

Expand Down
2 changes: 1 addition & 1 deletion iocore/aio/test_AIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct AIO_Device : public Continuation {
int fd;
int id;
char *buf;
ink_hrtime time_start, time_end;
ts_hrtick time_start, time_end;
int seq_reads;
int seq_writes;
int rand_reads;
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/CacheDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ dir_corrupt_bucket(Dir *b, int s, Vol *d)

EXCLUSIVE_REGRESSION_TEST(Cache_dir)(RegressionTest *t, int /* atype ATS_UNUSED */, int *status)
{
ink_hrtime ttime;
ts_hrtick ttime;
int ret = REGRESSION_TEST_PASSED;

if ((CacheProcessor::IsCacheEnabled() != CACHE_INITIALIZED) || gnvol < 1) {
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/P_CacheDir.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ struct CacheSync : public Continuation {
off_t writepos;
AIOCallbackInternal io;
Event *trigger;
ink_hrtime start_time;
ts_hrtick start_time;
int mainEvent(int event, Event *e);
void aio_write(int fd, char *b, int n, off_t o);

Expand Down
4 changes: 2 additions & 2 deletions iocore/cache/P_CacheInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct EvacuationBlock;
do { \
ink_assert(!trigger); \
writer_lock_retry++; \
ink_hrtime _t = HRTIME_MSECONDS(cache_read_while_writer_retry_delay); \
ts_hrtick _t = HRTIME_MSECONDS(cache_read_while_writer_retry_delay); \
if (writer_lock_retry > 2) \
_t = HRTIME_MSECONDS(cache_read_while_writer_retry_delay) * 2; \
trigger = mutex->thread_holding->schedule_in_local(this, _t); \
Expand Down Expand Up @@ -452,7 +452,7 @@ struct CacheVC : public CacheVConnection {
CacheKey *read_key;
ContinuationHandler save_handler;
uint32_t pin_in_cache;
ink_hrtime start_time;
ts_hrtick start_time;
int base_stat;
int recursive;
int closed;
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/P_CacheTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct CacheTestSM : public RegressionSM {

Action *timeout;
Action *cache_action;
ink_hrtime start_time;
ts_hrtick start_time;
CacheVConnection *cache_vc;
VIO *cvio;
MIOBuffer *buffer;
Expand Down
12 changes: 6 additions & 6 deletions iocore/cluster/ClusterCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ static Ptr<ProxyMutex> remoteCacheContQueueMutex[REMOTE_CONNECT_HASH];
static int cluster_sequence_number = 1;

#ifdef CLUSTER_TEST_DEBUG
static ink_hrtime cache_cluster_timeout = HRTIME_SECONDS(65536);
static ts_hrtick cache_cluster_timeout = HRTIME_SECONDS(65536);
#else
static ink_hrtime cache_cluster_timeout = CACHE_CLUSTER_TIMEOUT;
static ts_hrtick cache_cluster_timeout = CACHE_CLUSTER_TIMEOUT;
#endif

///////////////////
Expand Down Expand Up @@ -831,7 +831,7 @@ CacheContinuation::localVCsetupEvent(int event, ClusterVConnection *vc)

} else if (((event == CLUSTER_EVENT_OPEN) || (event == CLUSTER_EVENT_OPEN_EXISTS)) &&
(((ptrdiff_t)timeout & (ptrdiff_t)1) == 0)) {
ink_hrtime now;
ts_hrtick now;
now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_OPEN_DELAY_TIME_STAT, now - start_time);
LOG_EVENT_TIME(start_time, open_delay_time_dist, open_delay_events);
Expand Down Expand Up @@ -1554,7 +1554,7 @@ CacheContinuation::replyOpEvent(int event, VConnection *cvc)
{
ink_assert(magicno == (int)MagicNo);
Debug("cache_proto", "replyOpEvent(this=%p,event=%d,VC=%p)", this, event, cvc);
ink_hrtime now;
ts_hrtick now;
now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CACHE_CALLBACK_TIME_STAT, now - start_time);
LOG_EVENT_TIME(start_time, callback_time_dist, cache_callbacks);
Expand Down Expand Up @@ -2080,7 +2080,7 @@ CacheContinuation::remoteOpEvent(int event_code, Event *e)
{
ink_assert(magicno == (int)MagicNo);
int event = event_code;
ink_hrtime now;
ts_hrtick now;
if (start_time) {
int res;
if (event != EVENT_INTERVAL) {
Expand Down Expand Up @@ -2556,7 +2556,7 @@ cache_lookup_ClusterFunction(ClusterHandler *ch, void *data, int len)
int
CacheContinuation::replyLookupEvent(int event, void * /* d ATS_UNUSED */)
{
ink_hrtime now;
ts_hrtick now;
now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CACHE_CALLBACK_TIME_STAT, now - start_time);
LOG_EVENT_TIME(start_time, callback_time_dist, cache_callbacks);
Expand Down
2 changes: 1 addition & 1 deletion iocore/cluster/ClusterConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ cluster_machine_at_depth(unsigned int hash, int *pprobe_depth, ClusterMachine **
#endif
ClusterConfiguration *cc = this_cluster()->current_configuration();
ClusterConfiguration *next_cc = cc;
ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
int fake_probe_depth = 0;
int &probe_depth = pprobe_depth ? (*pprobe_depth) : fake_probe_depth;
int tprobe_depth = probe_depth;
Expand Down
20 changes: 10 additions & 10 deletions iocore/cluster/ClusterHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ ClusterHandler::close_ClusterVConnection(ClusterVConnection *vc)
}
clusterProcessor.invoke_remote(vc->ch, CLOSE_CHANNEL_CLUSTER_FUNCTION, data, len);
}
ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
CLUSTER_DECREMENT_DYN_STAT(CLUSTER_CONNECTIONS_OPEN_STAT);
CLUSTER_SUM_DYN_STAT(CLUSTER_CON_TOTAL_TIME_STAT, now - vc->start_time);
if (!local_channel(channel)) {
Expand Down Expand Up @@ -450,7 +450,7 @@ ClusterHandler::build_initial_vector(bool read_flag)
// This isn't used.
// MIOBuffer *w;

ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
ClusterState &s = (read_flag ? read : write);
OutgoingControl *oc = s.msg.outgoing_control.head;
IncomingControl *ic = incoming_control.head;
Expand Down Expand Up @@ -935,7 +935,7 @@ ClusterHandler::process_small_control_msgs()
read.msg.did_small_control_msgs = 1;
}

ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
char *p = (char *)&read.msg.descriptor[read.msg.count] + read.msg.control_data_offset;
char *endp = (char *)&read.msg.descriptor[read.msg.count] + read.msg.control_bytes;

Expand Down Expand Up @@ -1149,7 +1149,7 @@ ClusterHandler::update_channels_read()
int
ClusterHandler::process_incoming_callouts(ProxyMutex *mutex)
{
ink_hrtime now;
ts_hrtick now;
//
// Atomically dequeue all active requests from the external queue and
// move them to the local working queue. Insertion queue order is
Expand Down Expand Up @@ -1429,7 +1429,7 @@ ClusterHandler::update_channels_written()
// Lower the priority of those with too little data and raise that of
// those with too much data.
//
ink_hrtime now;
ts_hrtick now;
for (int i = 0; i < write.msg.count; i++) {
if (write.msg.descriptor[i].type == CLUSTER_SEND_DATA) {
if (write.msg.descriptor[i].channel != CLUSTER_CONTROL_CHANNEL) {
Expand Down Expand Up @@ -1857,7 +1857,7 @@ ClusterHandler::add_small_controlmsg_descriptors()
c->free_data();
c->mutex = NULL;
p += c->len;
ink_hrtime now = Thread::get_hrtime();
ts_hrtick now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_SEND_TIME_STAT, now - c->submit_time);
LOG_EVENT_TIME(c->submit_time, cluster_send_time_dist, cluster_send_events);
c->freeall();
Expand Down Expand Up @@ -2488,7 +2488,7 @@ ClusterHandler::mainClusterEvent(int event, Event *e)
return EVENT_CONT;
}

int ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
int ClusterHandler::process_read(ts_hrtick /* now ATS_UNUSED */)
{
#ifdef CLUSTER_STATS
_process_read_calls++;
Expand Down Expand Up @@ -2762,7 +2762,7 @@ int ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
#ifdef CLUSTER_STATS
_n_read_complete++;
#endif
ink_hrtime rdmsg_end_time = Thread::get_hrtime();
ts_hrtick rdmsg_end_time = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_RDMSG_ASSEMBLE_TIME_STAT, rdmsg_end_time - read.start_time);
read.start_time = HRTIME_MSECONDS(0);
if (dump_msgs)
Expand All @@ -2786,7 +2786,7 @@ int ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
}

int
ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
ClusterHandler::process_write(ts_hrtick now, bool only_write_control_msgs)
{
#ifdef CLUSTER_STATS
_process_write_calls++;
Expand Down Expand Up @@ -2952,7 +2952,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
_n_write_complete++;
#endif
write.state = ClusterState::WRITE_START;
ink_hrtime curtime = Thread::get_hrtime();
ts_hrtick curtime = Thread::get_hrtime();

if (!on_stolen_thread) {
//
Expand Down
2 changes: 1 addition & 1 deletion iocore/cluster/ClusterHandlerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ ClusterHandler::protoZombieEvent(int /* event ATS_UNUSED */, Event *e)
// after NO_RACE_DELAY
//
bool failed = false;
ink_hrtime delay = CLUSTER_MEMBER_DELAY * 5;
ts_hrtick delay = CLUSTER_MEMBER_DELAY * 5;
EThread *t = e ? e->ethread : this_ethread();
head_p item;

Expand Down
Loading