source: trunk/indexers/mg/lib/filestats.h@ 13654

Last change on this file since 13654 was 13654, checked in by kjdon, 17 years ago

tidied up the top comments, removed Ids, and old log messages

  • 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#include "sysfuncs.h"
26
27typedef struct FileStats
28 {
29 unsigned long NumSeeks;
30 unsigned long NumReads;
31 unsigned long NumBytes;
32 }
33FileStats;
34
35
36
37typedef struct
38 {
39 FILE *f;
40 char *pathname;
41 char *name;
42 FileStats Current;
43 FileStats Cumulative;
44 }
45File;
46
47/* if magic is 0 no magic number is read or written */
48File *Fopen (char *name, char *mode, unsigned long magic);
49
50size_t Fread (void *ptr, size_t size, size_t nitems, File * F);
51
52int Fseek (File * F, long offset, int ptrname);
53
54void Rewind (File * F);
55
56int Fclose (File * F);
57
58#define Getc(F) (F->Current.NumReads++, F->Current.NumBytes++, getc(F->f))
59
60/* This adds the Current file stats to the Cumulative stats and then zeros
61 the Current stats */
62void ZeroFileStats (File * F);
63
64
65#endif
Note: See TracBrowser for help on using the repository browser.