Exemplo n.º 1
0
void make_tunables_script(char *file)
{
	init_tuning();
	sort_tunables();

	// try to open the file for writing.
	FILE* f = (file)?fopen(file,"w"):stdout;
	if (!f) {
		fprintf(stderr,"Error: cannot open file %s for writing",file);
		return;
	}

	/* print shebang and some comments. */
	fprintf(f,"#!/bin/bash\n\n");
	fprintf(f,"###################################\n");
	fprintf(f,"#######  PowerTOP Tunables  #######\n");
	fprintf(f,"###################################\n\n");

	for (size_t i = 0; i < all_tunables.size(); i++) {
		if (all_tunables[i]->good_bad() != TUNE_BAD)
			continue;
		// TODO: it woudl be nice to categorize here.

		fprintf(f,"# %s\n", all_tunables[i]->description());
		fprintf(f,"%s\n\n", all_tunables[i]->toggle_script());
	}
	if (f != stderr)
		fclose(f);
}
Exemplo n.º 2
0
static void init_tuning(void)
{
	add_sysfs_tunable(_("Enable Audio codec power management"), "/sys/module/snd_hda_intel/parameters/power_save", "1");
	add_sysfs_tunable(_("NMI watchdog should be turned off"), "/proc/sys/kernel/nmi_watchdog", "0");
	add_sysfs_tunable(_("Power Aware CPU scheduler"), "/sys/devices/system/cpu/sched_mc_power_savings", "1");
	add_sysfs_tunable(_("VM writeback timeout"), "/proc/sys/vm/dirty_writeback_centisecs", "1500");
	add_sata_tunables();
	add_usb_tunables();
	add_runtime_tunables("pci");
	add_ethernet_tunable();
	add_bt_tunable();
	add_wifi_tunables();
	add_cpufreq_tunable();

	sort_tunables();
}
Exemplo n.º 3
0
void report_show_tunables(void)
{
	unsigned int i;
	bool is_header;
	/* three tables; bad, unfixable, good */

	sort_tunables();
	report.begin_section(SECTION_TUNING);

	for (is_header = true, i = 0; i < all_tunables.size(); i++) {
		int gb;

		gb = all_tunables[i]->good_bad();
		if (gb != TUNE_BAD)
			continue;

		if (is_header) {
			report.add_header("Software Settings in need of Tuning");
			report.begin_table(TABLE_WIDE);
			report.begin_row();
			report.begin_cell(CELL_TUNABLE_HEADER);
			report.add("Description");
			report.begin_cell(CELL_TUNABLE_HEADER);
			report.add("Script");
			is_header = false;
		}

		report.begin_row(ROW_TUNABLE_BAD);
		report.begin_cell();
		report.add(all_tunables[i]->description());
		report.begin_cell();
		report.add(all_tunables[i]->toggle_script());
	}

	for (i = 0, is_header = true; i < all_untunables.size(); i++) {
		if (is_header) {
			report.add_header("Untunable Software Issues");
			report.begin_table(TABLE_WIDE);
			report.begin_row();
			report.begin_cell(CELL_TUNABLE_HEADER);
			report.add("Description");
			is_header = false;
		}

		report.begin_row(ROW_TUNABLE_BAD);
		report.begin_cell();
		report.add(all_untunables[i]->description());
	}

	for (i = 0, is_header = true; i < all_tunables.size(); i++) {
		int gb;

		gb = all_tunables[i]->good_bad();
		if (gb != TUNE_GOOD)
			continue;

		if (is_header) {
			report.add_header("Optimal Tuned Software Settings");
			report.begin_table(TABLE_WIDE);
			report.begin_row();
			report.begin_cell(CELL_TUNABLE_HEADER);
			report.add("Description");
			is_header = false;
		}

		report.begin_row(ROW_TUNABLE);
		report.begin_cell();
		report.add(all_tunables[i]->description());
	}
}
Exemplo n.º 4
0
void tuning_window::expose(void)
{
	cursor_pos = 0;
	sort_tunables();
	repaint();
}
Exemplo n.º 5
0
void report_show_tunables(void)
{
	unsigned int i, line;
	/* three sections; bad, unfixable, good */

	if ((!reportout.csv_report)&&(!reportout.http_report))
		return;

	sort_tunables();


	if (reporttype)
		fprintf(reportout.http_report, "<div id=\"tuning\">\n");

	line = 0;
	for (i = 0; i < all_tunables.size(); i++) {
		int gb;

		gb = all_tunables[i]->good_bad();

		if (gb != TUNE_BAD)
			continue;

		if (line == 0) {
			if(reporttype)
				fprintf(reportout.http_report,"<h2>Software Settings in need of Tuning</h2>\n <table width=\"100%%\">\n");
			else
				fprintf(reportout.csv_report,"**Software Settings in need of Tuning**, \n\n");

		}

		line++;
		if (i < 1 && !reporttype)
			fprintf(reportout.csv_report, "Description, \n");

		if (reporttype)
		        fprintf(reportout.http_report, "<tr class=\"%s\"><td>%s</td><td>%s</td></tr>\n", tune_class_bad(line), all_tunables[i]->description(), all_tunables[i]->toggle_script());
		else
			fprintf(reportout.csv_report, "\"%s\", \n", all_tunables[i]->description());
	}

	if (line > 0) {
		if(reporttype)
			fprintf(reportout.http_report,"</table>\n");
		else
			fprintf(reportout.csv_report, "\n");
	}


	line = 0;
	for (i = 0; i < all_untunables.size(); i++) {
		if (line == 0) {
			if(reporttype)
				fprintf(reportout.http_report,
					"<h2>Untunable Software Issues</h2>\n <table width=\"100%%\">\n");
			else
				fprintf(reportout.csv_report,
					"**Untunable Software Issues**,\n\n");
		}

		line++;
		if (i < 1 && !reporttype)
			fprintf(reportout.csv_report, "Description, \n");

		if (reporttype)
			fprintf(reportout.http_report,
					"<tr class=\"%s\"><td>%s</td></tr>\n",
					tune_class_bad(line), all_untunables[i]->description());
		else
			fprintf(reportout.csv_report,"\"%s\", \n", all_untunables[i]->description());
	}

	if (line > 0) {
		if(reporttype)
			fprintf(reportout.http_report,"</table>\n");
		else
			fprintf(reportout.csv_report,"\n");
	}

	line = 0;
	for (i = 0; i < all_tunables.size(); i++) {
		int gb;

		gb = all_tunables[i]->good_bad();

		if (gb != TUNE_GOOD)
			continue;

		if (line == 0) {
			if (reporttype)
				fprintf(reportout.http_report,
					"<h2>Optimal Tuned Software Settings</h2>\n <table width=\"100%%\">\n");
			else
				fprintf(reportout.csv_report,
					"**Optimal Tuned Software Settings**, \n\n");
		}

		line++;
		if (i < 1 && !reporttype)
			fprintf(reportout.csv_report, "Description, \n");

		if (reporttype)
			fprintf(reportout.http_report,"<tr class=\"%s\"><td>%s</td></tr>\n",
			tune_class(line), all_tunables[i]->description());
		else
			fprintf(reportout.csv_report,"\"%s\", \n", all_tunables[i]->description());
	}

	if (line > 0){
		if (reporttype)
			fprintf(reportout.http_report,"</table></div>\n");
		else
			fprintf(reportout.csv_report,"\n");
	}
}