source: gsdl/trunk/trunk/mg/lib/filestats.h@ 16583

Last change on this file since 16583 was 16583, checked in by davidb, 16 years ago

Undoing change commited in r16582

  • 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 unsigned long NumSeeks;
29 unsigned long NumReads;
30 unsigned 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, unsigned long magic);
48
49size_t Fread (void *ptr, size_t size, size_t nitems, File * F);
50
51int Fseek (File * F, 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.