File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required ( VERSION 3.14 )
2- project ( ack )
2+ project (
3+ ack
4+ LANGUAGES CXX
5+ VERSION 0.1.0
6+ )
37
48option ( ACK_NO_INTRINSICS "Don't use intrinsics" OFF )
59option ( ACK_BUILD_TESTS "Build tests" ON )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Banchmark script for cleos command
3+ # usage:
4+ # bm_cleos_cmd.sh "<cleos_command>" N-iterations
5+
6+ script_name=" $( basename " $( test -L " $0 " && readlink " $0 " || echo " $0 " ) " ) "
7+ sleep_time=3
8+
9+ print_help () {
10+ echo " Usage:"
11+ echo -e " ${script_name} <command> N-iterations\n"
12+ }
13+
14+ if [[ $# -lt 2 ]]; then
15+ echo " Error: invalid number of arguments!" >&2
16+ print_help
17+ exit 1
18+ fi
19+
20+ command=$1
21+ iterations=$2
22+
23+ re=' ^[0-9]+$'
24+ if ! [[ $iterations =~ $re ]] ; then
25+ echo " Error: iteration argument is not a number!" >&2
26+ print_help
27+ exit 1;
28+ fi
29+
30+ sum_cpu_usage_us=0
31+ for (( i = 0 ; i < $iterations ; i++ ))
32+ do
33+ result=$( $command -j)
34+ rc=$? ; if [[ $rc != 0 ]]; then echo -e " Error: An error occored while executing command!\n${result} " ; exit $rc ; fi
35+ cpu_usage_us=$( echo $result | jq -r " .processed.receipt.cpu_usage_us" )
36+ if [ " $cpu_usage_us " != " <unknown>" ]; then
37+ sum_cpu_usage_us=$( expr $sum_cpu_usage_us + $cpu_usage_us )
38+ fi
39+ sleep $sleep_time
40+ done ;
41+
42+ echo " avg. CPU usage: $( expr $sum_cpu_usage_us / $iterations ) us"
You can’t perform that action at this time.
0 commit comments