<commit_before>/**
* Runtime benchmarking
* (C) 2008 <NAME>
*/

#ifndef BOTAN_RUNTIME_BENCHMARK_H__
#define BOTAN_RUNTIME_BENCHMARK_H__

#include <botan/algo_factory.h>
#include <botan/timer.h>
#include <botan/rng.h>
#include <map>
#include <string>

namespace Botan {

/**
Algorithm benchmark
@param name the name of the algorithm to test (cipher, hash, or MAC)
@param milliseconds total time for the benchmark to run
@param timer the timer to use
@param rng the rng to use to generate random inputs
@param af the algorithm factory used to create objects
@returns results a map from provider to speed in mebibytes per second
*/
std::map<std::string, double>
algorithm_benchmark(const std::string& name,
                    u32bit milliseconds,
                    Timer& timer,
                    RandomNumberGenerator& rng,
                    Algorithm_Factory& af);

}


#endif<commit_msg>Add a typedef in benchmark.h Default_Benchmark_Timer, which checks available timer alternatives. I realized otherwise each application would be forced to do the exact same thing, and no reason for that.<commit_after>/**
* Runtime benchmarking
* (C) 2008 <NAME>
*/

#ifndef BOTAN_RUNTIME_BENCHMARK_H__
#define BOTAN_RUNTIME_BENCHMARK_H__

#include <botan/algo_factory.h>
#include <botan/timer.h>
#include <botan/rng.h>
#include <map>
#include <string>

/**
* Choose some sort of default timer implementation to use, since some
* (like hardware tick counters and current Win32 timer) are not
* reliable for benchmarking.
*/
#if defined(BOTAN_HAS_TIMER_POSIX)
  #include <botan/tm_posix.h>
#elif defined(BOTAN_HAS_TIMER_UNIX)
  #include <botan/tm_unix.h>
#endif

namespace Botan {

#if defined(BOTAN_HAS_TIMER_POSIX)
  typedef POSIX_Timer Default_Benchmark_Timer;
#elif defined(BOTAN_HAS_TIMER_UNIX)
  typedef Unix_Timer Default_Benchmark_Timer;
#else
  typedef ANSI_Clock_Timer Default_Benchmark_Timer;
#endif

/**
* Algorithm benchmark
* @param name the name of the algorithm to test (cipher, hash, or MAC)
* @param milliseconds total time for the benchmark to run
* @param timer the timer to use
* @param rng the rng to use to generate random inputs
* @param af the algorithm factory used to create objects
* @returns results a map from provider to speed in mebibytes per second
*/
std::map<std::string, double>
algorithm_benchmark(const std::string& name,
                    u32bit milliseconds,
                    Timer& timer,
                    RandomNumberGenerator& rng,
                    Algorithm_Factory& af);

}

#endif
{'fraction_non_alphanumeric': 0.07990506329113924, 'fraction_numerical': 0.005537974683544304, 'mean_word_length': 3.949119373776908, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3679774', 'n_tokens_mistral': 819, 'n_tokens_neox': 770, 'n_words': 270}