Statistics
| Branch: | Revision:

root / synthbench / bonnie++ / bon_file.h @ 0:839f52ef7657

History | View | Annotate | Download (1.5 kB)

1
#ifndef BON_IO
2
#define BON_IO
3

    
4
#include "bonnie.h"
5
class BonTimer;
6

    
7
typedef unsigned long MASK_TYPE;
8

    
9
class COpenTest
10
{
11
public:
12
  COpenTest(int chunk_size, bool use_sync, bool *doExit);
13
  ~COpenTest();
14

    
15
  int create(CPCCHAR dirname, BonTimer &timer, int num, int max_size
16
                    , int min_size, int num_directories, bool do_random);
17
  int delete_random(BonTimer &timer);
18
  int delete_sequential(BonTimer &timer);
19
  int stat_random(BonTimer &timer);
20
  int stat_sequential(BonTimer &timer);
21

    
22
private:
23
  void make_names(bool do_random);
24
  int stat_file(CPCCHAR file);
25
  int create_a_file(const char *filename, char *buf, int size, int dir);
26
  int create_a_link(const char *original, const char *filename, int dir);
27

    
28
  const int m_chunk_size;
29
  int m_number; // the total number of files to create
30
  int m_number_directories; // the number of directories to store files in
31
  int m_max; // maximum file size (negative for links)
32
  int m_min; // minimum file size
33
  int m_size_range; // m_max - m_min
34
  char *m_dirname; // name of the master directory
35
  char *m_file_name_buf; // buffer to store all file names
36
  char **m_file_names; // pointer to entries in m_file_name_buf
37
  bool m_sync; // do we sync after every significant operation?
38
  FILE_TYPE *m_directoryHandles; // handles to the directories for m_sync
39
  int *m_dirIndex; // which directory we are in
40
  char *m_buf;
41
  bool *m_exit;
42
  bool m_sync_dir;
43

    
44
  void random_sort();
45

    
46
  COpenTest(const COpenTest &t);
47
  COpenTest & operator =(const COpenTest &t);
48
};
49

    
50
#endif