0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Typedefs | Functions | Variables
bmz-test.c File Reference
#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>
Include dependency graph for bmz-test.c:

Go to the source code of this file.

Macros

#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-2015 Hypertable, Inc. More...
 
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)
 

Macro Definition Documentation

#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)
#define TIMES(_n_, _code_)
Definition: bmz-test.c:41
#define HT_MEASURE(_t_, _code_)
Definition: test-helper.h:27

Definition at line 46 of file bmz-test.c.

#define DIE (   _fmt_,
  ... 
)
Value:
do { \
LOG(0, "fatal: " _fmt_, ##__VA_ARGS__); \
exit(1); \
} while (0)
#define LOG(_lvl_, _fmt_,...)
Definition: bmz-test.c:54

Definition at line 58 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)
static int s_verbosity
Definition: bmz-test.c:81

Definition at line 54 of file bmz-test.c.

#define O_BENCH_HASH   (1 << 0)

Definition at line 64 of file bmz-test.c.

#define O_BENCH_LUT   (1 << 1)

Definition at line 65 of file bmz-test.c.

#define O_CHECK_HASH   (1 << 2)

Definition at line 66 of file bmz-test.c.

#define O_DEFAULT   (0xffffffff & ~O_CHECK_HASH)

Definition at line 73 of file bmz-test.c.

#define O_HASH_MASK   (1 << 7)

Definition at line 71 of file bmz-test.c.

#define O_HASH_MASK16X2   (1 << 6)

Definition at line 70 of file bmz-test.c.

#define O_HASH_MASK32X2   (1 << 8)

Definition at line 72 of file bmz-test.c.

#define O_HASH_MOD   (1 << 4)

Definition at line 68 of file bmz-test.c.

#define O_HASH_MOD16X2   (1 << 5)

Definition at line 69 of file bmz-test.c.

#define O_HASHES   0xfffffff0

Definition at line 74 of file bmz-test.c.

#define O_MEMCPY   (1 << 3)

Definition at line 67 of file bmz-test.c.

#define TIMES (   _n_,
  _code_ 
)
Value:
do { \
size_t _n = _n_; \
while (_n--) { _code_; } \
} while (0)

Definition at line 41 of file bmz-test.c.

Typedef Documentation

typedef long unsigned Lu

Definition at line 39 of file bmz-test.c.

Function Documentation

static void dump_bm ( const char *  label,
const char *  in,
size_t  len 
)
static

Definition at line 95 of file bmz-test.c.

int main ( int  ac,
char *  av[] 
)

Definition at line 419 of file bmz-test.c.

static void print_hash ( const char *  label,
size_t  h 
)
static

Definition at line 180 of file bmz-test.c.

static char* read_from_fp ( FILE *  fp,
size_t *  len_p 
)
static

Definition at line 161 of file bmz-test.c.

static void show_hash ( const char *  data,
size_t  len 
)
static

Definition at line 185 of file bmz-test.c.

static void show_usage ( )
static

Definition at line 392 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 136 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 128 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 143 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 113 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 120 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 151 of file bmz-test.c.

static void test_from_file ( const char *  fname)
static

Definition at line 349 of file bmz-test.c.

static void test_from_stdin ( )
static

Definition at line 342 of file bmz-test.c.

static void test_from_string ( const char *  data,
size_t  len 
)
static

Definition at line 204 of file bmz-test.c.

Variable Documentation

size_t s_b1 = 257
static

Definition at line 88 of file bmz-test.c.

size_t s_b2 = 277
static

Definition at line 89 of file bmz-test.c.

int s_bm_dump = 0
static

Definition at line 82 of file bmz-test.c.

size_t s_fp_len = 20
static

Definition at line 78 of file bmz-test.c.

size_t s_m = 0xffffffff
static

Definition at line 90 of file bmz-test.c.

size_t s_m1 = 0xffff
static

Definition at line 91 of file bmz-test.c.

size_t s_m2 = (0xffff - 4)
static

Definition at line 92 of file bmz-test.c.

size_t s_no_mmap = 0
static

Copyright (C) 2007-2015 Hypertable, 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 3 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 79 of file bmz-test.c.

size_t s_options = 0
static

Definition at line 77 of file bmz-test.c.

int s_show_hash = 0
static

Definition at line 83 of file bmz-test.c.

size_t s_times = 1
static

Definition at line 80 of file bmz-test.c.

int s_verbosity = 0
static

Definition at line 81 of file bmz-test.c.