Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

time_util.h File Reference


Detailed Description

Inline functions for manipulating time values.

Definition in file time_util.h.

Include dependency graph for time_util.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define MICROS_PER_SECOND   1000000
 The number of microseconds per second.

#define NANOS_PER_MICRO   1000
 The number of nanoseconds per microsecond.

#define tscmp(tvp, uvp, cmp)
 Compare two timespec's.


Functions

timespec microsec_to_timespec (unsigned long long microseconds)
 Convert a microsecond value to a struct timespec.

unsigned long long timespec_to_microsec (struct timespec *time_spec)
 Convert a timespec to a microsecond value.

int string_to_microsec (unsigned long long *us_out, const char *str)
 Convert a string to a microsecond value.


Define Documentation

#define tscmp tvp,
uvp,
cmp   ) 
 

Value:

(((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
            ((tvp)->tv_nsec cmp (uvp)->tv_nsec) :                       \
            ((tvp)->tv_sec cmp (uvp)->tv_sec))
Compare two timespec's.

Parameters:
tvp Pointer to the first timespec.
uvp Pointer to the second timespec.
cmp The comparison operator.

Definition at line 95 of file time_util.h.

Referenced by rk_cpu_reserve_attr_valid(), rk_cpu_reserve_ctl(), and rk_next_tick().


Function Documentation

struct timespec microsec_to_timespec unsigned long long  microseconds  )  [inline, static]
 

Convert a microsecond value to a struct timespec.

Parameters:
microseconds The microsecond value to convert.
Returns:
A timespec that represents the given number of microseconds.

Definition at line 44 of file time_util.h.

References MICROS_PER_SECOND, microsec_to_timespec(), and NANOS_PER_MICRO.

Referenced by RKTask::BeginCPUScheduling(), RKObserverAdvocate::BeginCPUScheduling(), microsec_to_timespec(), WeightedPolicyImpl::RedistributeCPU(), StrictPolicyImpl::RedistributeCPU(), rk_cpu_reserve_create(), rk_cpu_reserve_tick(), RKObserverAdvocate::RKObserverAdvocate(), RKTask::RKTask(), and RKTask::SetComputeTime().

Here is the call graph for this function:

int string_to_microsec unsigned long long *  us_out,
const char *  str
 

Convert a string to a microsecond value.

The string format is a number followed by an optional unit notation, where microseconds is the default unit. For example:

  • 10 = 10 microseconds
  • 10us = 10 microseconds
  • 10ms = 10,000 microseconds
  • 10s = 10,000,000 microseconds
Parameters:
us_out The destination for the microsecond value.
str The string to parse.
Returns:
True if the string was successfully parsed, false otherwise.

Definition at line 29 of file time_util.c.

References ensure, and require.

Referenced by RKObserverAdvocate::BeginCPUScheduling(), RKTask::BeginCPUScheduling(), bfRealTimeTaskHey(), paProcessOptions(), rktProcessOptions(), and RealTimeSchedule::setParameters().

unsigned long long timespec_to_microsec struct timespec *  time_spec  )  [inline, static]
 

Convert a timespec to a microsecond value.

NOTE: There is a loss of precision in the conversion.

Parameters:
time_spec The timespec to convert.
Returns:
The number of microseconds specified by the timespec.

Definition at line 61 of file time_util.h.

References MICROS_PER_SECOND, NANOS_PER_MICRO, and require.

Referenced by c1_pre(), RKTask::Deadline(), RKTask::GetComputeTime(), RKTask::Period(), BasicDelegate::postcall(), RKTask::ReportCPU(), rk_cpu_reserve_create(), rk_cpu_reserve_tick(), rk_stub_next_tick(), and RKObserverAdvocate::run().


Generated on Tue Jun 22 14:51:44 2004 for CPU Broker by doxygen 1.3.6