Skip to content

Commit

Permalink
Moved start timestamp to after some additional initialization to get …
Browse files Browse the repository at this point in the history
…more accurate timing
  • Loading branch information
Magnus Feuer committed Mar 4, 2019
1 parent ef34bde commit ad29180
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rmc_proto_test_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,14 @@ static int process_incoming_signal(rmc_sub_context_t* ctx,
expect[node_id].max_received = 0;
expect[node_id].expect_sum = 0;
expect[node_id].calc_sum = 0;
expect[node_id].start_ts = rmc_usec_monotonic_timestamp();
expect[node_id].stop_ts = 0;

// Calculate sum
for(ind = 1; ind <= max_expected; ++ind)
expect[node_id].expect_sum += ind;

expect[node_id].start_ts = rmc_usec_monotonic_timestamp();

RMC_LOG_INDEX_INFO(index,
"Activate: node_id[%u] current[%lu] max_expected[%lu] expected sum[%lu]",
node_id, current, max_expected, expect[node_id].calc_sum);
Expand Down Expand Up @@ -204,10 +205,8 @@ static int process_incoming_signal(rmc_sub_context_t* ctx,
exit(0);
}


expect[node_id].status = RMC_TEST_SUB_COMPLETED;
expect[node_id].stop_ts = rmc_usec_monotonic_timestamp();

signal_sec = (int) expect[node_id].max_received /
((double) (expect[node_id].stop_ts - expect[node_id].start_ts) / 1000000.0);

Expand Down

0 comments on commit ad29180

Please sign in to comment.