| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Test for find_*_bit functions. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 14 | 6 | */ |
|---|
| 15 | 7 | |
|---|
| 16 | 8 | /* |
|---|
| .. | .. |
|---|
| 108 | 100 | const void *bitmap2, unsigned long len) |
|---|
| 109 | 101 | { |
|---|
| 110 | 102 | unsigned long i, cnt; |
|---|
| 111 | | - cycles_t cycles; |
|---|
| 103 | + ktime_t time; |
|---|
| 112 | 104 | |
|---|
| 113 | | - cycles = get_cycles(); |
|---|
| 105 | + time = ktime_get(); |
|---|
| 114 | 106 | 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); |
|---|
| 119 | 110 | |
|---|
| 120 | 111 | return 0; |
|---|
| 121 | 112 | } |
|---|