Adjust avalon temp values on one lot of valid nonces from the parser.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
diff --git a/driver-avalon.c b/driver-avalon.c
index 839d83a..d5b58a6 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -613,6 +613,9 @@ static struct work *avalon_valid_result(struct cgpu_info *avalon, struct avalon_
(char *)ar->data, 64, 12);
}
+static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *info,
+ struct avalon_result *ar);
+
static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *info,
struct thr_info *thr, char *buf, size_t *offset)
{
@@ -628,13 +631,21 @@ static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *i
ar = (struct avalon_result *)&buf[i];
if ((work = avalon_valid_result(avalon, ar)) != NULL) {
+ bool gettemp = false;
+
found = true;
mutex_lock(&info->lock);
- info->nonces++;
+ if (!avalon->results++ % info->miner_count) {
+ gettemp = true;
+ avalon->results = 0;
+ }
+ info->nonces++;
mutex_unlock(&info->lock);
avalon_decode_nonce(thr, avalon, info, ar, work);
+ if (gettemp)
+ avalon_update_temps(avalon, info, ar);
break;
}
}
@@ -812,6 +823,26 @@ static inline void adjust_fan(struct avalon_info *info)
}
}
+static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *info,
+ struct avalon_result *ar)
+{
+ record_temp_fan(info, ar, &(avalon->temp));
+ applog(LOG_INFO,
+ "Avalon: Fan1: %d/m, Fan2: %d/m, Fan3: %d/m\t"
+ "Temp1: %dC, Temp2: %dC, Temp3: %dC, TempMAX: %dC",
+ info->fan0, info->fan1, info->fan2,
+ info->temp0, info->temp1, info->temp2, info->temp_max);
+ info->temp_history_index++;
+ info->temp_sum += avalon->temp;
+ applog(LOG_DEBUG, "Avalon: temp_index: %d, temp_count: %d, temp_old: %d",
+ info->temp_history_index, info->temp_history_count, info->temp_old);
+ if (info->temp_history_index == info->temp_history_count) {
+ adjust_fan(info);
+ info->temp_history_index = 0;
+ info->temp_sum = 0;
+ }
+}
+
/* We use a replacement algorithm to only remove references to work done from
* the buffer when we need the extra space for new work. */
static bool avalon_fill(struct cgpu_info *avalon)
@@ -850,7 +881,6 @@ static int64_t avalon_scanhash(struct thr_info *thr)
struct avalon_info *info;
struct avalon_task at;
- struct avalon_result ar;
int i;
int avalon_get_work_count;
int start_count, end_count;
@@ -924,24 +954,6 @@ static int64_t avalon_scanhash(struct thr_info *thr)
avalon_rotate_array(avalon);
- if (hash_count) {
- record_temp_fan(info, &ar, &(avalon->temp));
- applog(LOG_INFO,
- "Avalon: Fan1: %d/m, Fan2: %d/m, Fan3: %d/m\t"
- "Temp1: %dC, Temp2: %dC, Temp3: %dC, TempMAX: %dC",
- info->fan0, info->fan1, info->fan2,
- info->temp0, info->temp1, info->temp2, info->temp_max);
- info->temp_history_index++;
- info->temp_sum += avalon->temp;
- applog(LOG_DEBUG, "Avalon: temp_index: %d, temp_count: %d, temp_old: %d",
- info->temp_history_index, info->temp_history_count, info->temp_old);
- if (info->temp_history_index == info->temp_history_count) {
- adjust_fan(info);
- info->temp_history_index = 0;
- info->temp_sum = 0;
- }
- }
-
/* This hashmeter is just a utility counter based on returned shares */
return hash_count;
}