Skip to content

Commit e64b4fb

Browse files
holtmannjhedberg
authored andcommitted
Bluetooth: Add timing information to ECDH test case runs
After successful completion of the ECDH test cases, print the time it took to run them. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent 255047b commit e64b4fb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎net/bluetooth/selftest.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ static int __init test_ecdh_sample(const u8 priv_a[32], const u8 priv_b[32],
156156

157157
static int __init test_ecdh(void)
158158
{
159+
ktime_t calltime, delta, rettime;
160+
unsigned long long duration;
159161
int err;
160162

163+
calltime = ktime_get();
164+
161165
err = test_ecdh_sample(priv_a_1, priv_b_1, pub_a_1, pub_b_1, dhkey_1);
162166
if (err) {
163167
BT_ERR("ECDH sample 1 failed");
@@ -176,7 +180,11 @@ static int __init test_ecdh(void)
176180
return err;
177181
}
178182

179-
BT_INFO("ECDH test passed");
183+
rettime = ktime_get();
184+
delta = ktime_sub(rettime, calltime);
185+
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
186+
187+
BT_INFO("ECDH test passed in %lld usecs", duration);
180188

181189
return 0;
182190
}

0 commit comments

Comments
 (0)