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 | |
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')
-rw-r--r-- | cpukit/include/rtems/recordclient.h | 30 | ||||
-rw-r--r-- | cpukit/libtrace/record/record-client.c | 9 |
2 files changed, 29 insertions, 10 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 diff --git a/cpukit/libtrace/record/record-client.c b/cpukit/libtrace/record/record-client.c index 153b8e470c..cfe05fd43b 100644 --- a/cpukit/libtrace/record/record-client.c +++ b/cpukit/libtrace/record/record-client.c @@ -88,15 +88,8 @@ static rtems_record_client_status call_handler( uint64_t data ) { - uint32_t seconds; - uint32_t nanosec; - - seconds = (uint32_t) ( bt >> 32 ); - nanosec = (uint32_t) ( ( UINT64_C( 1000000000 ) * (uint32_t) bt ) >> 32 ); - return ( *ctx->handler )( - seconds, - nanosec, + bt, ctx->cpu, event, data, |