diff --git a/Makefile b/Makefile index 9ee0b0ba..c63db80e 100644 --- a/Makefile +++ b/Makefile @@ -62,27 +62,38 @@ zstdmt: zlibwrapper: lib $(MAKE) -C $(ZWRAPDIR) all +## test: run long-duration tests .PHONY: test test: MOREFLAGS += -g -DDEBUGLEVEL=1 -Werror test: MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants $(MAKE) -C $(TESTDIR) $@ +## shortest: same as `make check` .PHONY: shortest shortest: $(MAKE) -C $(TESTDIR) $@ +## check: run basic tests for `zstd` cli .PHONY: check check: shortest +## examples: build all examples in `/examples` directory .PHONY: examples examples: lib CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all +## manual: generate API documentation in html format .PHONY: manual manual: $(MAKE) -C contrib/gen_html $@ +## man: generate man page +.PHONY: man +man: + $(MAKE) -C programs $@ + +## contrib: build all supported projects in `/contrib` directory .PHONY: contrib contrib: lib $(MAKE) -C contrib/pzstd all diff --git a/doc/zstd_manual.html b/doc/zstd_manual.html index 4a8985f2..f9b1daa8 100644 --- a/doc/zstd_manual.html +++ b/doc/zstd_manual.html @@ -1,10 +1,10 @@ -zstd 1.3.6 Manual +zstd 1.3.7 Manual -

zstd 1.3.6 Manual

+

zstd 1.3.7 Manual


