You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/06/24 01:45:00 UTC
trafficserver git commit: TS-1774: Move hrtime functions to Thread
class. This closes #185.
Repository: trafficserver
Updated Branches:
refs/heads/master 28b243b06 -> 738d9ed3c
TS-1774: Move hrtime functions to Thread class.
This closes #185.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/738d9ed3
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/738d9ed3
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/738d9ed3
Branch: refs/heads/master
Commit: 738d9ed3ca1882bfc1855f87d3ccb5bf8a59c2f9
Parents: 28b243b
Author: Daniel Xu <da...@gmail.com>
Authored: Tue Jun 23 18:42:43 2015 -0500
Committer: Alan M. Carroll <am...@apache.org>
Committed: Tue Jun 23 18:44:33 2015 -0500
----------------------------------------------------------------------
iocore/aio/AIO.cc | 4 +-
iocore/aio/test_AIO.cc | 6 +--
iocore/cache/CacheDir.cc | 4 +-
iocore/cache/CacheRead.cc | 2 +-
iocore/cache/CacheWrite.cc | 6 +--
iocore/cache/P_CacheInternal.h | 2 +-
iocore/cache/P_CacheTest.h | 2 +-
iocore/cluster/ClusterCache.cc | 18 ++++----
iocore/cluster/ClusterConfig.cc | 6 +--
iocore/cluster/ClusterHandler.cc | 26 ++++++------
iocore/cluster/ClusterLoadMonitor.cc | 4 +-
iocore/cluster/ClusterProcessor.cc | 8 ++--
iocore/dns/DNS.cc | 14 +++----
iocore/dns/P_DNSProcessor.h | 8 ++--
iocore/eventsystem/I_Lock.h | 8 ++--
iocore/eventsystem/I_Thread.h | 4 +-
iocore/eventsystem/P_Thread.h | 12 ------
iocore/eventsystem/P_UnixEThread.h | 8 ++--
iocore/eventsystem/P_UnixEventProcessor.h | 4 +-
iocore/eventsystem/Thread.cc | 6 +++
iocore/eventsystem/UnixEThread.cc | 2 +-
iocore/eventsystem/UnixEvent.cc | 4 +-
iocore/hostdb/HostDB.cc | 6 +--
iocore/net/OCSPStapling.cc | 4 +-
iocore/net/P_UnixNet.h | 8 ++--
iocore/net/P_UnixNetVConnection.h | 4 +-
iocore/net/SSLNetVConnection.cc | 2 +-
iocore/net/SSLNextProtocolAccept.cc | 2 +-
iocore/net/UnixNet.cc | 6 +--
iocore/net/UnixNetAccept.cc | 12 +++---
iocore/net/UnixNetPages.cc | 2 +-
iocore/net/UnixNetProcessor.cc | 2 +-
iocore/net/UnixNetVConnection.cc | 6 +--
proxy/ICP.cc | 10 ++---
proxy/ICP.h | 2 +-
proxy/ICPConfig.cc | 8 ++--
proxy/InkAPI.cc | 4 +-
proxy/InkIOCoreAPI.cc | 2 +-
proxy/Main.cc | 2 +-
proxy/PluginVC.cc | 6 +--
proxy/StatSystem.cc | 2 +-
proxy/congest/Congestion.cc | 2 +-
proxy/congest/Congestion.h | 2 +-
proxy/congest/CongestionDB.cc | 4 +-
proxy/http/HttpSM.cc | 58 +++++++++++++-------------
proxy/http/HttpTransact.cc | 4 +-
proxy/logging/Log.cc | 4 +-
proxy/logging/LogObject.cc | 2 +-
48 files changed, 159 insertions(+), 165 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/aio/AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index c5c2ead..5fbeef7 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -70,7 +70,7 @@ 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 = ink_get_hrtime();
+ ink_hrtime 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
@@ -504,7 +504,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(ink_get_hrtime() + HRTIME_MSECONDS(net_config_poll_timeout));
+ timespec timedwait_msec = ink_hrtime_to_timespec(Thread::get_hrtime() + HRTIME_MSECONDS(net_config_poll_timeout));
ink_cond_timedwait(&my_aio_req->aio_cond, &my_aio_req->aio_mutex, &timedwait_msec);
}
return 0;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/aio/test_AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc
index eb8691f..179e451 100644
--- a/iocore/aio/test_AIO.cc
+++ b/iocore/aio/test_AIO.cc
@@ -332,11 +332,11 @@ int
AIO_Device::do_fd(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
{
if (!time_start) {
- time_start = ink_get_hrtime();
+ time_start = Thread::get_hrtime();
fprintf(stderr, "Starting the aio_testing \n");
}
- if ((ink_get_hrtime() - time_start) > (run_time * HRTIME_SECOND)) {
- time_end = ink_get_hrtime();
+ if ((Thread::get_hrtime() - time_start) > (run_time * HRTIME_SECOND)) {
+ time_end = Thread::get_hrtime();
ink_atomic_increment(&n_accessors, -1);
if (n_accessors <= 0)
dump_summary();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cache/CacheDir.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index 000bc46..978bbfa 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -1031,7 +1031,7 @@ Lrestart:
}
if (!vol->dir_sync_in_progress)
- start_time = ink_get_hrtime();
+ start_time = Thread::get_hrtime();
// recompute hit_evacuate_window
vol->hit_evacuate_window = (vol->data_blocks * cache_config_hit_evacuate_percent) / 100;
@@ -1109,7 +1109,7 @@ Lrestart:
} else {
vol->dir_sync_in_progress = 0;
CACHE_INCREMENT_DYN_STAT(cache_directory_sync_count_stat);
- CACHE_SUM_DYN_STAT(cache_directory_sync_time_stat, ink_get_hrtime() - start_time);
+ CACHE_SUM_DYN_STAT(cache_directory_sync_time_stat, Thread::get_hrtime() - start_time);
start_time = 0;
goto Ldone;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index e8ff804..c617ee4 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -300,7 +300,7 @@ CacheVC::openReadFromWriter(int event, Event *e)
// before the open_write, but the reader could not get the volume
// lock. If we don't reset the clock here, we won't choose any writer
// and hence fail the read request.
- start_time = ink_get_hrtime();
+ start_time = Thread::get_hrtime();
f.read_from_writer_called = 1;
}
cancel_trigger();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cache/CacheWrite.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 3740d21..bb3676a 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -166,7 +166,7 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
- total_len. The total number of bytes for the document so far.
Doc->total_len and alternate's total len is set to this value.
- first_key. Doc's first_key is set to this value.
- - pin_in_cache. Doc's pinned value is set to this + ink_get_hrtime().
+ - pin_in_cache. Doc's pinned value is set to this + Thread::get_hrtime().
- earliest_key. If f.use_first_key, Doc's key is set to this value.
- key. If !f.use_first_key, Doc's key is set to this value.
- blocks. Used only if write_len is set. Data to be written
@@ -611,7 +611,7 @@ Vol::evacuateDocReadDone(int event, Event *e)
}
if (!b)
goto Ldone;
- if ((b->f.pinned && !b->readers) && doc->pinned < (uint32_t)(ink_get_based_hrtime() / HRTIME_SECOND))
+ if ((b->f.pinned && !b->readers) && doc->pinned < (uint32_t)(Thread::get_hrtime() / HRTIME_SECOND))
goto Ldone;
if (dir_head(&b->dir) && b->f.evacuate_head) {
@@ -745,7 +745,7 @@ agg_copy(char *p, CacheVC *vc)
doc->checksum = DOC_NO_CHECKSUM;
if (vc->pin_in_cache) {
dir_set_pinned(&vc->dir, 1);
- doc->pinned = (uint32_t)(ink_get_based_hrtime() / HRTIME_SECOND) + vc->pin_in_cache;
+ doc->pinned = (uint32_t)(Thread::get_hrtime() / HRTIME_SECOND) + vc->pin_in_cache;
} else {
dir_set_pinned(&vc->dir, 0);
doc->pinned = 0;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 28cb44f..eb3a161 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -539,7 +539,7 @@ new_CacheVC(Continuation *cont)
c->_action = cont;
c->initial_thread = t->tt == DEDICATED ? NULL : t;
c->mutex = cont->mutex;
- c->start_time = ink_get_hrtime();
+ c->start_time = Thread::get_hrtime();
ink_assert(c->trigger == NULL);
Debug("cache_new", "new %p", c);
#ifdef CACHE_STAT_PAGES
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cache/P_CacheTest.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
index 9aeaa4a..f124230 100644
--- a/iocore/cache/P_CacheTest.h
+++ b/iocore/cache/P_CacheTest.h
@@ -94,7 +94,7 @@ struct CacheTestSM : public RegressionSM {
void
make_request()
{
- start_time = ink_get_hrtime();
+ start_time = Thread::get_hrtime();
make_request_internal();
}
virtual void make_request_internal() = 0;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cluster/ClusterCache.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index c4480e1..3ff9e53 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -393,7 +393,7 @@ CacheContinuation::do_op(Continuation *c, ClusterMachine *mp, void *args, int us
cc->mutex = c->mutex;
cc->action = c;
cc->action.cancelled = false;
- cc->start_time = ink_get_hrtime();
+ cc->start_time = Thread::get_hrtime();
cc->from = mp;
cc->result = op_failure(opcode);
SET_CONTINUATION_HANDLER(cc, (CacheContHandler)&CacheContinuation::remoteOpEvent);
@@ -832,7 +832,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;
- now = ink_get_hrtime();
+ 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);
if (read_op) {
@@ -1046,7 +1046,7 @@ cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
MUTEX_TRY_LOCK(lock, c->mutex, this_ethread());
c->request_opcode = opcode;
c->token.clear();
- c->start_time = ink_get_hrtime();
+ c->start_time = Thread::get_hrtime();
c->ch = ch;
SET_CONTINUATION_HANDLER(c, (CacheContHandler)&CacheContinuation::replyOpEvent);
@@ -1555,7 +1555,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;
- now = ink_get_hrtime();
+ 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);
ink_release_assert(expect_cache_callback);
@@ -1991,7 +1991,7 @@ cache_op_result_ClusterFunction(ClusterHandler *ch, void *d, int l)
c->seq_number = msg->seq_number;
c->target_ip = ch->machine->ip;
SET_CONTINUATION_HANDLER(c, (CacheContHandler)&CacheContinuation::handleReplyEvent);
- c->start_time = ink_get_hrtime();
+ c->start_time = Thread::get_hrtime();
c->result = msg->result;
if (event_is_open(msg->result))
c->token = msg->token;
@@ -2093,11 +2093,11 @@ CacheContinuation::remoteOpEvent(int event_code, Event *e)
res = rmsg->result;
}
if ((res == CACHE_EVENT_LOOKUP) || (res == CACHE_EVENT_LOOKUP_FAILED)) {
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CACHE_LKRMT_CALLBACK_TIME_STAT, now - start_time);
LOG_EVENT_TIME(start_time, lkrmt_callback_time_dist, lkrmt_cache_callbacks);
} else {
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CACHE_RMT_CALLBACK_TIME_STAT, now - start_time);
LOG_EVENT_TIME(start_time, rmt_callback_time_dist, rmt_cache_callbacks);
}
@@ -2444,7 +2444,7 @@ CacheContinuation::do_remote_lookup(Continuation *cont, const CacheKey *key, Cac
c->url_md5 = msg->url_md5;
c->action.cancelled = false;
c->action = cont;
- c->start_time = ink_get_hrtime();
+ c->start_time = Thread::get_hrtime();
SET_CONTINUATION_HANDLER(c, (CacheContHandler)&CacheContinuation::remoteOpEvent);
c->result = CACHE_EVENT_LOOKUP_FAILED;
@@ -2561,7 +2561,7 @@ int
CacheContinuation::replyLookupEvent(int event, void * /* d ATS_UNUSED */)
{
ink_hrtime now;
- now = ink_get_hrtime();
+ 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);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cluster/ClusterConfig.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterConfig.cc b/iocore/cluster/ClusterConfig.cc
index cac0014..16e5278 100644
--- a/iocore/cluster/ClusterConfig.cc
+++ b/iocore/cluster/ClusterConfig.cc
@@ -303,7 +303,7 @@ configuration_add_machine(ClusterConfiguration *c, ClusterMachine *m)
cc->n_machines++;
cc->link.next = c;
- cc->changed = ink_get_hrtime();
+ cc->changed = Thread::get_hrtime();
ink_assert(cc->n_machines < CLUSTER_MAX_MACHINES);
build_cluster_hash_table(cc);
@@ -335,7 +335,7 @@ configuration_remove_machine(ClusterConfiguration *c, ClusterMachine *m)
ink_assert(cc->n_machines > 0);
cc->link.next = c;
- cc->changed = ink_get_hrtime();
+ cc->changed = Thread::get_hrtime();
build_cluster_hash_table(cc);
INK_MEMORY_BARRIER; // commit writes before freeing old hash table
@@ -362,7 +362,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 = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
int fake_probe_depth = 0;
int &probe_depth = pprobe_depth ? (*pprobe_depth) : fake_probe_depth;
int tprobe_depth = probe_depth;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cluster/ClusterHandler.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterHandler.cc b/iocore/cluster/ClusterHandler.cc
index 979bc8d..6e28916 100644
--- a/iocore/cluster/ClusterHandler.cc
+++ b/iocore/cluster/ClusterHandler.cc
@@ -285,7 +285,7 @@ ClusterHandler::close_ClusterVConnection(ClusterVConnection *vc)
}
clusterProcessor.invoke_remote(vc->ch, CLOSE_CHANNEL_CLUSTER_FUNCTION, data, len);
}
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime 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)) {
@@ -395,7 +395,7 @@ ClusterHandler::build_initial_vector(bool read_flag)
// This isn't used.
// MIOBuffer *w;
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
ClusterState &s = (read_flag ? read : write);
OutgoingControl *oc = s.msg.outgoing_control.head;
IncomingControl *ic = incoming_control.head;
@@ -879,7 +879,7 @@ ClusterHandler::process_small_control_msgs()
read.msg.did_small_control_msgs = 1;
}
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime 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;
@@ -1139,7 +1139,7 @@ ClusterHandler::process_incoming_callouts(ProxyMutex *m)
////////////////////////////////
ink_assert(!clusterFunction[cluster_function_index].ClusterFunc);
clusterFunction[cluster_function_index].pfn(this, p, len - sizeof(int32_t));
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_RECV_TIME_STAT, now - ic->recognized_time);
} else {
Warning("2Bad cluster function index (small control)");
@@ -1160,7 +1160,7 @@ ClusterHandler::process_incoming_callouts(ProxyMutex *m)
////////////////////////////////
ink_assert(!clusterFunction[cluster_function_index].ClusterFunc);
clusterFunction[cluster_function_index].pfn(this, (void *)(ic->data + sizeof(int32_t)), ic->len - sizeof(int32_t));
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_RECV_TIME_STAT, now - ic->recognized_time);
} else {
valid_index = false;
@@ -1410,7 +1410,7 @@ ClusterHandler::update_channels_written()
OutgoingControl *oc = write.msg.outgoing_control.dequeue();
oc->free_data();
oc->mutex = NULL;
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_SEND_TIME_STAT, now - oc->submit_time);
LOG_EVENT_TIME(oc->submit_time, cluster_send_time_dist, cluster_send_events);
oc->freeall();
@@ -1436,7 +1436,7 @@ ClusterHandler::update_channels_written()
// Free descriptor
hdr_oc->free_data();
hdr_oc->mutex = NULL;
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
CLUSTER_SUM_DYN_STAT(CLUSTER_CTRL_MSGS_SEND_TIME_STAT, now - hdr_oc->submit_time);
LOG_EVENT_TIME(hdr_oc->submit_time, cluster_send_time_dist, cluster_send_events);
hdr_oc->freeall();
@@ -1802,7 +1802,7 @@ ClusterHandler::add_small_controlmsg_descriptors()
c->free_data();
c->mutex = NULL;
p += c->len;
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime 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();
@@ -2325,7 +2325,7 @@ int
ClusterHandler::mainClusterEvent(int event, Event *e)
{
// Set global time
- current_time = ink_get_hrtime();
+ current_time = Thread::get_hrtime();
if (CacheClusterMonitorEnabled) {
if ((current_time - last_trace_dump) > HRTIME_SECONDS(CacheClusterMonitorIntervalSecs)) {
@@ -2457,7 +2457,7 @@ int ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
_n_read_start++;
#endif
read.msg.clear();
- read.start_time = ink_get_hrtime();
+ read.start_time = Thread::get_hrtime();
if (build_initial_vector(CLUSTER_READ)) {
read.state = ClusterState::READ_HEADER;
} else {
@@ -2708,7 +2708,7 @@ int ClusterHandler::process_read(ink_hrtime /* now ATS_UNUSED */)
#ifdef CLUSTER_STATS
_n_read_complete++;
#endif
- ink_hrtime rdmsg_end_time = ink_get_hrtime();
+ ink_hrtime 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)
@@ -2750,7 +2750,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
_n_write_start++;
#endif
write.msg.clear();
- write.last_time = ink_get_hrtime();
+ write.last_time = Thread::get_hrtime();
pw_write_descriptors_built = -1;
pw_freespace_descriptors_built = -1;
pw_controldata_descriptors_built = -1;
@@ -2898,7 +2898,7 @@ ClusterHandler::process_write(ink_hrtime now, bool only_write_control_msgs)
_n_write_complete++;
#endif
write.state = ClusterState::WRITE_START;
- ink_hrtime curtime = ink_get_hrtime();
+ ink_hrtime curtime = Thread::get_hrtime();
if (!on_stolen_thread) {
//
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cluster/ClusterLoadMonitor.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterLoadMonitor.cc b/iocore/cluster/ClusterLoadMonitor.cc
index 6d79a0b..19ab500 100644
--- a/iocore/cluster/ClusterLoadMonitor.cc
+++ b/iocore/cluster/ClusterLoadMonitor.cc
@@ -229,7 +229,7 @@ void
ClusterLoadMonitor::recv_cluster_load_msg(cluster_load_ping_msg *m)
{
// We have received back our ping message.
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
if ((now >= m->send_time) &&
((m->sequence_number >= cluster_load_msg_start_sequence_number) && (m->sequence_number < cluster_load_msg_sequence_number))) {
@@ -285,7 +285,7 @@ ClusterLoadMonitor::cluster_load_periodic(int /* event ATS_UNUSED */, Event * /*
}
// Generate periodic ping messages.
- ink_hrtime current_time = ink_get_hrtime();
+ ink_hrtime current_time = Thread::get_hrtime();
if ((current_time - last_ping_message_sent) > HRTIME_MSECONDS(ping_message_send_msec_interval)) {
send_cluster_load_msg(current_time);
last_ping_message_sent = current_time;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/cluster/ClusterProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterProcessor.cc b/iocore/cluster/ClusterProcessor.cc
index 843c30a..65007a0 100644
--- a/iocore/cluster/ClusterProcessor.cc
+++ b/iocore/cluster/ClusterProcessor.cc
@@ -91,7 +91,7 @@ ClusterProcessor::internal_invoke_remote(ClusterHandler *ch, int cluster_fn, voi
c = OutgoingControl::alloc();
}
CLUSTER_INCREMENT_DYN_STAT(CLUSTER_CTRL_MSGS_SENT_STAT);
- c->submit_time = ink_get_hrtime();
+ c->submit_time = Thread::get_hrtime();
if (malloced) {
c->set_data((char *)data, len);
@@ -184,7 +184,7 @@ ClusterProcessor::invoke_remote_data(ClusterHandler *ch, int cluster_fn, void *d
mh.token = *token;
OutgoingControl *chdr = OutgoingControl::alloc();
- chdr->submit_time = ink_get_hrtime();
+ chdr->submit_time = Thread::get_hrtime();
chdr->len = sizeof(int32_t) + sizeof(mh);
chdr->alloc_data();
*(int32_t *)chdr->data = -1; // always -1 for compound message
@@ -243,7 +243,7 @@ ClusterProcessor::open_local(Continuation *cont, ClusterMachine * /* m ATS_UNUSE
ProxyMutex *mutex = thread->mutex;
ClusterVConnection *vc = clusterVCAllocator.alloc();
vc->new_connect_read = (options & CLUSTER_OPT_CONN_READ ? 1 : 0);
- vc->start_time = ink_get_hrtime();
+ vc->start_time = Thread::get_hrtime();
vc->last_activity_time = vc->start_time;
vc->ch = ch;
vc->token.alloc();
@@ -313,7 +313,7 @@ ClusterProcessor::connect_local(Continuation *cont, ClusterVCToken *token, int c
ProxyMutex *mutex = thread->mutex;
ClusterVConnection *vc = clusterVCAllocator.alloc();
vc->new_connect_read = (options & CLUSTER_OPT_CONN_READ ? 1 : 0);
- vc->start_time = ink_get_hrtime();
+ vc->start_time = Thread::get_hrtime();
vc->last_activity_time = vc->start_time;
vc->ch = ch;
vc->token = *token;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index bd185ce..157e716 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -367,7 +367,7 @@ DNSEntry::init(const char *x, int len, int qtype_arg, Continuation *acont, DNSPr
qtype = T_AAAA;
}
}
- submit_time = ink_get_hrtime();
+ submit_time = Thread::get_hrtime();
action = acont;
submit_thread = acont->mutex->thread_holding;
@@ -577,7 +577,7 @@ DNSHandler::retry_named(int ndx, ink_hrtime t, bool reopen)
void
DNSHandler::try_primary_named(bool reopen)
{
- ink_hrtime t = ink_get_hrtime();
+ ink_hrtime t = Thread::get_hrtime();
if (reopen && ((t - last_primary_reopen) > DNS_PRIMARY_REOPEN_PERIOD)) {
Debug("dns", "try_primary_named: reopening primary DNS connection");
last_primary_reopen = t;
@@ -796,7 +796,7 @@ DNSHandler::mainEvent(int event, Event *e)
{
recv_dns(event, e);
if (dns_ns_rr) {
- ink_hrtime t = ink_get_hrtime();
+ ink_hrtime t = Thread::get_hrtime();
if (t - last_primary_retry > DNS_PRIMARY_RETRY_PERIOD) {
for (int i = 0; i < n_con; i++) {
if (ns_down[i]) {
@@ -993,7 +993,7 @@ write_dns_event(DNSHandler *h, DNSEntry *e)
++h->in_flight;
DNS_INCREMENT_DYN_STAT(dns_in_flight_stat);
- e->send_time = ink_get_hrtime();
+ e->send_time = Thread::get_hrtime();
if (e->timeout)
e->timeout->cancel();
@@ -1159,9 +1159,9 @@ dns_result(DNSHandler *h, DNSEntry *e, HostEnt *ent, bool retry)
ent = NULL;
if (!cancelled) {
if (!ent) {
- DNS_SUM_DYN_STAT(dns_fail_time_stat, ink_get_hrtime() - e->submit_time);
+ DNS_SUM_DYN_STAT(dns_fail_time_stat, Thread::get_hrtime() - e->submit_time);
} else {
- DNS_SUM_DYN_STAT(dns_success_time_stat, ink_get_hrtime() - e->submit_time);
+ DNS_SUM_DYN_STAT(dns_success_time_stat, Thread::get_hrtime() - e->submit_time);
}
}
h->entries.remove(e);
@@ -1298,7 +1298,7 @@ dns_process(DNSHandler *handler, HostEnt *buf, int len)
--(handler->in_flight);
DNS_DECREMENT_DYN_STAT(dns_in_flight_stat);
- DNS_SUM_DYN_STAT(dns_response_time_stat, ink_get_hrtime() - e->send_time);
+ DNS_SUM_DYN_STAT(dns_response_time_stat, Thread::get_hrtime() - e->send_time);
if (h->rcode != NOERROR || !h->ancount) {
Debug("dns", "received rcode = %d", h->rcode);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/dns/P_DNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h
index 09c2384..dd549c0 100644
--- a/iocore/dns/P_DNSProcessor.h
+++ b/iocore/dns/P_DNSProcessor.h
@@ -229,7 +229,7 @@ struct DNSHandler : public Continuation {
++failover_number[name_server];
Debug("dns", "sent_one: failover_number for resolver %d is %d", name_server, failover_number[name_server]);
if (failover_number[name_server] >= dns_failover_number && !crossed_failover_number[name_server])
- crossed_failover_number[name_server] = ink_get_hrtime();
+ crossed_failover_number[name_server] = Thread::get_hrtime();
}
bool
@@ -238,16 +238,16 @@ struct DNSHandler : public Continuation {
if (is_debug_tag_set("dns")) {
Debug("dns", "failover_now: Considering immediate failover, target time is %" PRId64 "",
(ink_hrtime)HRTIME_SECONDS(dns_failover_period));
- Debug("dns", "\tdelta time is %" PRId64 "", (ink_get_hrtime() - crossed_failover_number[i]));
+ Debug("dns", "\tdelta time is %" PRId64 "", (Thread::get_hrtime() - crossed_failover_number[i]));
}
- return (crossed_failover_number[i] && ((ink_get_hrtime() - crossed_failover_number[i]) > HRTIME_SECONDS(dns_failover_period)));
+ return (crossed_failover_number[i] && ((Thread::get_hrtime() - crossed_failover_number[i]) > HRTIME_SECONDS(dns_failover_period)));
}
bool
failover_soon(int i)
{
return (crossed_failover_number[i] &&
- ((ink_get_hrtime() - crossed_failover_number[i]) >
+ ((Thread::get_hrtime() - crossed_failover_number[i]) >
(HRTIME_SECONDS(dns_failover_try_period + failover_soon_number[i] * FAILOVER_SOON_RETRY))));
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/I_Lock.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Lock.h b/iocore/eventsystem/I_Lock.h
index 80d5f77..fe440ac 100644
--- a/iocore/eventsystem/I_Lock.h
+++ b/iocore/eventsystem/I_Lock.h
@@ -302,7 +302,7 @@ Mutex_trylock(
#ifdef DEBUG
m->srcloc = location;
m->handler = ahandler;
- m->hold_time = ink_get_hrtime();
+ m->hold_time = Thread::get_hrtime();
#ifdef MAX_LOCK_TAKEN
m->taken++;
#endif // MAX_LOCK_TAKEN
@@ -351,7 +351,7 @@ Mutex_trylock_spin(
#ifdef DEBUG
m->srcloc = location;
m->handler = ahandler;
- m->hold_time = ink_get_hrtime();
+ m->hold_time = Thread::get_hrtime();
#ifdef MAX_LOCK_TAKEN
m->taken++;
#endif // MAX_LOCK_TAKEN
@@ -384,7 +384,7 @@ Mutex_lock(
#ifdef DEBUG
m->srcloc = location;
m->handler = ahandler;
- m->hold_time = ink_get_hrtime();
+ m->hold_time = Thread::get_hrtime();
#ifdef MAX_LOCK_TAKEN
m->taken++;
#endif // MAX_LOCK_TAKEN
@@ -409,7 +409,7 @@ Mutex_unlock(ProxyMutex *m, EThread *t)
m->nthread_holding--;
if (!m->nthread_holding) {
#ifdef DEBUG
- if (ink_get_hrtime() - m->hold_time > MAX_LOCK_TIME)
+ if (Thread::get_hrtime() - m->hold_time > MAX_LOCK_TIME)
lock_holding(m->srcloc, m->handler);
#ifdef MAX_LOCK_TAKEN
if (m->taken > MAX_LOCK_TAKEN)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/I_Thread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
index 0fde539..9d74b69 100644
--- a/iocore/eventsystem/I_Thread.h
+++ b/iocore/eventsystem/I_Thread.h
@@ -155,10 +155,10 @@ public:
execute()
{
}
+
+ static ink_hrtime get_hrtime();
};
-extern ink_hrtime ink_get_hrtime();
-extern ink_hrtime ink_get_based_hrtime();
extern Thread *this_thread();
#endif /*_I_Thread_h*/
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/P_Thread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_Thread.h b/iocore/eventsystem/P_Thread.h
index 04c111d..c7cce80 100644
--- a/iocore/eventsystem/P_Thread.h
+++ b/iocore/eventsystem/P_Thread.h
@@ -53,16 +53,4 @@ this_thread()
return (Thread *)ink_thread_getspecific(Thread::thread_data_key);
}
-TS_INLINE ink_hrtime
-ink_get_hrtime()
-{
- return Thread::cur_time;
-}
-
-TS_INLINE ink_hrtime
-ink_get_based_hrtime()
-{
- return Thread::cur_time;
-}
-
#endif //_P_Thread_h_
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/P_UnixEThread.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_UnixEThread.h b/iocore/eventsystem/P_UnixEThread.h
index 19afaa4..f884f4b 100644
--- a/iocore/eventsystem/P_UnixEThread.h
+++ b/iocore/eventsystem/P_UnixEThread.h
@@ -76,7 +76,7 @@ EThread::schedule_in(Continuation *cont, ink_hrtime t, int callback_event, void
Event *e = ::eventAllocator.alloc();
e->callback_event = callback_event;
e->cookie = cookie;
- return schedule(e->init(cont, ink_get_based_hrtime() + t, 0));
+ return schedule(e->init(cont, get_hrtime() + t, 0));
}
TS_INLINE Event *
@@ -85,7 +85,7 @@ EThread::schedule_every(Continuation *cont, ink_hrtime t, int callback_event, vo
Event *e = ::eventAllocator.alloc();
e->callback_event = callback_event;
e->cookie = cookie;
- return schedule(e->init(cont, ink_get_based_hrtime() + t, t));
+ return schedule(e->init(cont, get_hrtime() + t, t));
}
TS_INLINE Event *
@@ -126,7 +126,7 @@ EThread::schedule_in_local(Continuation *cont, ink_hrtime t, int callback_event,
Event *e = EVENT_ALLOC(eventAllocator, this);
e->callback_event = callback_event;
e->cookie = cookie;
- return schedule_local(e->init(cont, ink_get_based_hrtime() + t, 0));
+ return schedule_local(e->init(cont, get_hrtime() + t, 0));
}
TS_INLINE Event *
@@ -135,7 +135,7 @@ EThread::schedule_every_local(Continuation *cont, ink_hrtime t, int callback_eve
Event *e = EVENT_ALLOC(eventAllocator, this);
e->callback_event = callback_event;
e->cookie = cookie;
- return schedule_local(e->init(cont, ink_get_based_hrtime() + t, t));
+ return schedule_local(e->init(cont, get_hrtime() + t, t));
}
TS_INLINE Event *
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/P_UnixEventProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/P_UnixEventProcessor.h b/iocore/eventsystem/P_UnixEventProcessor.h
index 132c977..d8d0feb 100644
--- a/iocore/eventsystem/P_UnixEventProcessor.h
+++ b/iocore/eventsystem/P_UnixEventProcessor.h
@@ -129,7 +129,7 @@ EventProcessor::schedule_in(Continuation *cont, ink_hrtime t, EventType et, int
ink_assert(et < MAX_EVENT_TYPES);
e->callback_event = callback_event;
e->cookie = cookie;
- return schedule(e->init(cont, ink_get_based_hrtime() + t, 0), et);
+ return schedule(e->init(cont, Thread::get_hrtime() + t, 0), et);
}
TS_INLINE Event *
@@ -144,7 +144,7 @@ EventProcessor::schedule_every(Continuation *cont, ink_hrtime t, EventType et, i
if (t < 0)
return schedule(e->init(cont, t, t), et);
else
- return schedule(e->init(cont, ink_get_based_hrtime() + t, t), et);
+ return schedule(e->init(cont, Thread::get_hrtime() + t, t), et);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/Thread.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Thread.cc b/iocore/eventsystem/Thread.cc
index 3dabb82..bc94737 100644
--- a/iocore/eventsystem/Thread.cc
+++ b/iocore/eventsystem/Thread.cc
@@ -101,3 +101,9 @@ Thread::start(const char *name, size_t stacksize, ThreadFunction f, void *a)
return tid;
}
+
+ink_hrtime
+Thread::get_hrtime()
+{
+ return Thread::cur_time;
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/UnixEThread.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc
index a30a4e3..fb3af43 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -134,7 +134,7 @@ EThread::process_event(Event *e, int calling_code)
if (e->period < 0)
e->timeout_at = e->period;
else {
- cur_time = ink_get_based_hrtime();
+ cur_time = get_hrtime();
e->timeout_at = cur_time + e->period;
if (e->timeout_at < cur_time)
e->timeout_at = cur_time;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/eventsystem/UnixEvent.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/UnixEvent.cc b/iocore/eventsystem/UnixEvent.cc
index 634cee9..91ca27b 100644
--- a/iocore/eventsystem/UnixEvent.cc
+++ b/iocore/eventsystem/UnixEvent.cc
@@ -69,7 +69,7 @@ Event::schedule_in(ink_hrtime atimeout_in, int acallback_event)
ink_assert(ethread == this_ethread());
if (in_the_priority_queue)
ethread->EventQueue.remove(this);
- timeout_at = ink_get_based_hrtime() + atimeout_in;
+ timeout_at = Thread::get_hrtime() + atimeout_in;
period = 0;
immediate = false;
mutex = continuation->mutex;
@@ -88,7 +88,7 @@ Event::schedule_every(ink_hrtime aperiod, int acallback_event)
if (aperiod < 0) {
timeout_at = aperiod;
} else {
- timeout_at = ink_get_based_hrtime() + aperiod;
+ timeout_at = Thread::get_hrtime() + aperiod;
}
period = aperiod;
immediate = false;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 73d9c58..c9c54d9 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -388,7 +388,7 @@ int
HostDBSyncer::sync_event(int, void *)
{
SET_HANDLER(&HostDBSyncer::wait_event);
- start_time = ink_get_hrtime();
+ start_time = Thread::get_hrtime();
hostDBProcessor.cache()->sync_partitions(this);
return EVENT_DONE;
}
@@ -397,7 +397,7 @@ HostDBSyncer::sync_event(int, void *)
int
HostDBSyncer::wait_event(int, void *)
{
- ink_hrtime next_sync = HRTIME_SECONDS(hostdb_sync_frequency) - (ink_get_hrtime() - start_time);
+ ink_hrtime next_sync = HRTIME_SECONDS(hostdb_sync_frequency) - (Thread::get_hrtime() - start_time);
SET_HANDLER(&HostDBSyncer::sync_event);
if (next_sync > HRTIME_MSECONDS(100))
@@ -524,7 +524,7 @@ HostDBProcessor::start(int, size_t)
//
// Set up hostdb_current_interval
//
- hostdb_current_interval = (unsigned int)(ink_get_based_hrtime() / HOST_DB_TIMEOUT_INTERVAL);
+ hostdb_current_interval = (unsigned int)(Thread::get_hrtime() / HOST_DB_TIMEOUT_INTERVAL);
HostDBContinuation *b = hostDBContAllocator.alloc();
SET_CONTINUATION_HANDLER(b, (HostDBContHandler)&HostDBContinuation::backgroundEvent);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/OCSPStapling.cc
----------------------------------------------------------------------
diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc
index a8d2a09..2c42f8f 100644
--- a/iocore/net/OCSPStapling.cc
+++ b/iocore/net/OCSPStapling.cc
@@ -256,7 +256,7 @@ query_responder(BIO *b, char *host, char *path, OCSP_REQUEST *req, int req_timeo
OCSP_REQ_CTX *ctx;
int rv;
- start = ink_get_hrtime();
+ start = Thread::get_hrtime();
end = ink_hrtime_add(start, ink_hrtime_from_sec(req_timeout));
ctx = OCSP_sendreq_new(b, path, NULL, -1);
@@ -266,7 +266,7 @@ query_responder(BIO *b, char *host, char *path, OCSP_REQUEST *req, int req_timeo
do {
rv = OCSP_sendreq_nbio(&resp, ctx);
ink_hrtime_sleep(HRTIME_MSECONDS(1));
- } while ((rv == -1) && BIO_should_retry(b) && (ink_get_hrtime() < end));
+ } while ((rv == -1) && BIO_should_retry(b) && (Thread::get_hrtime() < end));
OCSP_REQ_CTX_free(ctx);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/P_UnixNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index c3794e6..53e4e75 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -261,7 +261,7 @@ net_connections_to_throttle(ThrottleType t)
TS_INLINE void
check_shedding_warning()
{
- ink_hrtime t = ink_get_hrtime();
+ ink_hrtime t = Thread::get_hrtime();
if (t - last_shedding_warning > NET_THROTTLE_MESSAGE_EVERY) {
last_shedding_warning = t;
RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "number of connections reaching shedding limit");
@@ -291,7 +291,7 @@ check_net_throttle(ThrottleType t, ink_hrtime now)
TS_INLINE void
check_throttle_warning()
{
- ink_hrtime t = ink_get_hrtime();
+ ink_hrtime t = Thread::get_hrtime();
if (t - last_throttle_warning > NET_THROTTLE_MESSAGE_EVERY) {
last_throttle_warning = t;
RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many connections, throttling");
@@ -316,7 +316,7 @@ check_emergency_throttle(Connection &con)
int emergency = fds_limit - EMERGENCY_THROTTLE;
if (fd > emergency) {
int over = fd - emergency;
- emergency_throttle_time = ink_get_hrtime() + (over * over) * HRTIME_SECOND;
+ emergency_throttle_time = Thread::get_hrtime() + (over * over) * HRTIME_SECOND;
RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many open file descriptors, emergency throttling");
int hyper_emergency = fds_limit - HYPER_EMERGENCY_THROTTLE;
if (fd > hyper_emergency)
@@ -389,7 +389,7 @@ accept_error_seriousness(int res)
TS_INLINE void
check_transient_accept_error(int res)
{
- ink_hrtime t = ink_get_hrtime();
+ ink_hrtime t = Thread::get_hrtime();
if (!last_transient_accept_error || t - last_transient_accept_error > TRANSIENT_ACCEPT_ERROR_MESSAGE_EVERY) {
last_transient_accept_error = t;
Warning("accept thread received transient error: errno = %d", -res);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/P_UnixNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index 61cf925..a61113c 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -336,7 +336,7 @@ UnixNetVConnection::set_inactivity_timeout(ink_hrtime timeout)
} else
inactivity_timeout = 0;
#else
- next_inactivity_timeout_at = ink_get_hrtime() + timeout;
+ next_inactivity_timeout_at = Thread::get_hrtime() + timeout;
#endif
}
@@ -366,7 +366,7 @@ UnixNetVConnection::set_active_timeout(ink_hrtime timeout)
} else
active_timeout = 0;
#else
- next_activity_timeout_at = ink_get_hrtime() + timeout;
+ next_activity_timeout_at = Thread::get_hrtime() + timeout;
#endif
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 1cfb48b..60061fd 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -1007,7 +1007,7 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
sslHandShakeComplete = true;
if (sslHandshakeBeginTime) {
- const ink_hrtime ssl_handshake_time = ink_get_hrtime() - sslHandshakeBeginTime;
+ const ink_hrtime ssl_handshake_time = Thread::get_hrtime() - sslHandshakeBeginTime;
Debug("ssl", "ssl handshake time:%" PRId64, ssl_handshake_time);
sslHandshakeBeginTime = 0;
SSL_INCREMENT_DYN_STAT_EX(ssl_total_handshake_time_stat, ssl_handshake_time);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/SSLNextProtocolAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolAccept.cc b/iocore/net/SSLNextProtocolAccept.cc
index 8ea5001..6399e1d 100644
--- a/iocore/net/SSLNextProtocolAccept.cc
+++ b/iocore/net/SSLNextProtocolAccept.cc
@@ -117,7 +117,7 @@ SSLNextProtocolAccept::mainEvent(int event, void *edata)
{
SSLNetVConnection *netvc = ssl_netvc_cast(event, edata);
- netvc->sslHandshakeBeginTime = ink_get_hrtime();
+ netvc->sslHandshakeBeginTime = Thread::get_hrtime();
Debug("ssl", "[SSLNextProtocolAccept:mainEvent] event %d netvc %p", event, netvc);
switch (event) {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 214ab12..3c454a9 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -56,7 +56,7 @@ public:
check_inactivity(int event, Event *e)
{
(void)event;
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
NetHandler &nh = *get_NetHandler(this_ethread());
Debug("inactivity_cop_check", "Checking inactivity on Thread-ID #%d", this_ethread()->id);
@@ -576,7 +576,7 @@ NetHandler::manage_active_queue()
return true;
}
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
// loop over the non-active connections and try to close them
UnixNetVConnection *vc = active_queue.head;
@@ -614,7 +614,7 @@ void
NetHandler::manage_keep_alive_queue()
{
uint32_t total_connections_in = active_queue_size + keep_alive_queue_size;
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
Debug("net_queue", "max_connections_per_thread_in: %d total_connections_in: %d active_queue_size: %d keep_alive_queue_size: %d",
max_connections_per_thread_in, total_connections_in, active_queue_size, keep_alive_queue_size);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index 9533b0a..20e9e9a 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -54,7 +54,7 @@ send_throttle_message(NetAccept *na)
afd.events = POLLIN;
int n = 0;
- while (check_net_throttle(ACCEPT, ink_get_hrtime()) && n < THROTTLE_AT_ONCE - 1 && (socketManager.poll(&afd, 1, 0) > 0)) {
+ while (check_net_throttle(ACCEPT, Thread::get_hrtime()) && n < THROTTLE_AT_ONCE - 1 && (socketManager.poll(&afd, 1, 0) > 0)) {
int res = 0;
if ((res = na->server.accept(&con[n])) < 0)
return res;
@@ -115,7 +115,7 @@ net_accept(NetAccept *na, void *ep, bool blockable)
count++;
na->alloc_cache = NULL;
- vc->submit_time = ink_get_hrtime();
+ vc->submit_time = Thread::get_hrtime();
ats_ip_copy(&vc->server_addr, &vc->con.addr);
vc->mutex = new_ProxyMutex();
vc->action_ = *na->action_;
@@ -240,7 +240,7 @@ NetAccept::do_blocking_accept(EThread *t)
// do-while for accepting all the connections
// added by YTS Team, yamsat
do {
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
// Throttle accepts
@@ -251,7 +251,7 @@ NetAccept::do_blocking_accept(EThread *t)
} else if (send_throttle_message(this) < 0) {
goto Lerror;
}
- now = ink_get_hrtime();
+ now = Thread::get_hrtime();
}
if ((res = server.accept(&con)) < 0) {
@@ -358,7 +358,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
int loop = accept_till_done;
do {
- if (!backdoor && check_net_throttle(ACCEPT, ink_get_hrtime())) {
+ if (!backdoor && check_net_throttle(ACCEPT, Thread::get_hrtime())) {
ifd = -1;
return EVENT_CONT;
}
@@ -435,7 +435,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
vc->id = net_next_connection_number();
- vc->submit_time = ink_get_hrtime();
+ vc->submit_time = Thread::get_hrtime();
ats_ip_copy(&vc->server_addr, &vc->con.addr);
vc->set_is_transparent(server.f_inbound_transparent);
vc->mutex = new_ProxyMutex();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/UnixNetPages.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetPages.cc b/iocore/net/UnixNetPages.cc
index 07ff4d4..c1d9f74 100644
--- a/iocore/net/UnixNetPages.cc
+++ b/iocore/net/UnixNetPages.cc
@@ -60,7 +60,7 @@ struct ShowNet : public ShowCont {
return EVENT_DONE;
}
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
forl_LL(UnixNetVConnection, vc, nh->open_list)
{
// uint16_t port = ats_ip_port_host_order(&addr.sa);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index fe69d49..e03f15c 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -222,7 +222,7 @@ UnixNetProcessor::connect_re_internal(Continuation *cont, sockaddr const *target
NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
vc->id = net_next_connection_number();
- vc->submit_time = ink_get_hrtime();
+ vc->submit_time = Thread::get_hrtime();
vc->setSSLClientConnection(true);
ats_ip_copy(&vc->server_addr, target);
vc->mutex = cont->mutex;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/iocore/net/UnixNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index c4ec29c..ba96f24 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -82,7 +82,7 @@ net_activity(UnixNetVConnection *vc, EThread *thread)
}
#else
if (vc->inactivity_timeout_in)
- vc->next_inactivity_timeout_at = ink_get_hrtime() + vc->inactivity_timeout_in;
+ vc->next_inactivity_timeout_at = Thread::get_hrtime() + vc->inactivity_timeout_in;
else
vc->next_inactivity_timeout_at = 0;
#endif
@@ -873,7 +873,7 @@ UnixNetVConnection::set_enabled(VIO *vio)
}
#else
if (!next_inactivity_timeout_at && inactivity_timeout_in)
- next_inactivity_timeout_at = ink_get_hrtime() + inactivity_timeout_in;
+ next_inactivity_timeout_at = Thread::get_hrtime() + inactivity_timeout_in;
#endif
}
@@ -1094,7 +1094,7 @@ UnixNetVConnection::mainEvent(int event, Event *e)
/* BZ 49408 */
// ink_assert(inactivity_timeout_in);
// ink_assert(next_inactivity_timeout_at < ink_get_hrtime());
- if (!inactivity_timeout_in || next_inactivity_timeout_at > ink_get_hrtime())
+ if (!inactivity_timeout_in || next_inactivity_timeout_at > Thread::get_hrtime())
return EVENT_CONT;
signal_event = VC_EVENT_INACTIVITY_TIMEOUT;
signal_timeout_at = &next_inactivity_timeout_at;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/ICP.cc
----------------------------------------------------------------------
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index 89232a8..4acb633 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -293,7 +293,7 @@ ICPPeerReadCont::init(ICPProcessor *ICPpr, Peer *p, int lookup_local)
{
PeerReadData *s = PeerReadDataAllocator.alloc();
s->init();
- s->_start_time = ink_get_hrtime();
+ s->_start_time = Thread::get_hrtime();
s->_peer = p;
s->_next_state = READ_ACTIVE;
s->_cache_lookup_local = lookup_local;
@@ -458,7 +458,7 @@ ICPPeerReadCont::ICPPeerQueryCont(int /* event ATS_UNUSED */, Event * /* e ATS_U
Cache::generate_key(&key, &_state->_cachelookupURL, cfg->ICPCacheGeneration());
_state->_queryResult = ~CACHE_EVENT_LOOKUP_FAILED;
- _start_time = ink_get_hrtime();
+ _start_time = Thread::get_hrtime();
if (pluginFreshnessCalcFunc && cfg->ICPStaleLookup()) {
//////////////////////////////////////////////////////////////
@@ -911,7 +911,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData *s, Event *e)
MUTEX_UNTAKE_LOCK(ICPReqContMutex, ethread);
if (request_start_time) {
- ICP_SUM_DYN_STAT(total_icp_response_time_stat, (ink_get_hrtime() - request_start_time));
+ ICP_SUM_DYN_STAT(total_icp_response_time_stat, (Thread::get_hrtime() - request_start_time));
}
RECORD_ICP_STATE_CHANGE(s, 0, READ_NOT_ACTIVE);
s->_next_state = READ_NOT_ACTIVE;
@@ -936,7 +936,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData *s, Event *e)
} else {
// Last read was valid, see if any more read data before exiting
s->reset();
- s->_start_time = ink_get_hrtime();
+ s->_start_time = Thread::get_hrtime();
s->_next_state = READ_ACTIVE;
RECORD_ICP_STATE_CHANGE(s, 0, READ_ACTIVE);
break; // restart
@@ -1299,7 +1299,7 @@ ICPRequestCont::ICPStateMachine(int event, void *d)
_cont->handleEvent(_ret_status, (void *)&_ret_sockaddr);
}
MUTEX_UNTAKE_LOCK(mutex, this_ethread());
- ICP_SUM_DYN_STAT(total_icp_request_time_stat, (ink_get_hrtime() - _start_time));
+ ICP_SUM_DYN_STAT(total_icp_request_time_stat, (Thread::get_hrtime() - _start_time));
_next_state = ICP_WAIT_SEND_COMPLETE;
break; // move to next_state
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/ICP.h
----------------------------------------------------------------------
diff --git a/proxy/ICP.h b/proxy/ICP.h
index 3e022ce..40865e2 100644
--- a/proxy/ICP.h
+++ b/proxy/ICP.h
@@ -1180,7 +1180,7 @@ public:
inline void
SetRequestStartTime()
{
- _start_time = ink_get_hrtime();
+ _start_time = Thread::get_hrtime();
}
inline ink_hrtime
GetRequestStartTime()
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/ICPConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
index 6c84198..942e12a 100644
--- a/proxy/ICPConfig.cc
+++ b/proxy/ICPConfig.cc
@@ -805,7 +805,7 @@ Peer::LogRecvMsg(ICPMsg_t *m, int valid)
// Note: ICPMsg_t (m) is in native byte order
// Note numerous stats on a per peer basis
- _stats.last_receive = ink_get_hrtime();
+ _stats.last_receive = Thread::get_hrtime();
if ((m->h.opcode >= ICP_OP_QUERY) && (m->h.opcode <= ICP_OP_LAST)) {
_stats.recv[m->h.opcode]++;
} else {
@@ -962,7 +962,7 @@ ParentSiblingPeer::LogSendMsg(ICPMsg_t *m, sockaddr const * /* sa ATS_UNUSED */)
// Note: ICPMsg_t (m) is in network byte order
// Note numerous stats on a per peer basis
- _stats.last_send = ink_get_hrtime();
+ _stats.last_send = Thread::get_hrtime();
_stats.sent[m->h.opcode]++;
_stats.total_sent++;
}
@@ -1089,7 +1089,7 @@ MultiCastPeer::LogSendMsg(ICPMsg_t *m, sockaddr const *sa)
} else {
// Note numerous stats on MultiCast peer and each member peer
- _stats.last_send = ink_get_hrtime();
+ _stats.last_send = Thread::get_hrtime();
_stats.sent[m->h.opcode]++;
_stats.total_sent++;
@@ -1273,7 +1273,7 @@ ICPPeriodicCont::DoReconfigAction(int event, Event *e)
ink_hrtime
ICPlog::GetElapsedTime()
{
- return (ink_get_hrtime() - _s->_start_time);
+ return (Thread::get_hrtime() - _s->_start_time);
}
sockaddr const *
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index d5d354d..a764277 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -1703,7 +1703,7 @@ TSdrandom()
ink_hrtime
TShrtime()
{
- return ink_get_based_hrtime();
+ return Thread::get_hrtime();
}
////////////////////////////////////////////////////////////////////
@@ -6292,7 +6292,7 @@ TSVConnFdCreate(int fd)
vc->action_ = &a;
vc->id = net_next_connection_number();
- vc->submit_time = ink_get_hrtime();
+ vc->submit_time = Thread::get_hrtime();
vc->set_is_transparent(false);
vc->mutex = new_ProxyMutex();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/InkIOCoreAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkIOCoreAPI.cc b/proxy/InkIOCoreAPI.cc
index 58492d3..ecc05b0 100644
--- a/proxy/InkIOCoreAPI.cc
+++ b/proxy/InkIOCoreAPI.cc
@@ -352,7 +352,7 @@ TSVIOMutexGet(TSVIO viop)
ink_hrtime
INKBasedTimeGet()
{
- return ink_get_based_hrtime();
+ return Thread::get_hrtime();
}
/* UDP Connection Interface */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 4593e57..c71e203 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -579,7 +579,7 @@ cmd_check_internal(char * /* cmd ATS_UNUSED */, bool fix = false)
printf("%s\n\n", n);
- hostdb_current_interval = (ink_get_based_hrtime() / HRTIME_MINUTE);
+ hostdb_current_interval = (Thread::get_hrtime() / HRTIME_MINUTE);
#if 0
printf("Host Database\n");
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/PluginVC.cc
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 66f2d1b..723aa9d 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -188,7 +188,7 @@ PluginVC::main_handler(int event, void *data)
if (call_event == active_event) {
process_timeout(&active_event, VC_EVENT_ACTIVE_TIMEOUT);
} else if (call_event == inactive_event) {
- if (inactive_timeout_at && inactive_timeout_at < ink_get_hrtime()) {
+ if (inactive_timeout_at && inactive_timeout_at < Thread::get_hrtime()) {
process_timeout(&inactive_event, VC_EVENT_INACTIVITY_TIMEOUT);
call_event->cancel();
}
@@ -770,7 +770,7 @@ PluginVC::update_inactive_time()
if (inactive_event && inactive_timeout) {
// inactive_event->cancel();
// inactive_event = eventProcessor.schedule_in(this, inactive_timeout);
- inactive_timeout_at = ink_get_hrtime() + inactive_timeout;
+ inactive_timeout_at = Thread::get_hrtime() + inactive_timeout;
}
}
@@ -827,7 +827,7 @@ PluginVC::set_inactivity_timeout(ink_hrtime timeout_in)
{
inactive_timeout = timeout_in;
if (inactive_timeout != 0) {
- inactive_timeout_at = ink_get_hrtime() + inactive_timeout;
+ inactive_timeout_at = Thread::get_hrtime() + inactive_timeout;
if (inactive_event == NULL) {
inactive_event = eventProcessor.schedule_every(this, HRTIME_SECONDS(1));
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/StatSystem.cc
----------------------------------------------------------------------
diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc
index 391cdd8..ed90529 100644
--- a/proxy/StatSystem.cc
+++ b/proxy/StatSystem.cc
@@ -308,7 +308,7 @@ take_rusage_snap()
continue;
Note("getrusage [%d %s]", errno, strerror(errno));
} else
- rusage_snap_time = ink_get_hrtime();
+ rusage_snap_time = Thread::get_hrtime();
break;
}
Debug("rusage", "took rusage snap %" PRId64 "", rusage_snap_time);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/congest/Congestion.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc
index b66ddb0..f7e0883 100644
--- a/proxy/congest/Congestion.cc
+++ b/proxy/congest/Congestion.cc
@@ -618,7 +618,7 @@ CongestionEntry::sprint(char *buf, int buflen, int format)
ink_hrtime timestamp = 0;
char state;
if (pRecord->max_connection >= 0 && m_num_connections >= pRecord->max_connection) {
- timestamp = ink_hrtime_to_sec(ink_get_hrtime());
+ timestamp = ink_hrtime_to_sec(Thread::get_hrtime());
state = 'M';
} else {
timestamp = m_last_congested;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/congest/Congestion.h
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.h b/proxy/congest/Congestion.h
index 8bda326..760eae5 100644
--- a/proxy/congest/Congestion.h
+++ b/proxy/congest/Congestion.h
@@ -288,7 +288,7 @@ CongestionEntry::client_retry_after()
{
int prat = 0;
if (F_congested()) {
- prat = pRecord->proxy_retry_interval + m_history.last_event - ink_hrtime_to_sec(ink_get_hrtime());
+ prat = pRecord->proxy_retry_interval + m_history.last_event - ink_hrtime_to_sec(Thread::get_hrtime());
if (prat < 0)
prat = 0;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/congest/CongestionDB.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/CongestionDB.cc b/proxy/congest/CongestionDB.cc
index f2b5067..eedd853 100644
--- a/proxy/congest/CongestionDB.cc
+++ b/proxy/congest/CongestionDB.cc
@@ -128,7 +128,7 @@ static long congestEntryGCTime = 0;
void
preCongestEntryGC(void)
{
- congestEntryGCTime = (long)ink_hrtime_to_sec(ink_get_hrtime());
+ congestEntryGCTime = (long)ink_hrtime_to_sec(Thread::get_hrtime());
}
// if the entry contains useful info, return false -- keep it
@@ -315,7 +315,7 @@ CongestionDBCont::GC(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
{
MUTEX_TRY_LOCK(lock, bucket_mutex, this_ethread());
if (lock.is_locked()) {
- ink_hrtime now = ink_get_hrtime();
+ ink_hrtime now = Thread::get_hrtime();
now = ink_hrtime_to_sec(now);
theCongestionDB->RunTodoList(CDBC_pid);
Iter it;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 2942649..67e5710 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -94,7 +94,7 @@ milestone_update_api_time(TransactionMilestones &milestones, ink_hrtime &api_tim
bool active = api_timer >= 0;
if (!active)
api_timer = -api_timer;
- delta = ink_get_hrtime() - api_timer;
+ delta = Thread::get_hrtime() - api_timer;
api_timer = 0;
// Exactly zero is a problem because we want to signal *something* happened
// vs. no API activity at all. This can happen when the API time is less than
@@ -317,7 +317,7 @@ HttpSM::destroy()
void
HttpSM::init()
{
- milestones.sm_start = ink_get_hrtime();
+ milestones.sm_start = Thread::get_hrtime();
magic = HTTP_SM_MAGIC_ALIVE;
sm_id = 0;
@@ -468,7 +468,7 @@ HttpSM::start_sub_sm()
void
HttpSM::attach_client_session(HttpClientSession *client_vc, IOBufferReader *buffer_reader)
{
- milestones.ua_begin = ink_get_hrtime();
+ milestones.ua_begin = Thread::get_hrtime();
ink_assert(client_vc != NULL);
ua_session = client_vc;
@@ -597,7 +597,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
// the accept timeout by the HttpClientSession
//
if (client_request_hdr_bytes == 0) {
- milestones.ua_first_read = ink_get_hrtime();
+ milestones.ua_first_read = Thread::get_hrtime();
ua_session->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->transaction_no_activity_timeout_in));
}
/////////////////////
@@ -660,7 +660,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
}
http_parser_clear(&http_parser);
ua_entry->vc_handler = &HttpSM::state_watch_for_client_abort;
- milestones.ua_read_header_done = ink_get_hrtime();
+ milestones.ua_read_header_done = Thread::get_hrtime();
}
switch (state) {
@@ -826,7 +826,7 @@ HttpSM::state_watch_for_client_abort(int event, void *data)
ua_entry->read_vio->nbytes = ua_entry->read_vio->ndone;
}
mark_server_down_on_client_abort();
- milestones.ua_close = ink_get_hrtime();
+ milestones.ua_close = Thread::get_hrtime();
set_ua_abort(HttpTransact::ABORTED, event);
terminate_sm = true;
break;
@@ -967,7 +967,7 @@ HttpSM::state_read_push_response_header(int event, void *data)
// Disable further IO
ua_entry->read_vio->nbytes = ua_entry->read_vio->ndone;
http_parser_clear(&http_parser);
- milestones.server_read_header_done = ink_get_hrtime();
+ milestones.server_read_header_done = Thread::get_hrtime();
}
switch (state) {
@@ -1001,7 +1001,7 @@ HttpSM::state_raw_http_server_open(int event, void *data)
{
STATE_ENTER(&HttpSM::state_raw_http_server_open, event);
ink_assert(server_entry == NULL);
- milestones.server_connect_end = ink_get_hrtime();
+ milestones.server_connect_end = Thread::get_hrtime();
NetVConnection *netvc = NULL;
pending_action = NULL;
@@ -1313,7 +1313,7 @@ HttpSM::state_api_callout(int event, void *data)
plugin_lock = MUTEX_TAKE_TRY_LOCK(cur_hook->m_cont->mutex, mutex->thread_holding);
if (!plugin_lock) {
- api_timer = -ink_get_hrtime();
+ api_timer = -Thread::get_hrtime();
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_api_callout);
ink_assert(pending_action == NULL);
pending_action = mutex->thread_holding->schedule_in(this, HRTIME_MSECONDS(10));
@@ -1329,11 +1329,11 @@ HttpSM::state_api_callout(int event, void *data)
APIHook *hook = cur_hook;
cur_hook = cur_hook->next();
- api_timer = ink_get_hrtime();
+ api_timer = Thread::get_hrtime();
hook->invoke(TS_EVENT_HTTP_READ_REQUEST_HDR + cur_hook_id, this);
if (api_timer > 0) {
milestone_update_api_time(milestones, api_timer);
- api_timer = -ink_get_hrtime(); // set in order to track non-active callout duration
+ api_timer = -Thread::get_hrtime(); // set in order to track non-active callout duration
// which means that if we get back from the invoke with api_timer < 0 we're already
// tracking a non-complete callout from a chain so just let it ride. It will get cleaned
// up in state_api_callback.
@@ -1571,7 +1571,7 @@ HttpSM::state_http_server_open(int event, void *data)
// TODO decide whether to uncomment after finish testing redirect
// ink_assert(server_entry == NULL);
pending_action = NULL;
- milestones.server_connect_end = ink_get_hrtime();
+ milestones.server_connect_end = Thread::get_hrtime();
HttpServerSession *session;
switch (event) {
@@ -1702,7 +1702,7 @@ HttpSM::state_read_server_response_header(int event, void *data)
// the connect timeout when we set up to read the header
//
if (server_response_hdr_bytes == 0) {
- milestones.server_first_read = ink_get_hrtime();
+ milestones.server_first_read = Thread::get_hrtime();
if (t_state.api_txn_no_activity_timeout_value != -1) {
server_session->get_netvc()->set_inactivity_timeout(HRTIME_MSECONDS(t_state.api_txn_no_activity_timeout_value));
@@ -1739,7 +1739,7 @@ HttpSM::state_read_server_response_header(int event, void *data)
// Disable further IO
server_entry->read_vio->nbytes = server_entry->read_vio->ndone;
http_parser_clear(&http_parser);
- milestones.server_read_header_done = ink_get_hrtime();
+ milestones.server_read_header_done = Thread::get_hrtime();
}
switch (state) {
@@ -2057,7 +2057,7 @@ HttpSM::process_hostdb_info(HostDBInfo *r)
ink_assert(!t_state.host_db_info.round_robin);
}
- milestones.dns_lookup_end = ink_get_hrtime();
+ milestones.dns_lookup_end = Thread::get_hrtime();
if (is_debug_tag_set("http_timeout")) {
if (t_state.api_txn_dns_timeout_value != -1) {
@@ -2324,7 +2324,7 @@ int
HttpSM::state_cache_open_write(int event, void *data)
{
STATE_ENTER(&HttpSM : state_cache_open_write, event);
- milestones.cache_open_write_end = ink_get_hrtime();
+ milestones.cache_open_write_end = Thread::get_hrtime();
pending_action = NULL;
switch (event) {
@@ -2425,7 +2425,7 @@ int
HttpSM::state_cache_open_read(int event, void *data)
{
STATE_ENTER(&HttpSM::state_cache_open_read, event);
- milestones.cache_open_read_end = ink_get_hrtime();
+ milestones.cache_open_read_end = Thread::get_hrtime();
ink_assert(server_entry == NULL);
ink_assert(t_state.cache_info.object_read == 0);
@@ -2808,7 +2808,7 @@ HttpSM::tunnel_handler_server(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_server, event);
- milestones.server_close = ink_get_hrtime();
+ milestones.server_close = Thread::get_hrtime();
bool close_connection = false;
@@ -3048,7 +3048,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c)
STATE_ENTER(&HttpSM::tunnel_handler_ua, event);
ink_assert(c->vc == ua_session);
- milestones.ua_close = ink_get_hrtime();
+ milestones.ua_close = Thread::get_hrtime();
switch (event) {
case VC_EVENT_EOS:
@@ -3892,7 +3892,7 @@ HttpSM::do_hostdb_lookup()
ink_assert(t_state.dns_info.lookup_name != NULL);
ink_assert(pending_action == NULL);
- milestones.dns_lookup_begin = ink_get_hrtime();
+ milestones.dns_lookup_begin = Thread::get_hrtime();
bool use_srv_records = t_state.srv_lookup;
if (use_srv_records) {
@@ -4318,7 +4318,7 @@ HttpSM::do_cache_lookup_and_read()
HTTP_INCREMENT_TRANS_STAT(http_cache_lookups_stat);
- milestones.cache_open_read_begin = ink_get_hrtime();
+ milestones.cache_open_read_begin = Thread::get_hrtime();
t_state.cache_lookup_result = HttpTransact::CACHE_LOOKUP_NONE;
t_state.cache_info.lookup_count++;
// YTS Team, yamsat Plugin
@@ -4385,7 +4385,7 @@ HttpSM::do_cache_prepare_write()
{
// statistically no need to retry when we are trying to lock
// LOCK_URL_SECOND url because the server's behavior is unlikely to change
- milestones.cache_open_write_begin = ink_get_hrtime();
+ milestones.cache_open_write_begin = Thread::get_hrtime();
bool retry = (t_state.api_lock_url == HttpTransact::LOCK_URL_FIRST);
do_cache_prepare_action(&cache_sm, t_state.cache_info.object_read, retry);
}
@@ -4518,7 +4518,7 @@ HttpSM::do_http_server_open(bool raw)
DebugSM("http_seq", "[HttpSM::do_http_server_open] Sending request to server");
- milestones.server_connect = ink_get_hrtime();
+ milestones.server_connect = Thread::get_hrtime();
if (milestones.server_first_connect == 0) {
milestones.server_first_connect = milestones.server_connect;
}
@@ -4824,7 +4824,7 @@ HttpSM::do_api_callout_internal()
break;
case HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR:
cur_hook_id = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
- milestones.ua_begin_write = ink_get_hrtime();
+ milestones.ua_begin_write = Thread::get_hrtime();
break;
case HttpTransact::SM_ACTION_API_SM_SHUTDOWN:
if (callout_state == HTTP_API_IN_CALLOUT || callout_state == HTTP_API_DEFERED_SERVER_ERROR) {
@@ -4966,7 +4966,7 @@ HttpSM::mark_server_down_on_client_abort()
if (milestones.server_first_connect != 0 && milestones.server_first_read == 0) {
// Check to see if client waited for the threshold
// to declare the origin server as down
- ink_hrtime wait = ink_get_hrtime() - milestones.server_first_connect;
+ ink_hrtime wait = Thread::get_hrtime() - milestones.server_first_connect;
if (wait < 0) {
wait = 0;
}
@@ -5656,7 +5656,7 @@ HttpSM::setup_server_send_request()
server_request_body_bytes = msg_len;
}
- milestones.server_begin_write = ink_get_hrtime();
+ milestones.server_begin_write = Thread::get_hrtime();
server_entry->write_vio = server_entry->vc->do_io_write(this, hdr_length, buf_start);
}
@@ -6320,7 +6320,7 @@ HttpSM::setup_blind_tunnel(bool send_response_hdr)
IOBufferReader *r_from = from_ua_buf->alloc_reader();
IOBufferReader *r_to = to_ua_buf->alloc_reader();
- milestones.server_begin_write = ink_get_hrtime();
+ milestones.server_begin_write = Thread::get_hrtime();
if (send_response_hdr) {
client_response_hdr_bytes = write_response_header_into_buffer(&t_state.hdr_info.client_response, to_ua_buf);
} else {
@@ -6562,7 +6562,7 @@ HttpSM::kill_this()
void
HttpSM::update_stats()
{
- milestones.sm_finish = ink_get_hrtime();
+ milestones.sm_finish = Thread::get_hrtime();
if (t_state.cop_test_page && !t_state.http_config_param->record_cop_page) {
DebugSM("http_seq", "Skipping cop heartbeat logging & stats due to config");
@@ -6596,7 +6596,7 @@ HttpSM::update_stats()
// ua_close will not be assigned properly in some exceptional situation.
// TODO: Assign ua_close with suitable value when HttpTunnel terminates abnormally.
if (milestones.ua_close == 0 && milestones.ua_read_header_done > 0)
- milestones.ua_close = ink_get_hrtime();
+ milestones.ua_close = Thread::get_hrtime();
// request_process_time = The time after the header is parsed to the completion of the transaction
ink_hrtime request_process_time = milestones.ua_close - milestones.ua_read_header_done;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index f925775..c706c20 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8298,11 +8298,11 @@ ink_cluster_time(void)
#ifdef DEBUG
ink_mutex_acquire(&http_time_lock);
- ink_time_t local_time = ink_get_hrtime() / HRTIME_SECOND;
+ ink_time_t local_time = Thread::get_hrtime() / HRTIME_SECOND;
last_http_local_time = local_time;
ink_mutex_release(&http_time_lock);
#else
- ink_time_t local_time = ink_get_hrtime() / HRTIME_SECOND;
+ ink_time_t local_time = Thread::get_hrtime() / HRTIME_SECOND;
#endif
highest_delta = (int)HttpConfig::m_master.cluster_time_delta;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 332131b..2559f61 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1127,11 +1127,11 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
// Time to work on periodic events??
//
- now = ink_get_hrtime() / HRTIME_SECOND;
+ now = Thread::get_hrtime() / HRTIME_SECOND;
if (now >= last_time + PERIODIC_TASKS_INTERVAL) {
Debug("log-preproc", "periodic tasks for %" PRId64, (int64_t)now);
periodic_tasks(now);
- last_time = ink_get_hrtime() / HRTIME_SECOND;
+ last_time = Thread::get_hrtime() / HRTIME_SECOND;
}
// wait for more work; a spurious wake-up is ok since we'll just
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/738d9ed3/proxy/logging/LogObject.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index be65070..e3e8589 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -1411,7 +1411,7 @@ REGRESSION_TEST(LogObjectManager_Transfer)(RegressionTest *t, int /* atype ATS_U
rprintf(t, "mgr1 has %d objects, mgr2 has %d objects\n", (int)mgr1.get_num_objects(), (int)mgr2.get_num_objects());
rprintf(t, "running Log::periodoc_tasks()\n");
- Log::periodic_tasks(ink_get_hrtime() / HRTIME_SECOND);
+ Log::periodic_tasks(Thread::get_hrtime() / HRTIME_SECOND);
rprintf(t, "Log::periodoc_tasks() done\n");
}