1 /* MDB Tools - A library for reading MS Access database files
2 * Copyright (C) 2000 Brian Bruns
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
28 * @mdb: Handle to the (open) MDB file to collect stats on.
30 * Begins collection of statistics on an MDBHandle.
32 * Statistics in LibMDB will track the number of reads from the MDB file. The
33 * collection of statistics is started and stopped with the mdb_stats_on and
34 * mdb_stats_off functions. Collected statistics are accessed by reading the
35 * MdbStatistics structure or calling mdb_dump_stats.
39 mdb_stats_on(MdbHandle *mdb)
42 mdb->stats = g_malloc0(sizeof(MdbStatistics));
44 mdb->stats->collect = TRUE;
48 * @mdb: pointer to handle of MDB file with active stats collection.
50 * Turns off statistics collection.
52 * If mdb_stats_off is not called, statistics will be turned off when handle
53 * is freed using mdb_close.
56 mdb_stats_off(MdbHandle *mdb)
58 if (!mdb->stats) return;
60 mdb->stats->collect = FALSE;
64 * @mdb: pointer to handle of MDB file with active stats collection.
66 * Dumps current statistics to stdout.
69 mdb_dump_stats(MdbHandle *mdb)
71 if (!mdb->stats) return;
73 fprintf(stdout, "Physical Page Reads: %lu\n", mdb->stats->pg_reads);