#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <errno.h>#include <fcntl.h>#include <unistd.h>#include "bmz-internal.h"#include "test-helper.h"#include <sys/mman.h>

Go to the source code of this file.
Defines | |
| #define | TIMES(_n_, _code_) |
| #define | BENCH(_label_, _code_, _n_, _times_) |
| #define | LOG(_lvl_, _fmt_,...) |
| #define | DIE(_fmt_,...) |
| #define | O_BENCH_HASH (1 << 0) |
| #define | O_BENCH_LUT (1 << 1) |
| #define | O_CHECK_HASH (1 << 2) |
| #define | O_MEMCPY (1 << 3) |
| #define | O_HASH_MOD (1 << 4) |
| #define | O_HASH_MOD16X2 (1 << 5) |
| #define | O_HASH_MASK16X2 (1 << 6) |
| #define | O_HASH_MASK (1 << 7) |
| #define | O_HASH_MASK32X2 (1 << 8) |
| #define | O_DEFAULT (0xffffffff & ~O_CHECK_HASH) |
| #define | O_HASHES 0xfffffff0 |
Typedefs | |
| typedef long unsigned | Lu |
Functions | |
| static void | dump_bm (const char *label, const char *in, size_t len) |
| static void | test_bm_mod (const char *in, size_t len, char *out, size_t *len_p, void *work_mem) |
| static void | test_bm_mod16x2 (const char *in, size_t len, char *out, size_t *len_p, void *work_mem) |
| static void | test_bm_mask16x2 (const char *in, size_t len, char *out, size_t *len_p, void *work_mem) |
| static void | test_bm_mask (const char *in, size_t len, char *out, size_t *len_p, void *work_mem) |
| static void | test_bm_mask32x2 (const char *in, size_t len, char *out, size_t *len_p, void *work_mem) |
| static void | test_bm_unpack (const char *in, size_t len, char *out, size_t *len_p) |
| static char * | read_from_fp (FILE *fp, size_t *len_p) |
| static void | print_hash (const char *label, size_t h) |
| static void | show_hash (const char *data, size_t len) |
| static void | test_from_string (const char *data, size_t len) |
| static void | test_from_stdin () |
| static void | test_from_file (const char *fname) |
| static void | show_usage () |
| int | main (int ac, char *av[]) |
Variables | |
| static size_t | s_no_mmap = 0 |
| Copyright (C) 2007 Luke Lu (Zvents, Inc. | |
| static size_t | s_options = 0 |
| static size_t | s_fp_len = 20 |
| static size_t | s_offset = 0 |
| static size_t | s_times = 1 |
| static int | s_verbosity = 0 |
| static int | s_bm_dump = 0 |
| static int | s_show_hash = 0 |
| static size_t | s_b1 = 257 |
| static size_t | s_b2 = 277 |
| static size_t | s_m = 0xffffffff |
| static size_t | s_m1 = 0xffff |
| static size_t | s_m2 = (0xffff - 4) |
| #define BENCH | ( | _label_, | |||
| _code_, | |||||
| _n_, | |||||
| _times_ | ) |
Value:
do { \ double t1; \ HT_MEASURE(t1, TIMES(_times_, _code_)); \ printf("%16s: %.3fs (%.3fMB/s)\n", \ _label_, t1, (_n_) / 1e6 / t1 *(_times_)); \ fflush(stdout); fflush(stderr); \ } while (0)
Definition at line 44 of file bmz-test.c.
| #define DIE | ( | _fmt_, | |||
| ... | ) |
Value:
do { \ LOG(0, "fatal: " _fmt_, ##__VA_ARGS__); \ exit(1); \ } while (0)
Definition at line 56 of file bmz-test.c.
| #define LOG | ( | _lvl_, | |||
| _fmt_, | |||||
| ... | ) |
Value:
if (s_verbosity >= _lvl_) do { \ fprintf(stderr, "%s: " _fmt_ "\n", __FUNCTION__, ##__VA_ARGS__); \ } while(0)
Definition at line 52 of file bmz-test.c.
| #define O_BENCH_HASH (1 << 0) |
Definition at line 62 of file bmz-test.c.
| #define O_BENCH_LUT (1 << 1) |
Definition at line 63 of file bmz-test.c.
| #define O_CHECK_HASH (1 << 2) |
Definition at line 64 of file bmz-test.c.
| #define O_DEFAULT (0xffffffff & ~O_CHECK_HASH) |
Definition at line 71 of file bmz-test.c.
| #define O_HASH_MASK (1 << 7) |
Definition at line 69 of file bmz-test.c.
| #define O_HASH_MASK16X2 (1 << 6) |
Definition at line 68 of file bmz-test.c.
| #define O_HASH_MASK32X2 (1 << 8) |
Definition at line 70 of file bmz-test.c.
| #define O_HASH_MOD (1 << 4) |
Definition at line 66 of file bmz-test.c.
| #define O_HASH_MOD16X2 (1 << 5) |
Definition at line 67 of file bmz-test.c.
| #define O_HASHES 0xfffffff0 |
Definition at line 72 of file bmz-test.c.
| #define O_MEMCPY (1 << 3) |
Definition at line 65 of file bmz-test.c.
| #define TIMES | ( | _n_, | |||
| _code_ | ) |
Value:
do { \ size_t _n = _n_; \ while (_n--) { _code_; } \ } while (0)
Definition at line 39 of file bmz-test.c.
| typedef long unsigned Lu |
Definition at line 37 of file bmz-test.c.
| static void dump_bm | ( | const char * | label, | |
| const char * | in, | |||
| size_t | len | |||
| ) | [static] |
Definition at line 93 of file bmz-test.c.
| int main | ( | int | ac, | |
| char * | av[] | |||
| ) |
Definition at line 417 of file bmz-test.c.
| static void print_hash | ( | const char * | label, | |
| size_t | h | |||
| ) | [static] |
Definition at line 178 of file bmz-test.c.
| static char* read_from_fp | ( | FILE * | fp, | |
| size_t * | len_p | |||
| ) | [static] |
Definition at line 159 of file bmz-test.c.
| static void show_hash | ( | const char * | data, | |
| size_t | len | |||
| ) | [static] |
Definition at line 183 of file bmz-test.c.
| static void show_usage | ( | ) | [static] |
Definition at line 390 of file bmz-test.c.
| static void test_bm_mask | ( | const char * | in, | |
| size_t | len, | |||
| char * | out, | |||
| size_t * | len_p, | |||
| void * | work_mem | |||
| ) | [static] |
Definition at line 134 of file bmz-test.c.
| static void test_bm_mask16x2 | ( | const char * | in, | |
| size_t | len, | |||
| char * | out, | |||
| size_t * | len_p, | |||
| void * | work_mem | |||
| ) | [static] |
Definition at line 126 of file bmz-test.c.
| static void test_bm_mask32x2 | ( | const char * | in, | |
| size_t | len, | |||
| char * | out, | |||
| size_t * | len_p, | |||
| void * | work_mem | |||
| ) | [static] |
Definition at line 141 of file bmz-test.c.
| static void test_bm_mod | ( | const char * | in, | |
| size_t | len, | |||
| char * | out, | |||
| size_t * | len_p, | |||
| void * | work_mem | |||
| ) | [static] |
Definition at line 111 of file bmz-test.c.
| static void test_bm_mod16x2 | ( | const char * | in, | |
| size_t | len, | |||
| char * | out, | |||
| size_t * | len_p, | |||
| void * | work_mem | |||
| ) | [static] |
Definition at line 118 of file bmz-test.c.
| static void test_bm_unpack | ( | const char * | in, | |
| size_t | len, | |||
| char * | out, | |||
| size_t * | len_p | |||
| ) | [static] |
Definition at line 149 of file bmz-test.c.
| static void test_from_file | ( | const char * | fname | ) | [static] |
Definition at line 347 of file bmz-test.c.
| static void test_from_stdin | ( | ) | [static] |
Definition at line 340 of file bmz-test.c.
| static void test_from_string | ( | const char * | data, | |
| size_t | len | |||
| ) | [static] |
Definition at line 202 of file bmz-test.c.
size_t s_b1 = 257 [static] |
Definition at line 86 of file bmz-test.c.
size_t s_b2 = 277 [static] |
Definition at line 87 of file bmz-test.c.
int s_bm_dump = 0 [static] |
Definition at line 80 of file bmz-test.c.
size_t s_fp_len = 20 [static] |
Definition at line 76 of file bmz-test.c.
size_t s_m = 0xffffffff [static] |
Definition at line 88 of file bmz-test.c.
size_t s_m1 = 0xffff [static] |
Definition at line 89 of file bmz-test.c.
size_t s_m2 = (0xffff - 4) [static] |
Definition at line 90 of file bmz-test.c.
size_t s_no_mmap = 0 [static] |
Copyright (C) 2007 Luke Lu (Zvents, Inc.
)
This file is part of Hypertable.
Hypertable is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
Hypertable is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Hypertable. If not, see <http://www.gnu.org/licenses/>
Definition at line 31 of file bmz-test.c.
size_t s_offset = 0 [static] |
Definition at line 77 of file bmz-test.c.
size_t s_options = 0 [static] |
Definition at line 75 of file bmz-test.c.
int s_show_hash = 0 [static] |
Definition at line 81 of file bmz-test.c.
size_t s_times = 1 [static] |
Definition at line 78 of file bmz-test.c.
int s_verbosity = 0 [static] |
Definition at line 79 of file bmz-test.c.
1.5.9