Defines | Typedefs | Functions

ink_hrtime.h File Reference

A brief file description. More...

#include "ink_config.h"
#include "ink_assert.h"
#include "Compatability.h"
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
Include dependency graph for ink_hrtime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define HRTIME_FOREVER   (10*HRTIME_DECADE)
#define HRTIME_DECADE   (10*HRTIME_YEAR)
#define HRTIME_YEAR   (365*HRTIME_DAY+HRTIME_DAY/4)
#define HRTIME_WEEK   (7*HRTIME_DAY)
#define HRTIME_DAY   (24*HRTIME_HOUR)
#define HRTIME_HOUR   (60*HRTIME_MINUTE)
#define HRTIME_MINUTE   (60*HRTIME_SECOND)
#define HRTIME_SECOND   (1000*HRTIME_MSECOND)
#define HRTIME_MSECOND   (1000*HRTIME_USECOND)
#define HRTIME_USECOND   (1000*HRTIME_NSECOND)
#define HRTIME_NSECOND   (1LL)
#define HRTIME_APPROX_SECONDS(_x)   ((_x)>>30)
#define HRTIME_APPROX_FACTOR   (((float)(1<<30))/(((float)HRTIME_SECOND)))
#define HRTIME_YEARS(_x)   ((_x)*HRTIME_YEAR)
#define HRTIME_WEEKS(_x)   ((_x)*HRTIME_WEEK)
#define HRTIME_DAYS(_x)   ((_x)*HRTIME_DAY)
#define HRTIME_HOURS(_x)   ((_x)*HRTIME_HOUR)
#define HRTIME_MINUTES(_x)   ((_x)*HRTIME_MINUTE)
#define HRTIME_SECONDS(_x)   ((_x)*HRTIME_SECOND)
#define HRTIME_MSECONDS(_x)   ((_x)*HRTIME_MSECOND)
#define HRTIME_USECONDS(_x)   ((_x)*HRTIME_USECOND)
#define HRTIME_NSECONDS(_x)   ((_x)*HRTIME_NSECOND)
#define NT_TIMEBASE_DIFFERENCE_100NSECS   116444736000000000i64

Typedefs

typedef int64_t ink_hrtime

Functions

int squid_timestamp_to_buf (char *buf, unsigned int buf_size, long timestamp_sec, long timestamp_usec)
char * int64_to_str (char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars, unsigned int req_width=0, char pad_char='0')
static ink_hrtime ink_hrtime_from_years (unsigned int years)
static ink_hrtime ink_hrtime_from_weeks (unsigned int weeks)
static ink_hrtime ink_hrtime_from_days (unsigned int days)
static ink_hrtime ink_hrtime_from_mins (unsigned int mins)
static ink_hrtime ink_hrtime_from_sec (unsigned int sec)
static ink_hrtime ink_hrtime_from_msec (unsigned int msec)
static ink_hrtime ink_hrtime_from_usec (unsigned int usec)
static ink_hrtime ink_hrtime_from_nsec (unsigned int nsec)
static ink_hrtime ink_hrtime_from_timespec (const struct timespec *ts)
static ink_hrtime ink_hrtime_from_timeval (const struct timeval *tv)
static ink_hrtime ink_hrtime_to_years (ink_hrtime t)
static ink_hrtime ink_hrtime_to_weeks (ink_hrtime t)
static ink_hrtime ink_hrtime_to_days (ink_hrtime t)
static ink_hrtime ink_hrtime_to_mins (ink_hrtime t)
static ink_hrtime ink_hrtime_to_sec (ink_hrtime t)
static ink_hrtime ink_hrtime_to_msec (ink_hrtime t)
static ink_hrtime ink_hrtime_to_usec (ink_hrtime t)
static ink_hrtime ink_hrtime_to_nsec (ink_hrtime t)
static struct timespec ink_hrtime_to_timespec (ink_hrtime t)
static struct timeval ink_hrtime_to_timeval (ink_hrtime t)
static int ink_hrtime_to_timeval2 (ink_hrtime t, struct timeval *tv)
static ink_hrtime ink_get_hrtime_internal ()
static ink_hrtime ink_get_based_hrtime_internal ()
static struct timeval ink_gettimeofday ()
static int ink_gethrtimeofday (struct timeval *tp, void *)
static int ink_time ()
static int ink_hrtime_diff_msec (ink_hrtime t1, ink_hrtime t2)
static ink_hrtime ink_hrtime_diff (ink_hrtime t1, ink_hrtime t2)
static ink_hrtime ink_hrtime_add (ink_hrtime t1, ink_hrtime t2)
static void ink_hrtime_sleep (ink_hrtime delay)

