hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/lib/find_bit_benchmark.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Test for find_*_bit functions.
34 *
45 * Copyright (c) 2017 Cavium.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of version 2 of the GNU General Public
8
- * License as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful, but
11
- * WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * General Public License for more details.
146 */
157
168 /*
....@@ -108,14 +100,13 @@
108100 const void *bitmap2, unsigned long len)
109101 {
110102 unsigned long i, cnt;
111
- cycles_t cycles;
103
+ ktime_t time;
112104
113
- cycles = get_cycles();
105
+ time = ktime_get();
114106 for (cnt = i = 0; i < BITMAP_LEN; cnt++)
115
- i = find_next_and_bit(bitmap, bitmap2, BITMAP_LEN, i+1);
116
- cycles = get_cycles() - cycles;
117
- pr_err("find_next_and_bit:\t\t%llu cycles, %ld iterations\n",
118
- (u64)cycles, cnt);
107
+ i = find_next_and_bit(bitmap, bitmap2, BITMAP_LEN, i + 1);
108
+ time = ktime_get() - time;
109
+ pr_err("find_next_and_bit: %18llu ns, %6ld iterations\n", time, cnt);
119110
120111 return 0;
121112 }