summaryrefslogtreecommitdiffstats
path: root/cpukit/libtrace
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-08-17 14:34:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-08-17 19:01:14 +0200
commit17331028e5c4bcc8150dd30c2c0d61a4d2642ab0 (patch)
treec7b987fb3883ccadfbd700713e2c977891605219 /cpukit/libtrace
parentrecord: Remove superfluous cast (diff)
downloadrtems-17331028e5c4bcc8150dd30c2c0d61a4d2642ab0.tar.bz2
record: Simplify client visit()
Diffstat (limited to 'cpukit/libtrace')
-rw-r--r--cpukit/libtrace/record/record-client.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/cpukit/libtrace/record/record-client.c b/cpukit/libtrace/record/record-client.c
index 269cf5b9ec..153b8e470c 100644
--- a/cpukit/libtrace/record/record-client.c
+++ b/cpukit/libtrace/record/record-client.c
@@ -299,6 +299,29 @@ static rtems_record_client_status hold_back(
return RTEMS_RECORD_CLIENT_SUCCESS;
}
+static uint64_t time_bt(
+ const rtems_record_client_context *ctx,
+ rtems_record_client_per_cpu *per_cpu,
+ uint32_t time
+)
+{
+ uint64_t bt;
+
+ if ( time != 0 ) {
+ uint32_t delta;
+
+ delta = ( time - per_cpu->uptime.time_last ) & TIME_MASK;
+ per_cpu->uptime.time_last = time;
+ per_cpu->uptime.time_accumulated += delta;
+ bt = ( per_cpu->uptime.time_accumulated * ctx->to_bt_scaler ) >> 31;
+ bt += per_cpu->uptime.bt;
+ } else {
+ bt = 0;
+ }
+
+ return bt;
+}
+
static rtems_record_client_status visit(
rtems_record_client_context *ctx,
uint32_t time_event,
@@ -308,7 +331,6 @@ static rtems_record_client_status visit(
rtems_record_client_per_cpu *per_cpu;
uint32_t time;
rtems_record_event event;
- uint64_t bt;
rtems_record_client_status status;
per_cpu = &ctx->per_cpu[ ctx->cpu ];
@@ -377,19 +399,7 @@ static rtems_record_client_status visit(
return hold_back( ctx, per_cpu, time_event, event, data );
}
- if ( time != 0 ) {
- uint32_t delta;
-
- delta = ( time - per_cpu->uptime.time_last ) & TIME_MASK;
- per_cpu->uptime.time_last = time;
- per_cpu->uptime.time_accumulated += delta;
- bt = ( per_cpu->uptime.time_accumulated * ctx->to_bt_scaler ) >> 31;
- bt += per_cpu->uptime.bt;
- } else {
- bt = 0;
- }
-
- return call_handler( ctx, bt, event, data );
+ return call_handler( ctx, time_bt( ctx, per_cpu, time ), event, data );
}
static rtems_record_client_status consume_32(