OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Travis Geiselbrecht | 2 * Copyright (c) 2012 Travis Geiselbrecht |
3 * | 3 * |
4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
5 * a copy of this software and associated documentation files | 5 * a copy of this software and associated documentation files |
6 * (the "Software"), to deal in the Software without restriction, | 6 * (the "Software"), to deal in the Software without restriction, |
7 * including without limitation the rights to use, copy, modify, merge, | 7 * including without limitation the rights to use, copy, modify, merge, |
8 * publish, distribute, sublicense, and/or sell copies of the Software, | 8 * publish, distribute, sublicense, and/or sell copies of the Software, |
9 * and to permit persons to whom the Software is furnished to do so, | 9 * and to permit persons to whom the Software is furnished to do so, |
10 * subject to the following conditions: | 10 * subject to the following conditions: |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include <lib/console.h> | 33 #include <lib/console.h> |
34 | 34 |
35 static int cmd_crc16(int argc, const cmd_args *argv); | 35 static int cmd_crc16(int argc, const cmd_args *argv); |
36 static int cmd_crc32(int argc, const cmd_args *argv); | 36 static int cmd_crc32(int argc, const cmd_args *argv); |
37 static int cmd_adler32(int argc, const cmd_args *argv); | 37 static int cmd_adler32(int argc, const cmd_args *argv); |
38 static int cmd_cksum_bench(int argc, const cmd_args *argv); | 38 static int cmd_cksum_bench(int argc, const cmd_args *argv); |
39 | 39 |
40 STATIC_COMMAND_START | 40 STATIC_COMMAND_START |
41 #if LK_DEBUGLEVEL > 0 | 41 #if LK_DEBUGLEVEL > 0 |
42 » { "crc16", "crc16", &cmd_crc16 }, | 42 » STATIC_COMMAND("crc16", "crc16", &cmd_crc16) |
43 » { "crc32", "crc32", &cmd_crc32 }, | 43 » STATIC_COMMAND("crc32", "crc32", &cmd_crc32) |
44 » { "adler32", "adler32", &cmd_adler32 }, | 44 » STATIC_COMMAND("adler32", "adler32", &cmd_adler32) |
45 #endif | 45 #endif |
46 #if LK_DEBUGLEVEL > 1 | 46 #if LK_DEBUGLEVEL > 1 |
47 » { "bench_cksum", "benchmark the checksum routines", &cmd_cksum_bench }, | 47 » STATIC_COMMAND("bench_cksum", "benchmark the checksum routines", &cmd_ck
sum_bench) |
48 #endif | 48 #endif |
49 STATIC_COMMAND_END(crc); | 49 STATIC_COMMAND_END(crc); |
50 | 50 |
51 static int cmd_crc16(int argc, const cmd_args *argv) | 51 static int cmd_crc16(int argc, const cmd_args *argv) |
52 { | 52 { |
53 if (argc < 3) { | 53 if (argc < 3) { |
54 printf("not enough arguments\n"); | 54 printf("not enough arguments\n"); |
55 printf("usage: %s <address> <size>\n", argv[0].str); | 55 printf("usage: %s <address> <size>\n", argv[0].str); |
56 return -1; | 56 return -1; |
57 } | 57 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 printf("took %llu usecs to adler32 %d bytes (%lld bytes/sec)\n", t, BUFS
IZE * ITER, (BUFSIZE * ITER) * 1000000ULL / t); | 136 printf("took %llu usecs to adler32 %d bytes (%lld bytes/sec)\n", t, BUFS
IZE * ITER, (BUFSIZE * ITER) * 1000000ULL / t); |
137 | 137 |
138 if (freebuf) | 138 if (freebuf) |
139 free(buf); | 139 free(buf); |
140 return 0; | 140 return 0; |
141 } | 141 } |
142 | 142 |
143 #endif // WITH_LIB_CONSOLE | 143 #endif // WITH_LIB_CONSOLE |
144 | 144 |
145 // vim: set noexpandtab: | 145 // vim: set noexpandtab: |
OLD | NEW |