Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:36

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 #pragma once
0006 
0007 #include <vector>
0008 #include <random>
0009 #include <string>
0010 #include <algorithm>
0011 #include <string>
0012 #include <typeinfo>
0013 #include <chrono>
0014 
0015 
0016 class JBenchUtils {
0017 
0018     std::mt19937 m_generator;
0019 
0020 public:
0021 
0022     JBenchUtils(){}
0023 
0024     void set_seed(size_t event_number, std::string caller_name);
0025 
0026     size_t rand_size(size_t avg, double spread);
0027     int randint(int min, int max);
0028     double randdouble(double min=0.0, double max=1000.0);
0029     float randfloat(float min=0.0, float max=1000.0);
0030 
0031     uint64_t consume_cpu_ms(uint64_t millisecs, double spread=0.0, bool fix_flops=true);
0032     uint64_t read_memory(const std::vector<char>& buffer);
0033     uint64_t write_memory(std::vector<char>& buffer, uint64_t bytes, double spread=0.0);
0034 
0035 };