diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-08-17 14:49:42 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-08-17 19:01:14 +0200 |
commit | c91f6f5f4e236688ba8acb204fe85dc88adaaf0e (patch) | |
tree | fcbbbf70fac8c81bfc8ad6bc76dc391f45bc17ea /cpukit/include/rtems/recordclient.h | |
parent | record: Simplify client visit() (diff) | |
download | rtems-c91f6f5f4e236688ba8acb204fe85dc88adaaf0e.tar.bz2 |
record: Pass bintime to client handlers
This is a minor optimization.
Diffstat (limited to 'cpukit/include/rtems/recordclient.h')
-rw-r--r-- | cpukit/include/rtems/recordclient.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/cpukit/include/rtems/recordclient.h b/cpukit/include/rtems/recordclient.h index 35963bd87c..d38a8a731d 100644 --- a/cpukit/include/rtems/recordclient.h +++ b/cpukit/include/rtems/recordclient.h @@ -65,8 +65,7 @@ typedef enum { } rtems_record_client_status; typedef rtems_record_client_status ( *rtems_record_client_handler )( - uint32_t seconds, - uint32_t nanoseconds, + uint64_t bt, uint32_t cpu, rtems_record_event event, uint64_t data, @@ -196,6 +195,33 @@ void rtems_record_client_destroy( rtems_record_client_context *ctx ); +static inline uint64_t rtems_record_client_bintime_to_nanoseconds( + uint64_t bt +) +{ + uint64_t ns_per_sec; + uint64_t nanoseconds; + + ns_per_sec = 1000000000ULL; + nanoseconds = ns_per_sec * ( (uint32_t) ( bt >> 32 ) ); + nanoseconds += ( ns_per_sec * (uint32_t) bt ) >> 32; + + return nanoseconds; +} + +static inline void rtems_record_client_bintime_to_seconds_and_nanoseconds( + uint64_t bt, + uint32_t *seconds, + uint32_t *nanoseconds +) +{ + uint64_t ns_per_sec; + + ns_per_sec = 1000000000ULL; + *seconds = (uint32_t) ( bt >> 32 ); + *nanoseconds = (uint32_t) ( ( ns_per_sec * (uint32_t) bt ) >> 32 ); +} + /** @} */ #ifdef __cplusplus |