Detailed Description

A brief file description.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file ink_hrtime.h.


Define Documentation

#define HRTIME_APPROX_FACTOR   (((float)(1<<30))/(((float)HRTIME_SECOND)))

Definition at line 95 of file ink_hrtime.h.

#define HRTIME_APPROX_SECONDS (   _x  )     ((_x)>>30)

Definition at line 94 of file ink_hrtime.h.

#define HRTIME_DAY   (24*HRTIME_HOUR)

Definition at line 86 of file ink_hrtime.h.

Referenced by ink_hrtime_to_days().

#define HRTIME_DAYS (   _x  )     ((_x)*HRTIME_DAY)

Definition at line 107 of file ink_hrtime.h.

Referenced by ink_hrtime_from_days().

#define HRTIME_DECADE   (10*HRTIME_YEAR)

Definition at line 83 of file ink_hrtime.h.

#define HRTIME_FOREVER   (10*HRTIME_DECADE)

Definition at line 82 of file ink_hrtime.h.

#define HRTIME_HOUR   (60*HRTIME_MINUTE)

Definition at line 87 of file ink_hrtime.h.

#define HRTIME_HOURS (   _x  )     ((_x)*HRTIME_HOUR)

Definition at line 108 of file ink_hrtime.h.

#define HRTIME_MINUTE   (60*HRTIME_SECOND)

Definition at line 88 of file ink_hrtime.h.

Referenced by ink_hrtime_to_mins().

#define HRTIME_MINUTES (   _x  )     ((_x)*HRTIME_MINUTE)

Definition at line 109 of file ink_hrtime.h.

Referenced by ink_hrtime_from_mins().

#define HRTIME_MSECOND   (1000*HRTIME_USECOND)
#define HRTIME_MSECONDS (   _x  )     ((_x)*HRTIME_MSECOND)

Definition at line 111 of file ink_hrtime.h.

Referenced by Vol::aggWriteDone(), aio_thread_main(), HttpSM::attach_server_session(), UpdateScheduler::ChildExitEventHandler(), Cache::deref(), CacheVC::derefRead(), Vol::dir_init_done(), CacheContinuation::disposeOfDataBuffer(), HttpSM::do_http_server_open(), ICPPeriodicCont::DoReconfigAction(), ConfigUpdateCallback::event_handler(), ClusterVConnectionCacheEvent::eventHandler(), RecursiveHttpGet::ExitEventHandler(), HttpSM::get_http_schedule(), PrefetchBlaster::handleEvent(), BlasterUrlList::handleEvent(), retryDisposeOfDataBuffer::handleRetryEvent(), UpdateSM::HandleSMEvent(), CacheVC::handleWriteLock(), ICPConfiguration::icp_config_change_callback(), ICPRequestCont::ICPRequestEvent(), KeepAliveLockHandler::init(), ClusterLoadMonitor::init(), ink_aio_start(), ink_hrtime_from_msec(), HttpUpdateSM::kill_this_async_hook(), CacheSync::mainEvent(), UDPNetHandler::mainNetEvent(), CacheDisk::openDone(), ClusterHandler::process_read(), RecProcess_set_config_update_interval_ms(), RecProcess_set_raw_stat_sync_interval_ms(), RecProcess_set_remote_sync_interval_ms(), RecProcessStart(), INKVConnInternal::retry(), Cache::scan(), CacheVC::scanObject(), CacheVC::scanUpdateDone(), CacheVC::scanVol(), UnixNetVConnection::send_OOB(), OpenDir::signal_readers(), ICPProcessor::start(), UDPNetHandler::startNetEvent(), HttpSM::state_api_callout(), HttpSM::state_read_server_response_header(), TSContSchedule(), TSContScheduleEvery(), TSHttpSchedule(), UDPNetHandler::UDPNetHandler(), HostDBSyncer::wait_event(), and write_dns_event().

#define HRTIME_NSECOND   (1LL)

Definition at line 92 of file ink_hrtime.h.

Referenced by ink_hrtime_to_nsec().

#define HRTIME_NSECONDS (   _x  )     ((_x)*HRTIME_NSECOND)

Definition at line 113 of file ink_hrtime.h.

Referenced by ink_hrtime_from_nsec().

#define HRTIME_SECOND   (1000*HRTIME_MSECOND)
#define HRTIME_SECONDS (   _x  )     ((_x)*HRTIME_SECOND)

Definition at line 110 of file ink_hrtime.h.

