• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2007, Intel Corporation
3  *
4  * This file is part of PowerTOP
5  *
6  * This program file is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program in a file named COPYING; if not, write to the
17  * Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301 USA
20  *
21  * Authors:
22  * 	Arjan van de Ven <arjan@linux.intel.com>
23  */
24 
25 
26 #ifndef __INCLUDE_GUARD_POWERTOP_H_
27 #define __INCLUDE_GUARD_POWERTOP_H_
28 
29 #include <libintl.h>
30 
31 struct line {
32 	char	*string;
33 	int	count;
34 	char 	pid[12];
35 };
36 
37 typedef void (suggestion_func)(void);
38 
39 extern struct line     *lines;
40 extern int             linehead;
41 extern int             linesize;
42 extern int             linectotal;
43 
44 extern double displaytime;
45 
46 void suggest_process_death(char *process_match, char *process_name, struct line *slines, int linecount, double minwakeups, char *comment, int weight);
47 void suggest_kernel_config(char *string, int onoff, char *comment, int weight);
48 void suggest_laptop_mode(void);
49 void suggest_bluetooth_off(void);
50 void suggest_nmi_watchdog(void);
51 void suggest_hpet(void);
52 void suggest_ac97_powersave(void);
53 void suggest_wireless_powersave(void);
54 void suggest_ondemand_governor(void);
55 void suggest_noatime(void);
56 void suggest_sata_alpm(void);
57 void suggest_powersched(void);
58 void suggest_xrandr_TV_off(void);
59 void suggest_WOL_off(void);
60 void suggest_writeback_time(void);
61 void suggest_usb_autosuspend(void);
62 void usb_activity_hint(void);
63 
64 
65 
66 
67 extern char cstate_lines[12][200];
68 extern char cpufreqstrings[6][80];
69 
70 extern int topcstate;
71 extern int topfreq;
72 extern int dump;
73 
74 extern int showpids;
75 
76 extern char status_bar_slots[10][40];
77 extern char suggestion_key;
78 extern suggestion_func *suggestion_activate;
79 
80 
81 /* min definition borrowed from the Linux kernel */
82 #define min(x,y) ({ \
83         typeof(x) _x = (x);     \
84         typeof(y) _y = (y);     \
85         (void) (&_x == &_y);            \
86         _x < _y ? _x : _y; })
87 
88 
89 #define _(STRING)    gettext(STRING)
90 
91 
92 #define PT_COLOR_DEFAULT    1
93 #define PT_COLOR_HEADER_BAR 2
94 #define PT_COLOR_ERROR      3
95 #define PT_COLOR_RED        4
96 #define PT_COLOR_YELLOW     5
97 #define PT_COLOR_GREEN      6
98 #define PT_COLOR_BRIGHT     7
99 #define PT_COLOR_BLUE	    8
100 extern int maxwidth;
101 
102 void show_title_bar(void);
103 void setup_windows(void);
104 void initialize_curses(void);
105 void show_acpi_power_line(double rate, double cap, double capdelta, time_t time);
106 void show_pmu_power_line(unsigned sum_voltage_mV,
107                          unsigned sum_charge_mAh, unsigned sum_max_charge_mAh,
108                          int sum_discharge_mA);
109 void show_cstates(void);
110 void show_wakeups(double d, double interval, double c0time);
111 void show_timerstats(int nostats, int ticktime);
112 void show_suggestion(char *sug);
113 
114 void pick_suggestion(void);
115 void add_suggestion(char *text, int weight, char key, char *keystring, suggestion_func *func);
116 void reset_suggestions(void);
117 void print_all_suggestions(void);
118 void push_line(char *string, int count);
119 
120 void  do_cpufreq_stats(void);
121 void count_usb_urbs(void);
122 
123 void display_usb_activity(void);
124 void activate_usb_autosuspend(void);
125 void print_intel_cstates(void);
126 
127 
128 #endif
129