1/* stats1b.h -- statistics for the the LZO library
2
3   This file is part of the LZO real-time data compression library.
4
5   Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
6   Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
7   Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
8   Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
9   Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
10   Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
11   Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
12   Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
13   Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
14   Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
15   Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
16   Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
17   Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
18   Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
19   Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
20   Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
21   All Rights Reserved.
22
23   The LZO library is free software; you can redistribute it and/or
24   modify it under the terms of the GNU General Public License as
25   published by the Free Software Foundation; either version 2 of
26   the License, or (at your option) any later version.
27
28   The LZO library is distributed in the hope that it will be useful,
29   but WITHOUT ANY WARRANTY; without even the implied warranty of
30   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31   GNU General Public License for more details.
32
33   You should have received a copy of the GNU General Public License
34   along with the LZO library; see the file COPYING.
35   If not, write to the Free Software Foundation, Inc.,
36   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37
38   Markus F.X.J. Oberhumer
39   <markus@oberhumer.com>
40   http://www.oberhumer.com/opensource/lzo/
41 */
42
43
44/* WARNING: this file should *not* be used by applications. It is
45   part of the implementation of the library and is subject
46   to change.
47 */
48
49
50#ifndef __LZO_STATS1B_H
51#define __LZO_STATS1B_H 1
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57
58/***********************************************************************
59// Collect statistical information when compressing.
60// Useful for finetuning the compression algorithm.
61// Examine the symbol 'lzo1b_stats' with a debugger.
62************************************************************************/
63
64#if (LZO_COLLECT_STATS)
65#  define LZO_STATS(expr)   expr
66#else
67#  define LZO_STATS(expr)   ((void) 0)
68#endif
69
70
71#if (LZO_COLLECT_STATS)
72
73typedef struct
74{
75/* algorithm configuration */
76    unsigned r_bits;
77    unsigned m3o_bits;
78    unsigned dd_bits;
79    unsigned clevel;
80
81/* internal configuration */
82    unsigned d_bits;
83    long min_lookahead;
84    long max_lookbehind;
85    const char *compress_id;
86
87/* counts */
88    long lit_runs;
89    long r0short_runs;
90    long r0fast_runs;
91    long r0long_runs;
92    long m1_matches;
93    long m2_matches;
94    long m3_matches;
95    long m4_matches;
96    long r1_matches;
97
98/* */
99    long lit_run[R0MIN];
100    long m2_match[M2_MAX_LEN + 1];
101    long m3_match[M3_MAX_LEN + 1];
102#if (M3O_BITS < 8)
103    long lit_runs_after_m3_match;
104    long lit_run_after_m3_match[LZO_SIZE(8-M3O_BITS)];
105#endif
106
107/* */
108    long matches;
109    long match_bytes;
110    long literals;
111    long literal_overhead;
112    long literal_bytes;
113    double literal_overhead_percent;
114
115/* */
116    long unused_dict_entries;
117    double unused_dict_entries_percent;
118
119/* */
120    long in_len;
121    long out_len;
122}
123lzo1b_stats_t;
124
125
126void _lzo1b_stats_init(lzo1b_stats_t *lzo_stats);
127void _lzo1b_stats_calc(lzo1b_stats_t *lzo_stats);
128
129extern lzo1b_stats_t * const lzo1b_stats;
130
131#define lzo_stats_t     lzo1b_stats_t
132#define lzo_stats       lzo1b_stats
133
134#endif
135
136
137#ifdef __cplusplus
138} /* extern "C" */
139#endif
140
141#endif /* already included */
142
143/*
144vi:ts=4:et
145*/
146