diff --git a/integrations/hiveos/h-stats.sh b/integrations/hiveos/h-stats.sh index 5a501e8..4903859 100755 --- a/integrations/hiveos/h-stats.sh +++ b/integrations/hiveos/h-stats.sh @@ -55,15 +55,18 @@ if [ "$diffTime" -lt "$maxDelay" ]; then BRAND_MINER="amd" fi - # TODO, get hash per gpu - avg_hashrate=$((total_hashrate/brand_gpu_count)) for(( i=0; i < gpu_count; i++ )); do [[ "${brands[i]}" != $BRAND_MINER ]] && continue [[ "${busids[i]}" =~ ^([A-Fa-f0-9]+): ]] busid_arr+=($((16#${BASH_REMATCH[1]}))) temp_arr+=(${temps[i]}) - fan_arr+=(${fans[i]}) - hash_arr+=($avg_hashrate) + fan_arr+=(${fans[i]}) + gpu_raw=`cat $CUSTOM_LOG_BASENAME.log | grep -w "Device #"$i | tail -n 1 ` + hashrate=`echo $gpu_raw | awk '{print $(NF-1)}' | cut -d "." -f 1,2 --output-delimiter='' | sed 's/$/0/'` + if [[ $gpu_raw == *"Ghash"* ]]; then + hashrate=$(($hashrate*1000)) + fi + hash_arr+=($hashrate) done hash_json=`printf '%s\n' "${hash_arr[@]}" | jq -cs '.'`