MCPcopy Create free account
hub / github.com/F-Stack/f-stack / BMK_syntheticTest

Function BMK_syntheticTest

freebsd/contrib/zstd/programs/benchzstd.c:691–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691BMK_benchOutcome_t BMK_syntheticTest(int cLevel, double compressibility,
692 const ZSTD_compressionParameters* compressionParams,
693 int displayLevel, const BMK_advancedParams_t* adv)
694{
695 char name[20] = {0};
696 size_t const benchedSize = 10000000;
697 void* srcBuffer;
698 BMK_benchOutcome_t res;
699
700 if (cLevel > ZSTD_maxCLevel()) {
701 RETURN_ERROR(15, BMK_benchOutcome_t, "Invalid Compression Level");
702 }
703
704 /* Memory allocation */
705 srcBuffer = malloc(benchedSize);
706 if (!srcBuffer) RETURN_ERROR(21, BMK_benchOutcome_t, "not enough memory");
707
708 /* Fill input buffer */
709 RDG_genBuffer(srcBuffer, benchedSize, compressibility, 0.0, 0);
710
711 /* Bench */
712 snprintf (name, sizeof(name), "Synthetic %2u%%", (unsigned)(compressibility*100));
713 res = BMK_benchCLevel(srcBuffer, benchedSize,
714 &benchedSize /* ? */, 1 /* ? */,
715 cLevel, compressionParams,
716 NULL, 0, /* dictionary */
717 displayLevel, name, adv);
718
719 /* clean up */
720 free(srcBuffer);
721
722 return res;
723}
724
725
726

Callers 1

mainFunction · 0.70

Calls 6

mallocFunction · 0.85
RDG_genBufferFunction · 0.85
snprintfFunction · 0.85
BMK_benchCLevelFunction · 0.70
ZSTD_maxCLevelFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected