Ejemplo n.º 1
0
static struct api_data *avalon2_api_stats(struct cgpu_info *cgpu)
{
	struct api_data *root = NULL;
	struct avalon2_info *info = cgpu->device_data;
	int i, a, b;
	char buf[24];
	double hwp;
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "ID%d MM Version", i + 1);
		root = api_add_string(root, buf, &(info->mm_version[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MINERS * AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Match work count%02d", i + 1);
		root = api_add_int(root, buf, &(info->matching_work[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Local works%d", i + 1);
		root = api_add_int(root, buf, &(info->local_works[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Hardware error works%d", i + 1);
		root = api_add_int(root, buf, &(info->hw_works[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		a = info->hw_works[i];
		b = info->local_works[i];
		hwp = b ? ((double)a / (double)b) : 0;

		sprintf(buf, "Device hardware error%d%%", i + 1);
		root = api_add_percent(root, buf, &hwp, true);
	}
	for (i = 0; i < 2 * AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Temperature%d", i + 1);
		root = api_add_int(root, buf, &(info->temp[i]), false);
	}
	for (i = 0; i < 2 * AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Fan%d", i + 1);
		root = api_add_int(root, buf, &(info->fan[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Voltage%d", i + 1);
		root = api_add_int(root, buf, &(info->get_voltage[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Frequency%d", i + 1);
		root = api_add_int(root, buf, &(info->get_frequency[i]), false);
	}

	return root;
}
Ejemplo n.º 2
0
static struct api_data *hashratio_api_stats(struct cgpu_info *cgpu)
{
	struct api_data *root = NULL;
	struct hashratio_info *info = cgpu->device_data;
	char buf[24];
	char buf2[256];
	double hwp;
	int i;

	// mm version
	sprintf(buf, "MM Version");
	root = api_add_string(root, buf, info->mm_version, false);
	
	// asic freq
	sprintf(buf, "Asic Freq (MHz)");
	root = api_add_int(root, buf, &(info->default_freq), false);
	
	// match work count
	for (i = 0; i < HRTO_DEFAULT_MODULARS; i++) {
		sprintf(buf, "Match work Modular %02d", i + 1);
		memset(buf2, 0, sizeof(buf2));
		snprintf(buf2, sizeof(buf2),
				 "%02d:%08d %02d:%08d %02d:%08d %02d:%08d "
				 "%02d:%08d %02d:%08d %02d:%08d %02d:%08d "
				 "%02d:%08d %02d:%08d %02d:%08d %02d:%08d "
				 "%02d:%08d %02d:%08d %02d:%08d %02d:%08d",
				i*16 + 1, info->matching_work[i*16 + 0],
				i*16 + 2, info->matching_work[i*16 + 1],
				i*16 + 3, info->matching_work[i*16 + 2],
				i*16 + 4, info->matching_work[i*16 + 3],
				i*16 + 5, info->matching_work[i*16 + 4],
				i*16 + 6, info->matching_work[i*16 + 5],
				i*16 + 7, info->matching_work[i*16 + 6],
				i*16 + 8, info->matching_work[i*16 + 7],
				i*16 + 9, info->matching_work[i*16 + 8],
				i*16 + 10, info->matching_work[i*16 + 9],
				i*16 + 11, info->matching_work[i*16 + 10],
				i*16 + 12, info->matching_work[i*16 + 11],
				i*16 + 13, info->matching_work[i*16 + 12],
				i*16 + 14, info->matching_work[i*16 + 13],
				i*16 + 15, info->matching_work[i*16 + 14],
				i*16 + 16, info->matching_work[i*16 + 15]);
		root = api_add_string(root, buf, buf2, true);
	}
	
	// local works
	sprintf(buf, "Local works");
	root = api_add_int(root, buf, &(info->local_works), false);
	
	// hardware error works
	sprintf(buf, "Hardware error works");
	root = api_add_int(root, buf, &(info->hw_works), false);
	
	// device hardware error %
	hwp = info->local_works ? ((double)info->hw_works / (double)info->local_works) : 0;
	sprintf(buf, "Device hardware error%%");
	root = api_add_percent(root, buf, &hwp, true);
	
	// Temperature
	sprintf(buf, "Temperature");
	root = api_add_int(root, buf, &(info->temp), false);

	// Fan
	for (i = 0; i < HRTO_FAN_COUNT; i++) {
		sprintf(buf, "Fan%d", i+1);
		root = api_add_int(root, buf, &(info->fan[i]), false);
	}

	return root;
}
Ejemplo n.º 3
0
static struct api_data *avalon2_api_stats(struct cgpu_info *cgpu)
{
	struct api_data *root = NULL;
	struct avalon2_info *info = cgpu->device_data;
	int i, j, a, b;
	char buf[24];
	double hwp;
	int minerindex, minercount;

	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "ID%d MM Version", i + 1);
		root = api_add_string(root, buf, &(info->mm_version[i]), false);
	}

	minerindex = 0;
	minercount = 0;
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if (info->dev_type[i] == AVA2_ID_AVAX) {
			minerindex += AVA2_DEFAULT_MINERS;
			continue;
		}

		if (info->dev_type[i] == AVA2_ID_AVA2)
			minercount = AVA2_DEFAULT_MINERS;

		if (info->dev_type[i] == AVA2_ID_AVA3)
			minercount = AVA2_AVA3_MINERS;

		for (j = minerindex; j < (minerindex + minercount); j++) {
			sprintf(buf, "Match work count%02d", j+1);
			root = api_add_int(root, buf, &(info->matching_work[j]), false);
		}
		minerindex += AVA2_DEFAULT_MINERS;
	}

	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Local works%d", i + 1);
		root = api_add_int(root, buf, &(info->local_works[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Hardware error works%d", i + 1);
		root = api_add_int(root, buf, &(info->hw_works[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		a = info->hw_works[i];
		b = info->local_works[i];
		hwp = b ? ((double)a / (double)b) : 0;

		sprintf(buf, "Device hardware error%d%%", i + 1);
		root = api_add_percent(root, buf, &hwp, true);
	}
	for (i = 0; i < 2 * AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i/2] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Temperature%d", i + 1);
		root = api_add_int(root, buf, &(info->temp[i]), false);
	}
	for (i = 0; i < 2 * AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i/2] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Fan%d", i + 1);
		root = api_add_int(root, buf, &(info->fan[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Voltage%d", i + 1);
		root = api_add_int(root, buf, &(info->get_voltage[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Frequency%d", i + 1);
		root = api_add_int(root, buf, &(info->get_frequency[i]), false);
	}
	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
		if(info->dev_type[i] == AVA2_ID_AVAX)
			continue;
		sprintf(buf, "Power good %02x", i + 1);
		root = api_add_int(root, buf, &(info->power_good[i]), false);
	}

	return root;
}