diff options
author | Bob Pearson <rpearson@systemfabricworks.com> | 2012-03-23 18:02:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 19:58:37 -0400 |
commit | 3863ef31dcf04f977a94402348fec06179db58e0 (patch) | |
tree | 98c50d517472247290b6ccad62b7575d688e0dd6 /lib/Kconfig | |
parent | fbedceb10066430b925cf43fbf926e8abb9e2359 (diff) |
crc32: simplify unit test code
Replace the unit test provided in crc32.c, which doesn't have a makefile
and doesn't compile with current headers, with a simpler self test
routine that also gives a measure of performance and runs at module init
time. The self test option can be enabled through a configuration
option CONFIG_CRC32_SELFTEST.
The test stresses the pre and post loops and is thus not very realistic
since actual uses will likely have addresses and lengths that are at
least 4 byte aligned. However, the main loop is long enough so that the
performance is dominated by that loop.
The expected values for crc32_le and crc32_be were generated with the
original version of crc32.c using CRC_BITS_LE = 8 and CRC_BITS_BE = 8.
These values were then used to check all the values of the BITS
parameters in both the original and new versions.
The performance results show some variability from run to run in spite
of attempts to both warm the cache and reduce the amount of OS noise by
limiting interrutps during the test. To get comparable results and to
analyse options wrt performance the best time reported over a small
sample of runs has been taken.
[djwong@us.ibm.com: Minor changelog tweaks]
Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/Kconfig')
-rw-r--r-- | lib/Kconfig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 028aba9e72af..d5a86aa441ac 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -70,6 +70,16 @@ config CRC32 | |||
70 | kernel tree does. Such modules that use library CRC32 functions | 70 | kernel tree does. Such modules that use library CRC32 functions |
71 | require M here. | 71 | require M here. |
72 | 72 | ||
73 | config CRC32_SELFTEST | ||
74 | bool "CRC32 perform self test on init" | ||
75 | default n | ||
76 | depends on CRC32 | ||
77 | help | ||
78 | This option enables the CRC32 library functions to perform a | ||
79 | self test on initialization. The self test computes crc32_le | ||
80 | and crc32_be over byte strings with random alignment and length | ||
81 | and computes the total elapsed time and number of bytes processed. | ||
82 | |||
73 | config CRC7 | 83 | config CRC7 |
74 | tristate "CRC7 functions" | 84 | tristate "CRC7 functions" |
75 | help | 85 | help |