Skip to content

Commit

Permalink
Make avg hashrate better, still a trade off...
Browse files Browse the repository at this point in the history
  • Loading branch information
benrod3k authored and tmrlvi committed Feb 13, 2022
1 parent b702c47 commit 53c7f86
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions integrations/hiveos/h-stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,31 @@ if [ "$diffTime" -lt "$maxDelay" ]; then
brands=(${gpu_stats[1]})
temps=(${gpu_stats[2]})
fans=(${gpu_stats[3]})
count=${#busids[@]}
gpu_count=${#busids[@]}
hash_arr=()
busid_arr=()
fan_arr=()
temp_arr=()
lines=()
avg_hash_per_gpu=$((total_hashrate/$count))
idx=0
for(( i=0; i < count; i++ )); do
if [ $(gpu-detect NVIDIA) -gt 0 ]; then
brand_gpu_count=$(gpu-detect NVIDIA)
BRAND_MINER="nvidia"
elif [ $(gpu-detect AMD) -gt 0 ]; then
brand_gpu_count=$(gpu-detect AMD)
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]})
# TODO, get hash per gpu
hash_arr+=($avg_hash_per_gpu)
((idx++))
hash_arr+=($avg_hashrate)
done
hash_json=`printf '%s\n' "${hash_arr[@]}" | jq -cs '.'`
Expand Down

0 comments on commit 53c7f86

Please sign in to comment.