minion - report temp/cores/freq and handle temp formatting
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
diff --git a/driver-minion.c b/driver-minion.c
index 4b44b35..f6df560 100644
--- a/driver-minion.c
+++ b/driver-minion.c
@@ -2561,6 +2561,30 @@ static int64_t minion_scanwork(__maybe_unused struct thr_info *thr)
return hashcount;
}
+static const char *min_temp_0 = "<40";
+static const char *min_temp_1 = "40-60";
+static const char *min_temp_3 = "60-80";
+static const char *min_temp_7 = "80-100";
+static const char *min_temp_15 = ">100";
+static const char *min_temp_invalid = "?";
+
+static const char *temp_str(uint16_t temp)
+{
+ switch (temp) {
+ case 0:
+ return min_temp_0;
+ case 1:
+ return min_temp_1;
+ case 3:
+ return min_temp_3;
+ case 7:
+ return min_temp_7;
+ case 15:
+ return min_temp_15;
+ }
+ return min_temp_invalid;
+}
+
static void minion_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info *minioncgpu)
{
struct minion_info *minioninfo = (struct minion_info *)(minioncgpu->device_data);
@@ -2579,8 +2603,8 @@ static void minion_get_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
}
mutex_unlock(&(minioninfo->sta_lock));
- tailsprintf(buf, bufsiz, "max%3dC Ch:%2d Co:%d",
- (int)max_temp, minioninfo->chips, (int)cores);
+ tailsprintf(buf, bufsiz, "max%sC Ch:%2d Co:%d",
+ temp_str(max_temp), minioninfo->chips, (int)cores);
}
#define CHIPS_PER_STAT 8
@@ -2606,9 +2630,17 @@ static struct api_data *minion_api_stats(struct cgpu_info *minioncgpu)
max_chip = 0;
for (chip = 0; chip < MINION_CHIPS; chip++)
- if (minioninfo->chip[chip])
+ if (minioninfo->chip[chip]) {
max_chip = chip;
+ snprintf(buf, sizeof(buf), "Chip %d Temperature", chip);
+ root = api_add_const(root, buf, temp_str(minioninfo->chip_status[chip].temp), false);
+ snprintf(buf, sizeof(buf), "Chip %d Cores", chip);
+ root = api_add_uint16(root, buf, &(minioninfo->chip_status[chip].cores), true);
+ snprintf(buf, sizeof(buf), "Chip %d Frequency", chip);
+ root = api_add_uint32(root, buf, &(minioninfo->chip_status[chip].freq), true);
+ }
+
for (i = 0; i <= max_chip; i += CHIPS_PER_STAT) {
to = i + CHIPS_PER_STAT - 1;
if (to > max_chip)