1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

bench.c: added support for ZSTD_GIT_COMMIT

This commit is contained in:
inikep
2016-06-22 16:13:25 +02:00
parent f2f59d758e
commit d7d251ccb5
2 changed files with 40 additions and 38 deletions

View File

@ -43,7 +43,9 @@
* Constants
***************************************/
#ifndef ZSTD_GIT_COMMIT
# define ZSTD_GIT_COMMIT ""
# define ZSTD_GIT_COMMIT_STRING ""
#else
# define ZSTD_GIT_COMMIT_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_GIT_COMMIT)
#endif
#define NBLOOPS 3
@ -363,7 +365,7 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
memset(&total, 0, sizeof(total));
if (g_displayLevel == 1 && !g_additionalParam)
DISPLAY("bench %s %s: input %u bytes, %i iterations, %u KB blocks\n", ZSTD_VERSION_STRING, ZSTD_GIT_COMMIT, (U32)benchedSize, g_nbIterations, (U32)(g_blockSize>>10));
DISPLAY("bench %s %s: input %u bytes, %i iterations, %u KB blocks\n", ZSTD_VERSION_STRING, ZSTD_GIT_COMMIT_STRING, (U32)benchedSize, g_nbIterations, (U32)(g_blockSize>>10));
if (cLevelLast < cLevel) cLevelLast = cLevel;

View File

@ -95,7 +95,7 @@ def compile(branch, commit, last_commit, dry_run):
execute('git checkout -- . && git checkout ' + branch)
print(git_get_changes(branch, commit, last_commit))
if not dry_run:
execute('make clean zstdprogram MOREFLAGS="-DZSTD_GIT_COMMIT=%s"' % version, print_output=True)
execute('make clean zstdprogram MOREFLAGS="-DZSTD_GIT_COMMIT=%s"' % version)
def get_last_results(resultsFileName):
@ -148,9 +148,7 @@ def benchmark_and_compare(branch, commit, resultsFileName, lastCLevel, testFileP
return text
def check_branch(branch, args, testFilePaths, have_mutt, have_mail):
commits = execute('git show -s --format=%h ' + branch)[0]
for commit in [commits]:
def check_commit(branch, commit, args, testFilePaths, have_mutt, have_mail):
try:
last_commit = None
commitFileName = working_path + "/commit_" + branch.replace("/", "_")
@ -160,7 +158,7 @@ def check_branch(branch, args, testFilePaths, have_mutt, have_mail):
if commit == last_commit:
log("skipping branch %s: head %s already processed" % (branch, commit))
continue
return
log("build branch %s: head %s is different from prev %s" % (branch, commit, last_commit))
compile(branch, commit, last_commit, args.dry_run)
@ -259,7 +257,9 @@ if __name__ == '__main__':
if (loadavg <= args.maxLoadAvg):
branches = git_get_branches()
for branch in branches:
check_branch(branch, args, testFilePaths, have_mutt, have_mail)
commits = execute('git show -s --format=%h ' + branch)[0]
for commit in [commits]:
check_commit(branch, commit, args, testFilePaths, have_mutt, have_mail)
else:
log("WARNING: main loadavg=%.2f is higher than %s" % (loadavg, args.maxLoadAvg))
log("sleep for %s seconds" % args.sleepTime)