]> icculus.org git repositories - icculus/xz.git/blob - debug/memusage.c
Major documentation update.
[icculus/xz.git] / debug / memusage.c
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       memusage.c
4 /// \brief      Calculates memory usage using lzma_memory_usage()
5 //
6 //  Author:     Lasse Collin
7 //
8 //  This file has been put into the public domain.
9 //  You can do whatever you want with this file.
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #include "sysdefs.h"
14 #include <stdio.h>
15
16 int
17 main(void)
18 {
19         lzma_options_lzma lzma = {
20                 .dict_size = (1U << 30) + (1U << 29),
21                 .lc = 3,
22                 .lp = 0,
23                 .pb = 2,
24                 .preset_dict = NULL,
25                 .preset_dict_size = 0,
26                 .mode = LZMA_MODE_NORMAL,
27                 .nice_len = 48,
28                 .mf = LZMA_MF_BT4,
29                 .depth = 0,
30         };
31
32 /*
33         lzma_options_filter filters[] = {
34                 { LZMA_FILTER_LZMA1,
35                         (lzma_options_lzma *)&lzma_preset_lzma[6 - 1] },
36                 { UINT64_MAX, NULL }
37         };
38 */
39         lzma_filter filters[] = {
40                 { LZMA_FILTER_LZMA1, &lzma },
41                 { UINT64_MAX, NULL }
42         };
43
44         printf("Encoder: %10" PRIu64 " B\n", lzma_memusage_encoder(filters));
45         printf("Decoder: %10" PRIu64 " B\n", lzma_memusage_decoder(filters));
46
47         return 0;
48 }