kusano 7d535a
/* stats1b.h -- statistics for the the LZO library
kusano 7d535a
kusano 7d535a
   This file is part of the LZO real-time data compression library.
kusano 7d535a
kusano 7d535a
   Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
kusano 7d535a
   All Rights Reserved.
kusano 7d535a
kusano 7d535a
   The LZO library is free software; you can redistribute it and/or
kusano 7d535a
   modify it under the terms of the GNU General Public License as
kusano 7d535a
   published by the Free Software Foundation; either version 2 of
kusano 7d535a
   the License, or (at your option) any later version.
kusano 7d535a
kusano 7d535a
   The LZO library is distributed in the hope that it will be useful,
kusano 7d535a
   but WITHOUT ANY WARRANTY; without even the implied warranty of
kusano 7d535a
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
kusano 7d535a
   GNU General Public License for more details.
kusano 7d535a
kusano 7d535a
   You should have received a copy of the GNU General Public License
kusano 7d535a
   along with the LZO library; see the file COPYING.
kusano 7d535a
   If not, write to the Free Software Foundation, Inc.,
kusano 7d535a
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
kusano 7d535a
kusano 7d535a
   Markus F.X.J. Oberhumer
kusano 7d535a
   <markus@oberhumer.com></markus@oberhumer.com>
kusano 7d535a
   http://www.oberhumer.com/opensource/lzo/
kusano 7d535a
 */
kusano 7d535a
kusano 7d535a
kusano 7d535a
/* WARNING: this file should *not* be used by applications. It is
kusano 7d535a
   part of the implementation of the library and is subject
kusano 7d535a
   to change.
kusano 7d535a
 */
kusano 7d535a
kusano 7d535a
kusano 7d535a
#ifndef __LZO_STATS1B_H
kusano 7d535a
#define __LZO_STATS1B_H
kusano 7d535a
kusano 7d535a
#ifdef __cplusplus
kusano 7d535a
extern "C" {
kusano 7d535a
#endif
kusano 7d535a
kusano 7d535a
kusano 7d535a
/***********************************************************************
kusano 7d535a
// Collect statistical information when compressing.
kusano 7d535a
// Useful for finetuning the compression algorithm.
kusano 7d535a
// Examine the symbol 'lzo1b_stats' with a debugger.
kusano 7d535a
************************************************************************/
kusano 7d535a
kusano 7d535a
#if defined(LZO_COLLECT_STATS)
kusano 7d535a
#  define LZO_STATS(expr)   expr
kusano 7d535a
#else
kusano 7d535a
#  define LZO_STATS(expr)   ((void) 0)
kusano 7d535a
#endif
kusano 7d535a
kusano 7d535a
kusano 7d535a
#if defined(LZO_COLLECT_STATS)
kusano 7d535a
kusano 7d535a
typedef struct
kusano 7d535a
{
kusano 7d535a
/* algorithm configuration */
kusano 7d535a
    unsigned r_bits;
kusano 7d535a
    unsigned m3o_bits;
kusano 7d535a
    unsigned dd_bits;
kusano 7d535a
    unsigned clevel;
kusano 7d535a
kusano 7d535a
/* internal configuration */
kusano 7d535a
    unsigned d_bits;
kusano 7d535a
    long min_lookahead;
kusano 7d535a
    long max_lookbehind;
kusano 7d535a
    const char *compress_id;
kusano 7d535a
kusano 7d535a
/* counts */
kusano 7d535a
    long lit_runs;
kusano 7d535a
    long r0short_runs;
kusano 7d535a
    long r0fast_runs;
kusano 7d535a
    long r0long_runs;
kusano 7d535a
    long m1_matches;
kusano 7d535a
    long m2_matches;
kusano 7d535a
    long m3_matches;
kusano 7d535a
    long m4_matches;
kusano 7d535a
    long r1_matches;
kusano 7d535a
kusano 7d535a
/* */
kusano 7d535a
    long lit_run[R0MIN];
kusano 7d535a
    long m2_match[M2_MAX_LEN + 1];
kusano 7d535a
    long m3_match[M3_MAX_LEN + 1];
kusano 7d535a
#if (M3O_BITS < 8)
kusano 7d535a
    long lit_runs_after_m3_match;
kusano 7d535a
    long lit_run_after_m3_match[LZO_SIZE(8-M3O_BITS)];
kusano 7d535a
#endif
kusano 7d535a
kusano 7d535a
/* */
kusano 7d535a
    long matches;
kusano 7d535a
    long match_bytes;
kusano 7d535a
    long literals;
kusano 7d535a
    long literal_overhead;
kusano 7d535a
    long literal_bytes;
kusano 7d535a
    double literal_overhead_percent;
kusano 7d535a
kusano 7d535a
/* */
kusano 7d535a
    long unused_dict_entries;
kusano 7d535a
    double unused_dict_entries_percent;
kusano 7d535a
kusano 7d535a
/* */
kusano 7d535a
    long in_len;
kusano 7d535a
    long out_len;
kusano 7d535a
}
kusano 7d535a
lzo1b_stats_t;
kusano 7d535a
kusano 7d535a
kusano 7d535a
void _lzo1b_stats_init(lzo1b_stats_t *lzo_stats);
kusano 7d535a
void _lzo1b_stats_calc(lzo1b_stats_t *lzo_stats);
kusano 7d535a
kusano 7d535a
extern lzo1b_stats_t * const lzo1b_stats;
kusano 7d535a
kusano 7d535a
#define lzo_stats_t     lzo1b_stats_t
kusano 7d535a
#define lzo_stats       lzo1b_stats
kusano 7d535a
kusano 7d535a
#endif
kusano 7d535a
kusano 7d535a
kusano 7d535a
#ifdef __cplusplus
kusano 7d535a
} /* extern "C" */
kusano 7d535a
#endif
kusano 7d535a
kusano 7d535a
#endif /* already included */
kusano 7d535a
kusano 7d535a
/*
kusano 7d535a
vi:ts=4:et
kusano 7d535a
*/