File: report_lite_binary_size.sh

package info (click to toggle)
rocksdb 5.17.2-3
  • links: PTS
  • area: main
  • in suites: buster
  • size: 21,164 kB
  • sloc: cpp: 253,035; java: 24,114; perl: 5,769; python: 4,093; ansic: 4,092; sh: 3,861; makefile: 1,754; asm: 547; php: 254; xml: 30
file content (41 lines) | stat: -rwxr-xr-x 1,270 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# Script to report lite build binary size for latest RocksDB commits.
# Usage:
#   ./report_lite_binary_size [num_recent_commits]

num_recent_commits=${1:-10}

echo "Computing RocksDB lite build binary size for the most recent $num_recent_commits commits."

for ((i=0; i < num_recent_commits; i++))
do
  git checkout master~$i
  commit_hash=$(git show -s --format=%H)
  commit_time=$(git show -s --format=%ct)

  # It would be nice to check if scuba already have a record for the commit,
  # but sandcastle don't seems to have scuba CLI installed.

  make clean
  make OPT=-DROCKSDB_LITE static_lib

  if make OPT=-DROCKSDB_LITE static_lib
  then
    build_succeeded='true'
    strip librocksdb.a
    binary_size=$(stat -c %s librocksdb.a)
  else
    build_succeeded='false'
    binary_size=0
  fi

  current_time="\"time\": $(date +%s)"
  commit_hash="\"hash\": \"$commit_hash\""
  commit_time="\"commit_time\": $commit_time"
  build_succeeded="\"build_succeeded\": \"$build_succeeded\""
  binary_size="\"binary_size\": $binary_size"

  scribe_log="{\"int\":{$current_time, $commit_time, $binary_size}, \"normal\":{$commit_hash, $build_succeeded}}"
  echo "Logging to scribe: $scribe_log"
  scribe_cat perfpipe_rocksdb_lite_build "$scribe_log"
done