source: main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/filestats.h@ 23508

Last change on this file since 23508 was 23508, checked in by sjm84, 13 years ago

Committing 64 bit changes into the branch

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/**************************************************************************
2 *
3 * filestats.h -- Functions for keeping stats on file accesses
4 * Copyright (C) 1994 Neil Sharman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 **************************************************************************/
21
22#ifndef H_FILESTATS
23#define H_FILESTATS
24
25
26typedef struct FileStats
27 {
28 mg_u_long NumSeeks;
29 mg_u_long NumReads;
30 mg_u_long NumBytes;
31 }
32FileStats;
33
34
35
36typedef struct
37 {
38 FILE *f;
39 char *pathname;
40 char *name;
41 FileStats Current;
42 FileStats Cumulative;
43 }
44File;
45
46/* if magic is 0 no magic number is read or written */
47File *Fopen (char *name, char *mode, mg_u_long magic);
48
49size_t Fread (void *ptr, size_t size, size_t nitems, File * F);
50
51int Fseek (File * F, mg_s_long offset, int ptrname);
52
53void Rewind (File * F);
54
55int Fclose (File * F);
56
57#define Getc(F) (F->Current.NumReads++, F->Current.NumBytes++, getc(F->f))
58
59/* This adds the Current file stats to the Cumulative stats and then zeros
60 the Current stats */
61void ZeroFileStats (File * F);
62
63
64#endif
Note: See TracBrowser for help on using the repository browser.