2008-04-25 06:41:29 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
/// \file memusage.c
|
|
|
|
/// \brief Calculates memory usage using lzma_memory_usage()
|
|
|
|
//
|
2009-04-13 04:27:40 -04:00
|
|
|
// Author: Lasse Collin
|
2008-04-25 06:41:29 -04:00
|
|
|
//
|
2009-04-13 04:27:40 -04:00
|
|
|
// This file has been put into the public domain.
|
|
|
|
// You can do whatever you want with this file.
|
2008-04-25 06:41:29 -04:00
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "sysdefs.h"
|
2009-08-27 10:00:22 -04:00
|
|
|
#include "lzma.h"
|
2008-04-25 06:41:29 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
lzma_options_lzma lzma = {
|
2008-11-19 13:46:52 -05:00
|
|
|
.dict_size = (1U << 30) + (1U << 29),
|
2008-09-27 12:09:21 -04:00
|
|
|
.lc = 3,
|
|
|
|
.lp = 0,
|
|
|
|
.pb = 2,
|
|
|
|
.preset_dict = NULL,
|
|
|
|
.preset_dict_size = 0,
|
2008-08-28 15:53:15 -04:00
|
|
|
.mode = LZMA_MODE_NORMAL,
|
2008-09-27 12:09:21 -04:00
|
|
|
.nice_len = 48,
|
|
|
|
.mf = LZMA_MF_BT4,
|
|
|
|
.depth = 0,
|
2008-04-25 06:41:29 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
lzma_options_filter filters[] = {
|
2008-09-27 12:09:21 -04:00
|
|
|
{ LZMA_FILTER_LZMA1,
|
2008-04-25 06:41:29 -04:00
|
|
|
(lzma_options_lzma *)&lzma_preset_lzma[6 - 1] },
|
|
|
|
{ UINT64_MAX, NULL }
|
|
|
|
};
|
|
|
|
*/
|
2008-08-28 15:53:15 -04:00
|
|
|
lzma_filter filters[] = {
|
2008-09-27 12:09:21 -04:00
|
|
|
{ LZMA_FILTER_LZMA1, &lzma },
|
2008-04-25 06:41:29 -04:00
|
|
|
{ UINT64_MAX, NULL }
|
|
|
|
};
|
|
|
|
|
2008-08-28 15:53:15 -04:00
|
|
|
printf("Encoder: %10" PRIu64 " B\n", lzma_memusage_encoder(filters));
|
|
|
|
printf("Decoder: %10" PRIu64 " B\n", lzma_memusage_decoder(filters));
|
2008-04-25 06:41:29 -04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|