Referenced by HttpSM::attach_client_session(), HttpSM::attach_server_session(), HttpClientSession::attach_server_session(), InactivityCop::check_inactivity(), clusterAPI_init(), ClusterLoadMonitor::ClusterLoadMonitor(), ClusterState::ClusterState(), cmd_check_internal(), cmd_clear(), Congestion_CongestionDB(), Congestion_FailHistory(), CheckConnect::connect_s(), dir_sync_init(), HostDBContinuation::dnsEvent(), HostDBContinuation::do_dns(), HttpClientSession::do_io_close(), ClusterVConnectionCacheEvent::eventHandler(), DNSHandler::failover_now(), DNSHandler::failover_soon(), HttpSM::handle_api_return(), KeepAliveConn::handleEvent(), UpdateSM::HandleSMEvent(), http_config_cb(), UpdateScheduler::Init(), UpdateConfigManager::init(), SpdyClientSession::init(), SocksEntry::init(), GlobalClusterPeriodicEvent::init(), ClusterAccept::Init(), ClusterVConnectionCache::init(), init_tracker(), initialize_thread_for_net(), ink_hrtime_from_sec(), main(), ClusterHandler::mainClusterEvent(), SnapStatsContinuation::mainEvent(), SocksProxy::mainEvent(), SocksEntry::mainEvent(), CacheSync::mainEvent(), MultiCacheSync::mcEvent(), prefetch_config_cb(), SSLCertificateConfig::reconfigure(), HttpClientSession::release(), run_AutoStop(), run_RegressionTest(), PluginVC::set_inactivity_timeout(), UDPReadContinuation::set_timer(), SSLNetProcessor::start(), start_stats_snap(), NetVCTest::start_test(), SocksEntry::startEvent(), MultiCacheHeapGC::startEvent(), HttpSM::state_raw_http_server_open(), HttpSM::state_read_client_request_header(), HttpSM::state_read_server_response_header(), test(), EventNotify::timedwait(), HttpSM::tunnel_handler_ua(), LogObjectManager::unmanage_api_object(), HostDBSyncer::wait_event(), write_dns_event(), and ClusterHandler::zombify().

#define HRTIME_USECOND   (1000*HRTIME_NSECOND)
#define HRTIME_USECONDS (   _x  )     ((_x)*HRTIME_USECOND)

Definition at line 112 of file ink_hrtime.h.

Referenced by ink_hrtime_from_usec().

#define HRTIME_WEEK   (7*HRTIME_DAY)

Definition at line 85 of file ink_hrtime.h.

Referenced by ink_hrtime_to_weeks().

#define HRTIME_WEEKS (   _x  )     ((_x)*HRTIME_WEEK)

Definition at line 106 of file ink_hrtime.h.

Referenced by ink_hrtime_from_weeks().

#define HRTIME_YEAR   (365*HRTIME_DAY+HRTIME_DAY/4)

Definition at line 84 of file ink_hrtime.h.

Referenced by ink_hrtime_to_years().

#define HRTIME_YEARS (   _x  )     ((_x)*HRTIME_YEAR)

Definition at line 105 of file ink_hrtime.h.

Referenced by ink_hrtime_from_years().

#define NT_TIMEBASE_DIFFERENCE_100NSECS   116444736000000000i64

Definition at line 252 of file ink_hrtime.h.


Typedef Documentation

typedef int64_t ink_hrtime

Definition at line 45 of file ink_hrtime.h.


Function Documentation

static ink_hrtime ink_get_based_hrtime_internal (  )  [inline, static]
static ink_hrtime ink_get_hrtime_internal (  )  [inline, static]
static int ink_gethrtimeofday ( struct timeval *  tp,
void *   
) [inline, static]
static struct timeval ink_gettimeofday (  )  [static, read]

Definition at line 294 of file ink_hrtime.h.

References ink_get_based_hrtime_internal(), and ink_hrtime_to_timeval().

static ink_hrtime ink_hrtime_add ( ink_hrtime  t1,
ink_hrtime  t2 
) [inline, static]

Definition at line 324 of file ink_hrtime.h.

static ink_hrtime ink_hrtime_diff ( ink_hrtime  t1,
ink_hrtime  t2 
) [inline, static]

Definition at line 318 of file ink_hrtime.h.

static int ink_hrtime_diff_msec ( ink_hrtime  t1,
ink_hrtime  t2 
) [inline, static]

Definition at line 312 of file ink_hrtime.h.

References ink_hrtime_to_msec().

static ink_hrtime ink_hrtime_from_days ( unsigned int  days  )  [inline, static]

Definition at line 128 of file ink_hrtime.h.

References HRTIME_DAYS.

