Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 08:51:32

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 
0011 
0012 class JBenchUtils {
0013 
0014     std::mt19937 m_generator;
0015 
0016 public:
0017 
0018     JBenchUtils() = default;
0019 
0020     void set_seed(size_t event_number, std::string caller_name);
0021 
0022     size_t rand_size(size_t avg, double spread);
0023     int randint(int min, int max);
0024     double randdouble(double min=0.0, double max=1000.0);
0025     float randfloat(float min=0.0, float max=1000.0);
0026 
0027     uint64_t consume_cpu_ms(uint64_t millisecs, double spread=0.0);
0028     uint64_t read_memory(const std::vector<char>& buffer);
0029     uint64_t write_memory(std::vector<char>& buffer, uint64_t bytes, double spread=0.0);
0030 
0031 };