"Fossies" - the Fresh Open Source Software Archive

Member "bonnie++-2.00a/zcav_io.h" (23 Nov 2012, 1478 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 "zcav_io.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef ZCAV_IO_H
    2 #define ZCAV_IO_H
    3 
    4 #include "bonnie.h"
    5 #include <vector>
    6 
    7 #include "duration.h"
    8 using namespace std;
    9 
   10 enum results
   11 {
   12   eEND = 0,
   13   eSEEK = 1,
   14   eSIZE = 2
   15 };
   16 
   17 // Returns the mean of the values in the array.  If the array contains
   18 // more than 2 items then discard the highest and lowest thirds of the
   19 // results before calculating the mean.
   20 double average(double *array, int count);
   21 
   22 const int MEG = 1024*1024;
   23 const int DEFAULT_BLOCK_SIZE = 512;
   24 const int DEFAULT_CHUNK_SIZE = 1;
   25 
   26 class ZcavRead
   27 {
   28 public:
   29   ZcavRead(){ m_name = NULL; }
   30   ~ZcavRead();
   31 
   32   int Open(bool *finished, int block_size, const char *file, const char *log
   33          , int chunk_size, int do_write);
   34   void Close();
   35   int Read(int max_loops, int max_size, int writeCom, int skip_rate, int start_offset);
   36 
   37 private:
   38   ssize_t access_all(int count);
   39 
   40   // write the status to the parent thread
   41   int writeStatus(int fd, char c);
   42 
   43   // Read the m_block_count megabytes of data from the fd and return the
   44   // amount of time elapsed in seconds.
   45   double access_data(int skip);
   46   void printavg(int position, double avg, int block_size);
   47 
   48   bool *m_finished;
   49   vector <double *> m_times;
   50   vector<int> m_count; // number of times each block has been read
   51   void *m_buf;
   52   int m_fd;
   53   FILE *m_log;
   54   bool m_logFile;
   55   int m_block_size;
   56   char *m_name;
   57   int m_chunk_size;
   58   int m_do_write;
   59   Duration m_dur;
   60 
   61   ZcavRead(const ZcavRead &t);
   62   ZcavRead & operator =(const ZcavRead &t);
   63 };
   64 
   65 #endif
   66