RTEMS CPU Kit with SuperCore
4.11.3
|
This handler encapsulates functionality related to manipulating POSIX struct timespecs. More...
![]() |
Files | |
file | timespecaddto.c |
Add to a Timespec. | |
file | timespecdivide.c |
Divide Timespec By Integer. | |
file | timespecdividebyinteger.c |
Divide Timespec By Integer. | |
file | timespecfromticks.c |
Convert Ticks to Timespec. | |
file | timespecgetasnanoseconds.c |
Get As Nanoseconds. | |
file | timespecisvalid.c |
Is Timespec Valid. | |
file | timespeclessthan.c |
Timespec Less Than Operator. | |
file | timespecsubtract.c |
Subtract Two Timespec. | |
Macros | |
#define | _Timespec_Set(_time, _seconds, _nanoseconds) |
Set timespec to seconds nanosecond. More... | |
#define | _Timespec_Set_to_zero(_time) |
Sets the Timespec to Zero. More... | |
#define | _Timespec_Get_seconds(_time) ((_time)->tv_sec) |
Get seconds portion of timespec. More... | |
#define | _Timespec_Get_nanoseconds(_time) ((_time)->tv_nsec) |
Get nanoseconds portion of timespec. More... | |
#define | _Timespec_Greater_than(_lhs, _rhs) _Timespec_Less_than( _rhs, _lhs ) |
The Timespec "greater than" operator. More... | |
#define | _Timespec_Equal_to(lhs, rhs) |
The Timespec "equal to" operator. More... | |
Functions | |
uint64_t | _Timespec_Get_as_nanoseconds (const struct timespec *time) |
Get the timestamp as nanoseconds. More... | |
bool | _Timespec_Is_valid (const struct timespec *time) |
Check if timespec is valid. More... | |
bool | _Timespec_Less_than (const struct timespec *lhs, const struct timespec *rhs) |
The Timespec "less than" operator. More... | |
uint32_t | _Timespec_Add_to (struct timespec *time, const struct timespec *add) |
Add two timespecs. More... | |
uint32_t | _Timespec_To_ticks (const struct timespec *time) |
Convert timespec to number of ticks. More... | |
void | _Timespec_From_ticks (uint32_t ticks, struct timespec *time) |
Convert ticks to timespec. More... | |
void | _Timespec_Subtract (const struct timespec *start, const struct timespec *end, struct timespec *result) |
Subtract two timespec. More... | |
void | _Timespec_Divide_by_integer (const struct timespec *time, uint32_t iterations, struct timespec *result) |
Divide timespec by an integer. More... | |
void | _Timespec_Divide (const struct timespec *lhs, const struct timespec *rhs, uint32_t *ival_percentage, uint32_t *fval_percentage) |
Divide a timespec by anonther timespec. More... | |
This handler encapsulates functionality related to manipulating POSIX struct timespecs.
#define _Timespec_Equal_to | ( | lhs, | |
rhs | |||
) |
The Timespec "equal to" operator.
This method is the is equal to than operator for timespecs.
[in] | lhs | is the left hand side timespec |
[in] | rhs | is the right hand side timespec |
This | method returns true if lhs is equal to rhs and false otherwise. |
Referenced by rtems_timespec_equal_to().
#define _Timespec_Get_nanoseconds | ( | _time | ) | ((_time)->tv_nsec) |
Get nanoseconds portion of timespec.
This method returns the nanoseconds portion of the specified timespec
[in] | _time | points to the timespec |
The | nanoseconds portion of _time. |
Referenced by rtems_timespec_get_nanoseconds().
#define _Timespec_Get_seconds | ( | _time | ) | ((_time)->tv_sec) |
Get seconds portion of timespec.
This method returns the seconds portion of the specified timespec
[in] | _time | points to the timespec |
The | seconds portion of _time. |
Referenced by rtems_timespec_get_seconds().
#define _Timespec_Greater_than | ( | _lhs, | |
_rhs | |||
) | _Timespec_Less_than( _rhs, _lhs ) |
The Timespec "greater than" operator.
This method is the greater than operator for timespecs.
[in] | _lhs | is the left hand side timespec |
[in] | _rhs | is the right hand side timespec |
This | method returns true if lhs is greater than the rhs and false otherwise. |
Referenced by rtems_timespec_greater_than().
#define _Timespec_Set | ( | _time, | |
_seconds, | |||
_nanoseconds | |||
) |
Set timespec to seconds nanosecond.
This method sets the timespec to the specified seconds and nanoseconds value.
[in] | _time | points to the timespec instance to validate. |
[in] | _seconds | is the seconds portion of the timespec |
[in] | _nanoseconds | is the nanoseconds portion of the timespec |
Referenced by rtems_timespec_set().
#define _Timespec_Set_to_zero | ( | _time | ) |
Sets the Timespec to Zero.
This method sets the timespec to zero. value.
[in] | _time | points to the timespec instance to zero. |
Referenced by rtems_timespec_zero().
uint32_t _Timespec_Add_to | ( | struct timespec * | time, |
const struct timespec * | add | ||
) |
Add two timespecs.
This routine adds two timespecs. The second argument is added to the first.
[in] | time | is the base time to be added to |
[in] | add | is the timespec to add to the first argument |
This | method returns the number of seconds time increased by. |
void _Timespec_Divide | ( | const struct timespec * | lhs, |
const struct timespec * | rhs, | ||
uint32_t * | ival_percentage, | ||
uint32_t * | fval_percentage | ||
) |
Divide a timespec by anonther timespec.
This routine divides a timespec by another timespec. The intended use is for calculating percentages to three decimal points.
[in] | lhs | is the left hand number |
[in] | rhs | is the right hand number |
[in] | ival_percentage | is the integer portion of the average |
[in] | fval_percentage | is the thousandths of percentage |
This | method fills in result. |
Referenced by _Timestamp_Divide(), and rtems_timespec_divide().
void _Timespec_Divide_by_integer | ( | const struct timespec * | time, |
uint32_t | iterations, | ||
struct timespec * | result | ||
) |
Divide timespec by an integer.
This routine divides a timespec by an integer value. The expected use is to assist in benchmark calculations where you typically divide a duration by a number of iterations.
[in] | time | is the total |
[in] | iterations | is the number of iterations |
[in] | result | is the average time. |
This | method fills in result. |
References TOD_NANOSECONDS_PER_SECOND.
Referenced by rtems_timespec_divide_by_integer().
void _Timespec_From_ticks | ( | uint32_t | ticks, |
struct timespec * | time | ||
) |
Convert ticks to timespec.
This routine converts the ticks value to the corresponding timespec format time.
[in] | time | is the timespec format time result |
[in] | ticks | is the number of ticks to convert |
Referenced by rtems_timespec_from_ticks().
uint64_t _Timespec_Get_as_nanoseconds | ( | const struct timespec * | time | ) |
Get the timestamp as nanoseconds.
This method returns the timestamp as nanoseconds.
[in] | time | points to the timestamp. |
The | time in nanoseconds. |
Referenced by _Timestamp_Get_as_nanoseconds().
bool _Timespec_Is_valid | ( | const struct timespec * | time | ) |
Check if timespec is valid.
This method determines the validity of a timespec.
[in] | time | is the timespec instance to validate. |
This | method returns true if time is valid and false otherwise. |
References TOD_NANOSECONDS_PER_SECOND.
Referenced by _POSIX_Absolute_timeout_to_ticks(), and rtems_timespec_is_valid().
bool _Timespec_Less_than | ( | const struct timespec * | lhs, |
const struct timespec * | rhs | ||
) |
The Timespec "less than" operator.
This method is the less than operator for timespecs.
[in] | lhs | is the left hand side timespec |
[in] | rhs | is the right hand side timespec |
This | method returns true if lhs is less than the rhs and false otherwise. |
Referenced by rtems_timespec_less_than().
void _Timespec_Subtract | ( | const struct timespec * | start, |
const struct timespec * | end, | ||
struct timespec * | result | ||
) |
Subtract two timespec.
This routine subtracts two timespecs. result is set to end - start.
[in] | start | is the starting time |
[in] | end | is the ending time |
[in] | result | is the difference between starting and ending time. |
This | method fills in result. |
uint32_t _Timespec_To_ticks | ( | const struct timespec * | time | ) |
Convert timespec to number of ticks.
This routine convert the time timespec to the corresponding number of clock ticks.
[in] | time | is the time to be converted |
This | method returns the number of ticks computed. |
Convert timespec to number of ticks.
We should ensure the ticks not be truncated by integer division. We need to have it be greater than or equal to the requested time. It should not be shorter.
References TOD_TICKS_PER_SECOND.
Referenced by _POSIX_Threads_Sporadic_budget_TSR(), and rtems_timespec_to_ticks().