github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/ledger/kvledger/benchmark/scripts/benchmarks.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright hechain. All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  source ./common.sh
     9  
    10  #######################################################################################################
    11  # This shell script contains two functions that can be invoked to execute specific tests
    12  #
    13  # runInsertTxs - This function sets the environment variables and runs the benchmark function
    14  # 'BenchmarkInsertTxs' in package 'github.com/hechain20/hechain/core/ledger/kvledger/benchmark/experiments'
    15  #
    16  # runReadWriteTxs - This function sets the environment variables and runs the benchmark function
    17  # 'BenchmarkReadWriteTxs' in package 'github.com/hechain20/hechain/core/ledger/kvledger/benchmark/experiments'
    18  #
    19  # For the details of test specific parameters, refer to the documentation in 'go' files for the tests
    20  #######################################################################################################
    21  
    22  PKG_NAME="github.com/hechain20/hechain/core/ledger/kvledger/benchmark/experiments"
    23  
    24  function setCommonTestParams {
    25    TEST_PARAMS="-DataDir=$DataDir, -NumChains=$NumChains, -NumParallelTxPerChain=$NumParallelTxPerChain, -NumWritesPerTx=$NumWritesPerTx, -NumReadsPerTx=$NumReadsPerTx, -BatchSize=$BatchSize, -NumKVs=$NumKVs, -KVSize=$KVSize, -UseJSONFormat=$UseJSONFormat"
    26    RESULTANT_DIRS="$DataDir/ledgersData/chains/chains $DataDir/ledgersData/chains/index $DataDir/ledgersData/stateLeveldb $DataDir/ledgersData/historyLeveldb"
    27  }
    28  
    29  function runInsertTxs {
    30    FUNCTION_NAME="BenchmarkInsertTxs"
    31    setCommonTestParams
    32    executeTest
    33  }
    34  
    35  function runReadWriteTxs {
    36    FUNCTION_NAME="BenchmarkReadWriteTxs"
    37    if [ "$CLEAR_OS_CACHE" == "true" ]; then
    38      clearOSCache
    39    fi
    40    setCommonTestParams
    41    TEST_PARAMS="$TEST_PARAMS, -NumTotalTx=$NumTotalTx"
    42    executeTest
    43  }