static ink_hrtime ink_hrtime_from_mins ( unsigned int  mins  )  [inline, static]

Definition at line 133 of file ink_hrtime.h.

References HRTIME_MINUTES.

static ink_hrtime ink_hrtime_from_msec ( unsigned int  msec  )  [inline, static]

Definition at line 143 of file ink_hrtime.h.

References HRTIME_MSECONDS.

Referenced by HttpSM::update_stats().

static ink_hrtime ink_hrtime_from_nsec ( unsigned int  nsec  )  [inline, static]

Definition at line 153 of file ink_hrtime.h.

References HRTIME_NSECONDS.

Referenced by ink_hrtime_from_timespec().

static ink_hrtime ink_hrtime_from_sec ( unsigned int  sec  )  [inline, static]
static ink_hrtime ink_hrtime_from_timespec ( const struct timespec *  ts  )  [inline, static]
static ink_hrtime ink_hrtime_from_timeval ( const struct timeval *  tv  )  [inline, static]
static ink_hrtime ink_hrtime_from_usec ( unsigned int  usec  )  [inline, static]

Definition at line 148 of file ink_hrtime.h.

References HRTIME_USECONDS.

Referenced by ink_hrtime_from_timeval().

static ink_hrtime ink_hrtime_from_weeks ( unsigned int  weeks  )  [inline, static]

Definition at line 123 of file ink_hrtime.h.

References HRTIME_WEEKS.

static ink_hrtime ink_hrtime_from_years ( unsigned int  years  )  [inline, static]

Definition at line 118 of file ink_hrtime.h.

References HRTIME_YEARS.

static void ink_hrtime_sleep ( ink_hrtime  delay  )  [inline, static]

Definition at line 330 of file ink_hrtime.h.

References ink_hrtime_to_timespec().

Referenced by SSLCertificateConfig::reconfigure().

static ink_hrtime ink_hrtime_to_days ( ink_hrtime  t  )  [inline, static]

Definition at line 187 of file ink_hrtime.h.

References HRTIME_DAY.

static ink_hrtime ink_hrtime_to_mins ( ink_hrtime  t  )  [inline, static]

Definition at line 192 of file ink_hrtime.h.

References HRTIME_MINUTE.

static ink_hrtime ink_hrtime_to_msec ( ink_hrtime  t  )  [inline, static]
static ink_hrtime ink_hrtime_to_nsec ( ink_hrtime  t  )  [inline, static]

Definition at line 212 of file ink_hrtime.h.

References HRTIME_NSECOND.

static ink_hrtime ink_hrtime_to_sec ( ink_hrtime  t  )  [inline, static]
static struct timespec ink_hrtime_to_timespec ( ink_hrtime  t  )  [static, read]
static struct timeval ink_hrtime_to_timeval ( ink_hrtime  t  )  [static, read]

Definition at line 228 of file ink_hrtime.h.

References ink_hrtime_to_usec().

Referenced by ink_gettimeofday().

static int ink_hrtime_to_timeval2 ( ink_hrtime  t,
struct timeval *  tv 
) [inline, static]

Definition at line 240 of file ink_hrtime.h.

References ink_hrtime_to_usec().

Referenced by ink_gethrtimeofday().

static ink_hrtime ink_hrtime_to_usec ( ink_hrtime  t  )  [inline, static]

Definition at line 207 of file ink_hrtime.h.

References HRTIME_USECOND.

Referenced by ink_hrtime_to_timeval(), and ink_hrtime_to_timeval2().

static ink_hrtime ink_hrtime_to_weeks ( ink_hrtime  t  )  [inline, static]

Definition at line 182 of file ink_hrtime.h.

References HRTIME_WEEK.

static ink_hrtime ink_hrtime_to_years ( ink_hrtime  t  )  [inline, static]

Definition at line 177 of file ink_hrtime.h.

References HRTIME_YEAR.

static int ink_time (  )  [inline, static]

Definition at line 306 of file ink_hrtime.h.

References ink_get_based_hrtime_internal(), and ink_hrtime_to_sec().

char* int64_to_str ( char *  buf,
unsigned int  buf_size,
int64_t  val,
unsigned int *  total_chars,
unsigned int  req_width = 0,
char  pad_char = '0' 
)

Definition at line 43 of file ink_hrtime.cc.

int squid_timestamp_to_buf ( char *  buf,
unsigned int  buf_size,
long  timestamp_sec,
long  timestamp_usec 
)

Definition at line 139 of file ink_hrtime.cc.

References ATS_UNUSED, ink_assert, int64_to_str(), and memcpy.

Referenced by LogBuffer::resolve_custom_entry().