github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/scripts/torch (about)

     1  #!/usr/bin/env bash
     2  
     3  set -euo pipefail
     4  
     5  if [ $# -eq 0 ]; then
     6    cat <<EOF
     7  A docker-based helper for go-torch.
     8  
     9  Example usage:
    10  
    11    A five second profile against a secure cluster:
    12  
    13      $0 -t 5 https+insecure://mysecurehost:8080
    14  
    15    A default (30s) profile against a secure local node:
    16  
    17      $0 https+insecure://\$(hostname):8080
    18  
    19    A default profile against an insecure local node:
    20  
    21      $0 http://\$(hostname):8080
    22  
    23    Benchmarking and viewing the results:
    24  
    25      make bench PKG=./pkg/util/encoding BENCHES=BenchmarkDecodeUint64 TESTFLAGS='-cpuprofile bench.prof'
    26      $0 --binaryname encoding.test -b bench.prof
    27  
    28    Viewing the full help for go-torch (\`-p\` is always passed):
    29  
    30      $0 --help
    31  
    32  Troubleshooting:
    33  
    34    When profiling a local cluster, make sure you don't use "localhost" but
    35    \$(hostname) and that the server was started with a suitable \`--http-addr\`.
    36  
    37    \`https+insecure://\` works properly only when the server was built using
    38    go1.9 or later.
    39  EOF
    40    exit 1
    41  fi
    42  
    43  tmpfile="$(mktemp -d)/torch.svg"
    44  docker run -v $(pwd):/work -w /work uber/go-torch -p "$@" > $tmpfile
    45  echo "${tmpfile}"
    46  open ${tmpfile}