Contents

    @@ -313,11 +313,17 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); The function will update both `pos` fields. If `input.pos < input.size`, some input has not been consumed. It's up to the caller to present again remaining data. + The function tries to flush all data decoded immediately, repecting buffer sizes. If `output.pos < output.size`, decoder has flushed everything it could. - @return : 0 when a frame is completely decoded and fully flushed, - an error code, which can be tested using ZSTD_isError(), - any other value > 0, which means there is still some decoding to do to complete current frame. - The return value is a suggested next input size (a hint to improve latency) that will never load more than the current frame. + But if `output.pos == output.size`, there is no such guarantee, + it's likely that some decoded data was not flushed and still remains within internal buffers. + In which case, call ZSTD_decompressStream() again to flush whatever remains in the buffer. + When no additional input is provided, amount of data flushed is necessarily <= ZSTD_BLOCKSIZE_MAX. + @return : 0 when a frame is completely decoded and fully flushed, + or an error code, which can be tested using ZSTD_isError(), + or any other value > 0, which means there is still some decoding or flushing to do to complete current frame : + the return value is a suggested next input size (a hint for better latency) + that will never load more than the current frame.
    @@ -600,22 +606,40 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const ZSTD_CDict*
    size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
     

    start a new compression job, using same parameters from previous job. - This is typically useful to skip dictionary loading stage, since it will re-use it in-place.. + This is typically useful to skip dictionary loading stage, since it will re-use it in-place. Note that zcs must be init at least once before using ZSTD_resetCStream(). If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN. If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs, but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead. - @return : 0, or an error code (which can be tested using ZSTD_isError()) + @return : 0, or an error code (which can be tested using ZSTD_isError()) +


    typedef struct {
    -    unsigned long long ingested;
    -    unsigned long long consumed;
    -    unsigned long long produced;
    -    unsigned currentJobID;
    +    unsigned long long ingested;   /* nb input bytes read and buffered */
    +    unsigned long long consumed;   /* nb input bytes actually compressed */
    +    unsigned long long produced;   /* nb of compressed bytes generated and buffered */
    +    unsigned long long flushed;    /* nb of compressed bytes flushed : not provided; can be tracked from caller side */
    +    unsigned currentJobID;         /* MT only : latest started job nb */
    +    unsigned nbActiveWorkers;      /* MT only : nb of workers actively compressing at probe time */
     } ZSTD_frameProgression;
     

    +
    size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
    +

    Tell how many bytes are ready to be flushed immediately. + Useful for multithreading scenarios (nbWorkers >= 1). + Probe the oldest active job, defined as oldest job not yet entirely flushed, + and check its output buffer. + @return : amount of data stored in oldest job and ready to be flushed immediately. + if @return == 0, it means either : + + there is no active job (could be checked with ZSTD_frameProgression()), or + + oldest job is still actively compressing data, + but everything it has produced has also been flushed so far, + therefore flushing speed is currently limited by production speed of oldest job + irrespective of the speed of concurrent newer jobs. + +


    +

    Advanced Streaming decompression functions

    typedef enum { DStream_p_maxWindowSize } ZSTD_DStreamParameter_e;
     size_t ZSTD_setDStreamParameter(ZSTD_DStream* zds, ZSTD_DStreamParameter_e paramType, unsigned paramValue);   /* obsolete : this API will be removed in a future version */
     size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /**< note: no dictionary will be used if dict == NULL or dictSize < 8 */
    @@ -1015,9 +1039,13 @@ size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx,
     


    typedef enum {
    -    ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal conditions */
    -    ZSTD_e_flush,      /* flush any data provided so far - frame will continue, future data can still reference previous data for better compression */
    -    ZSTD_e_end         /* flush any remaining data and close current frame. Any additional data starts a new frame. */
    +    ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal compression ratio */
    +    ZSTD_e_flush,      /* flush any data provided so far,
    +                        * it creates (at least) one new block, that can be decoded immediately on reception;
    +                        * frame will continue: any future data can still reference previously compressed data, improving compression. */
    +    ZSTD_e_end         /* flush any remaining data and close current frame.
    +                        * any additional data starts a new frame.
    +                        * each frame is independent (does not reference any content from previous frame). */
     } ZSTD_EndDirective;
     

    size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
    diff --git a/lib/zstd.h b/lib/zstd.h
    index 9b141044..f2af4ac8 100644
    --- a/lib/zstd.h
    +++ b/lib/zstd.h
    @@ -71,7 +71,7 @@ extern "C" {
     /*------   Version   ------*/
     #define ZSTD_VERSION_MAJOR    1
     #define ZSTD_VERSION_MINOR    3
    -#define ZSTD_VERSION_RELEASE  6
    +#define ZSTD_VERSION_RELEASE  7
     
     #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
     ZSTDLIB_API unsigned ZSTD_versionNumber(void);   /**< useful to check dll version */
    diff --git a/programs/zstd.1 b/programs/zstd.1
    index 27ee6684..674f8984 100644
    --- a/programs/zstd.1
    +++ b/programs/zstd.1
    @@ -1,5 +1,5 @@
     .
    -.TH "ZSTD" "1" "September 2018" "zstd 1.3.5" "User Commands"
    +.TH "ZSTD" "1" "October 2018" "zstd 1.3.7" "User Commands"
     .
     .SH "NAME"
     \fBzstd\fR \- zstd, zstdmt, unzstd, zstdcat \- Compress or decompress \.zst files
    @@ -123,8 +123,8 @@ Compress using \fB#\fR working threads (default: 1)\. If \fB#\fR is 0, attempt t
     Does not spawn a thread for compression, use a single thread for both I/O and compression\. In this mode, compression is serialized with I/O, which is slightly slower\. (This is different from \fB\-T1\fR, which spawns 1 compression thread in parallel of I/O)\. This mode is the only one available when multithread support is disabled\. Single\-thread mode features lower memory usage\. Final compressed result is slightly different from \fB\-T1\fR\.
     .
     .TP
    -\fB\-\-adapt\fR
    -\fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. \fInote\fR : at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\.
    +\fB\-\-adapt[=min=#,max=#]\fR
    +\fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. Adaptation can be constrained between supplied \fBmin\fR and \fBmax\fR levels\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. \fInote\fR : at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\.
     .
     .TP
     \fB\-D file\fR
    diff --git a/tests/.gitignore b/tests/.gitignore
    index da536251..1f08c399 100644
    --- a/tests/.gitignore
    +++ b/tests/.gitignore
    @@ -1,6 +1,7 @@
     # local binary (Makefile)
     fullbench
     fullbench32
    +fullbench-lib
     fuzzer
     fuzzer32
     fuzzer-dll