report_lite_binary_size.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. # Script to report lite build binary size for latest RocksDB commits.
  4. # Usage:
  5. # ./report_lite_binary_size [num_recent_commits]
  6. num_recent_commits=${1:-10}
  7. echo "Computing RocksDB lite build binary size for the most recent $num_recent_commits commits."
  8. for ((i=0; i < num_recent_commits; i++))
  9. do
  10. git checkout master~$i
  11. commit_hash=$(git show -s --format=%H)
  12. commit_time=$(git show -s --format=%ct)
  13. # It would be nice to check if scuba already have a record for the commit,
  14. # but sandcastle don't seems to have scuba CLI installed.
  15. make clean
  16. make OPT=-DROCKSDB_LITE static_lib
  17. if make OPT=-DROCKSDB_LITE static_lib
  18. then
  19. build_succeeded='true'
  20. strip librocksdb.a
  21. binary_size=$(stat -c %s librocksdb.a)
  22. else
  23. build_succeeded='false'
  24. binary_size=0
  25. fi
  26. current_time="\"time\": $(date +%s)"
  27. commit_hash="\"hash\": \"$commit_hash\""
  28. commit_time="\"commit_time\": $commit_time"
  29. build_succeeded="\"build_succeeded\": \"$build_succeeded\""
  30. binary_size="\"binary_size\": $binary_size"
  31. scribe_log="{\"int\":{$current_time, $commit_time, $binary_size}, \"normal\":{$commit_hash, $build_succeeded}}"
  32. echo "Logging to scribe: $scribe_log"
  33. scribe_cat perfpipe_rocksdb_lite_build "$scribe_log"
  34. done