"Fossies" - the Fresh Open Source Software Archive

Member "bonnie++-2.00a/bon_time.h" (13 Sep 2018, 1510 Bytes) of package /linux/privat/bonnie++-2.00a.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "bon_time.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef BON_TIME_H
    2 #define BON_TIME_H
    3 
    4 #include "bonnie.h"
    5 #include "duration.h"
    6 #include "rand.h"
    7 
    8 struct report_s
    9 {
   10   double CPU;
   11   double StartTime;
   12   double EndTime;
   13   double Latency;
   14 };
   15 
   16 struct delta_s
   17 {
   18   double CPU;
   19   double Elapsed;
   20   double FirstStart;
   21   double LastStop;
   22   double Latency;
   23 };
   24 
   25 class BonTimer
   26 {
   27 public:
   28   enum RepType { csv, txt };
   29 
   30   BonTimer();
   31 
   32   void start();
   33   void stop_and_record(tests_t test);
   34   void add_delta_report(report_s &rep, tests_t test);
   35   int DoReportIO(int file_size, int char_file_size
   36                , int io_chunk_size, int Seeks, int SeekProcCount, FILE *fp);
   37   int DoReportFile(int directory_size
   38                  , int max_size, int min_size, int num_directories
   39                  , int file_chunk_size, FILE *fp);
   40   void SetType(RepType type) { m_type = type; }
   41   double cpu_so_far();
   42   double time_so_far();
   43   void PrintHeader(FILE *fp);
   44   void Initialize();
   45   static double get_cur_time();
   46   static double get_cpu_use();
   47 
   48   void add_latency(tests_t test, double t);
   49 
   50   void setMachineName(CPCCHAR name) { m_name = name; }
   51 
   52   void setConcurrency(int con) { m_concurrency = con; }
   53  
   54   Rand random_source;
   55 
   56 private:
   57   int print_cpu_stat(tests_t test);
   58   int print_stat(tests_t test, int test_size);
   59   int print_latency(tests_t test);
   60 
   61   delta_s m_delta[TestCount];
   62   RepType m_type;
   63   FILE *m_fp;
   64   Duration m_dur;
   65   CPU_Duration m_cpu_dur;
   66   PCCHAR m_name;
   67   int m_concurrency;
   68 
   69   BonTimer(const BonTimer&);
   70   BonTimer &operator=(const BonTimer&);
   71 };
   72 
   73 #endif