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

Last change on this file since 3745 was 3745, checked in by mdewsnip, 21 years ago

Addition of MG package for search and retrieval

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