Beispiel #1
0
cpudevice::cpudevice(const char *classname, const char *dev_name, class abstract_cpu *_cpu)
{
	strcpy(_class, classname);
	strcpy(_cpuname, dev_name);
	cpu = _cpu;
	wake_index = get_param_index("cpu-wakeups");;
	consumption_index = get_param_index("cpu-consumption");;
	r_wake_index = get_result_index("cpu-wakeups");;
	r_consumption_index = get_result_index("cpu-consumption");;
}
Beispiel #2
0
void set_result_value(const char *name, double value, struct result_bundle *the_bundle)
{
	unsigned int index = get_result_index(name);
	if (index >= the_bundle->utilization.size())
		the_bundle->utilization.resize(index+1);
	the_bundle->utilization[index] = value;
}
Beispiel #3
0
thinkpad_fan::thinkpad_fan(): device()
{
	start_rate = 0;
	end_rate = 0;
	fan_index = get_param_index("thinkpad-fan");
	fansqr_index = get_param_index("thinkpad-fan-sqr");
	fancub_index = get_param_index("thinkpad-fan-cub");
	r_index = get_result_index("thinkpad-fan");
	register_sysfs_path("/sys/devices/platform/thinkpad_hwmon");
}
Beispiel #4
0
void dump_result_bundle(struct result_bundle *res)
{
	map<string, int>::iterator it;
	unsigned int index;

	printf("\n\n");
	printf("Utilisation state \n");
	printf("----------------------------------\n");
	printf("Value\t\tName\n");
	for (it = result_index.begin(); it != result_index.end(); it++) {
		index = get_result_index(it->first.c_str());
		printf("%5.2f%%\t\t%s(%i)\n", res->utilization[index], it->first.c_str(), index);
	}

	printf("\n");
	printf("Power: %5.1f\n", res->power);

	printf("----------------------------------\n");
}
Beispiel #5
0
int utilization_power_valid(const char *u)
{
	unsigned int i;
	unsigned int index;
	double first_value;

	index = get_result_index(u);
	if (index <= 0)
		return 0;

	first_value = past_results[0]->utilization[index];
	for (i = 1; i < past_results.size(); i++) {
		if (get_result_value(index, past_results[i]) < first_value - 0.0001)
			return 1;
		if (get_result_value(index, past_results[i]) > first_value + 0.0001)
			return 1;	
	}

	return 0;
}
Beispiel #6
0
double get_result_value(const char *name, struct result_bundle *the_bundle)
{
	return get_result_value(get_result_index(name), the_bundle);
}