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
void initialize_tuning(void)
{
	class tuning_window *w;

	w = new tuning_window();
	create_tab("Tunables", _("Tunables"), w, _(" <ESC> Exit | <Enter> Toggle tunable | <r> Window refresh"));

	init_tuning();

	w->cursor_max = all_tunables.size() - 1;
}
Exemplo n.º 3
0
void tuning_window::window_refresh()
{
	clear_tuning();
	should_clear = true;
	init_tuning();
}