/*
* Copyright 2009, Intel Corporation
* Copyright 2009, Sun Microsystems, Inc
*
* This file is part of PowerTOP
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program in a file named COPYING; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authors:
* Arjan van de Ven <arjan@linux.intel.com>
* Eric C Saxe <eric.saxe@sun.com>
* Aubrey Li <aubrey.li@intel.com>
*/
/*
* GPL Disclaimer
*
* For the avoidance of doubt, except that if any license choice other
* than GPL or LGPL is available it will apply instead, Sun elects to
* use only the General Public License version 2 (GPLv2) at this time
* for any software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later
* version may be used, or where a choice of which version of the GPL
* is applied is otherwise unspecified.
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "powertop.h"
/*
* Default number of intervals we display a suggestion before moving
* to the next.
*/
/*
* Global pointer to the current suggestion.
*/
/*
* Head of the list of suggestions.
*/
/*
* Add a new suggestion. Only one suggestion per text allowed.
*/
void
{
/*
* Text is a required field for suggestions
*/
return;
/*
* Creating first element
*/
return;
} else {
return;
pos = n;
}
/*
* Create a new element
*/
return;
/*
* Ordering placed the new element at the end
*/
;
} else {
/*
* Ordering placed the new element at the start
*/
} else {
/*
* Ordering placed the new element somewhere in
* the middle
*/
}
}
}
}
/*
* Removes a suggestion, returning 0 if not found and 1 if so.
*/
int
{
sugg_t *n;
int ret = 0;
/* Removing the first element */
if (n == sugg) {
/* Removing the only element */
} else {
}
} else {
/* Removing the last element */
} else {
/* Removing an intermediate element */
}
}
/*
* If this suggestions is currently being suggested,
* remove it and update the screen.
*/
if (n == g_curr_sugg) {
}
}
free(n);
ret = 1;
}
}
return (ret);
}
/*
* Chose a suggestion to display. The list of suggestions is ordered by weight,
* so we only worry about fariness here. Each suggestion, starting with the
* first (the 'heaviest') is displayed during PT_SUGG_DEF_SLICE intervals.
*/
void
pt_sugg_pick(void)
{
sugg_t *n;
g_curr_sugg = NULL;
return;
}
if (n->slice++ < PT_SUGG_DEF_SLICE) {
/*
* Don't need to re-suggest the current suggestion.
*/
if (g_curr_sugg == n && !g_sig_resize)
return;
/*
* Remove the current suggestion from screen.
*/
if (g_curr_sugg != NULL) {
}
}
}
g_curr_sugg = n;
return;
}
}
/*
* All suggestions have run out of slice quotas, so we restart.
*/
n->slice = 0;
goto search;
}
void
pt_sugg_as_root(void)
{
pt_sugg_add("Suggestion: run as root to get suggestions"
NULL);
}