/* * CSV Display module for the hash benchmark program * Part of the xxHash project * Copyright (C) 2019-2021 Yann Collet * * GPL v2 License * * This program 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 * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * You can contact the author at : * - xxHash homepage : https://www.xxhash.com * - xxHash source repository : https://github.com/Cyan4973/xxHash */ /* === Dependencies === */ #include /* rand */ #include /* printf */ #include #include "benchHash.h" #include "bhDisplay.h" /* === benchmark large input === */ #define MB_UNIT 1000000 #define BENCH_LARGE_ITER_MS 490 #define BENCH_LARGE_TOTAL_MS 1010 static void bench_oneHash_largeInput(Bench_Entry hashDesc, int minlog, int maxlog) { printf("%-7s", hashDesc.name); for (int sizelog=minlog; sizelog<=maxlog; sizelog++) { size_t const inputSize = (size_t)1 << sizelog; double const nbhps = bench_hash(hashDesc.hash, BMK_throughput, inputSize, BMK_fixedSize, BENCH_LARGE_TOTAL_MS, BENCH_LARGE_ITER_MS); printf(",%6.0f", nbhps * inputSize / MB_UNIT); fflush(NULL); } printf("\n"); } void bench_largeInput(Bench_Entry const* hashDescTable, int nbHashes, int minlog, int maxlog) { assert(maxlog < 31); assert(minlog >= 0); printf("benchmarking large inputs : from %u bytes (log%i) to %u MB (log%i) \n", 1U << minlog, minlog, (1U << maxlog) >> 20, maxlog); for (int i=0; i