Bluetooth: Add timing information to ECDH test case runs
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 30 Dec 2014 08:11:21 +0000 (00:11 -0800)
committerJohan Hedberg <johan.hedberg@intel.com>
Tue, 30 Dec 2014 08:32:11 +0000 (10:32 +0200)
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>
net/bluetooth/selftest.c

index a7602b3d0b0d842e6ef9ac6d5347f1409b918817..9c67315172cf2185457d355df5bb527f85b98d06 100644 (file)
@@ -156,8 +156,12 @@ static int __init test_ecdh_sample(const u8 priv_a[32], const u8 priv_b[32],
 
 static int __init test_ecdh(void)
 {
+       ktime_t calltime, delta, rettime;
+       unsigned long long duration;
        int err;
 
+       calltime = ktime_get();
+
        err = test_ecdh_sample(priv_a_1, priv_b_1, pub_a_1, pub_b_1, dhkey_1);
        if (err) {
                BT_ERR("ECDH sample 1 failed");
@@ -176,7 +180,11 @@ static int __init test_ecdh(void)
                return err;
        }
 
-       BT_INFO("ECDH test passed");
+       rettime = ktime_get();
+       delta = ktime_sub(rettime, calltime);
+       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
+
+       BT_INFO("ECDH test passed in %lld usecs", duration);
 
        return 0;
 }