summaryrefslogtreecommitdiff
path: root/recipes/powertop
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/powertop
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/powertop')
-rw-r--r--recipes/powertop/files/omap.patch231
-rw-r--r--recipes/powertop/powertop_1.10.bb17
-rw-r--r--recipes/powertop/powertop_1.11.bb20
-rw-r--r--recipes/powertop/powertop_1.8.bb17
4 files changed, 285 insertions, 0 deletions
diff --git a/recipes/powertop/files/omap.patch b/recipes/powertop/files/omap.patch
new file mode 100644
index 0000000000..a12c76f136
--- /dev/null
+++ b/recipes/powertop/files/omap.patch
@@ -0,0 +1,231 @@
+Index: display.c
+===================================================================
+--- display.c (revision 314)
++++ display.c (working copy)
+@@ -91,15 +91,18 @@
+
+ void setup_windows(void)
+ {
++ int yline = MAX_NUM_CSTATES;
++
+ getmaxyx(stdscr, maxy, maxx);
+
+ zap_windows();
+
+ title_bar_window = subwin(stdscr, 1, maxx, 0, 0);
+- cstate_window = subwin(stdscr, 7, maxx, 2, 0);
+- wakeup_window = subwin(stdscr, 1, maxx, 9, 0);
+- battery_power_window = subwin(stdscr, 2, maxx, 10, 0);
+- timerstat_window = subwin(stdscr, maxy-16, maxx, 12, 0);
++
++ cstate_window = subwin(stdscr, (yline + 2), maxx, 2, 0);
++ wakeup_window = subwin(stdscr, 1, maxx, (yline + 5), 0);
++ battery_power_window = subwin(stdscr, 2, maxx, (yline + 6), 0);
++ timerstat_window = subwin(stdscr, maxy-16, maxx, (yline + 8), 0);
+ maxtimerstats = maxy-16 -2;
+ maxwidth = maxx - 18;
+ suggestion_window = subwin(stdscr, 3, maxx, maxy-4, 0);
+@@ -166,18 +169,18 @@
+ int i, count = 0;
+ werase(cstate_window);
+
+- for (i=0; i < 10; i++) {
++ for (i=0; i < MAX_CSTATE_LINES; i++) {
+ if (i == topcstate+1)
+ wattron(cstate_window, A_BOLD);
+ else
+ wattroff(cstate_window, A_BOLD);
+- if (strlen(cstate_lines[i]) && count <= 6) {
++ if (strlen(cstate_lines[i]) && count <= MAX_CSTATE_LINES) {
+ print(cstate_window, count, 0, "%s", cstate_lines[i]);
+ count++;
+ }
+ }
+
+- for (i=0; i<6; i++) {
++ for (i=0; i<MAX_NUM_PSTATES; i++) {
+ if (i == topfreq+1)
+ wattron(cstate_window, A_BOLD);
+ else
+Index: powertop.c
+===================================================================
+--- powertop.c (revision 314)
++++ powertop.c (working copy)
+@@ -757,7 +757,7 @@
+ show_acpi_power_line(rate, cap, prev_bat_cap - cap, time(NULL) - prev_bat_time);
+ }
+
+-char cstate_lines[12][200];
++char cstate_lines[MAX_CSTATE_LINES][200];
+
+ void usage()
+ {
+@@ -893,7 +893,7 @@
+ }
+
+ memset(&cstate_lines, 0, sizeof(cstate_lines));
+- topcstate = -4;
++ topcstate = -(MAX_NUM_CSTATES);
+ if (totalevents == 0 && maxcstate <= 1) {
+ sprintf(cstate_lines[5],_("< Detailed C-state information is not available.>\n"));
+ } else {
+@@ -907,7 +907,7 @@
+ sprintf(cstate_lines[1], _("C0 (cpu running) (%4.1f%%)\n"), percentage);
+ if (percentage > 50)
+ topcstate = 0;
+- for (i = 0; i < 8; i++)
++ for (i = 0; i < MAX_NUM_CSTATES; i++)
+ if (cur_usage[i]) {
+ sleept = (cur_duration[i] - last_duration[i]) / (cur_usage[i] - last_usage[i]
+ + 0.1) / FREQ;
+@@ -1173,3 +1173,9 @@
+
+ return 0;
+ }
++
++#if defined (__I386__)
++ print_intel_cstates();
++#elif defined (OMAP3)
++ print_omap3_cstates();
++#endif
+Index: omapcstates.c
+===================================================================
+--- omapcstates.c (revision 0)
++++ omapcstates.c (revision 0)
+@@ -0,0 +1,65 @@
++/*
++ * * Copyright 2008, Texas Instruments Incorporated.
++ * *
++ * * This file prints the C states supported by the OMAP processor.
++ * * (Based on intelcstates.c)
++ * *
++ * * This program file is free software; you can redistribute it and/or modify it
++ * * 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
++ * */
++
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <stdint.h>
++#include <sys/types.h>
++#include <dirent.h>
++#include <ctype.h>
++
++#include "powertop.h"
++
++
++#if defined(OMAP3)
++/**
++ * * print_omap3_cstates() - Prints the list of supported C-states.
++ * *
++ * * This functions uses standard sysfs interface of the cpuidle framework
++ * * to extract the information of the C-states supported by the Linux
++ * * kernel.
++ * **/
++void print_omap3_cstates(void)
++{
++ DIR *dir;
++ struct dirent *entry;
++
++ dir = opendir("/sys/devices/system/cpu/cpu0/cpuidle");
++
++ if (dir) {
++ printf(_("Supported C-states : "));
++
++ while ((entry = readdir(dir))) {
++ if (strlen(entry->d_name) < 3)
++ continue;
++
++ printf("C%s ", entry->d_name);
++ }
++ printf("\n");
++
++ closedir(dir);
++ }
++}
++#endif
++
+Index: powertop.h
+===================================================================
+--- powertop.h (revision 314)
++++ powertop.h (working copy)
+@@ -28,6 +28,20 @@
+
+ #include <libintl.h>
+
++#if defined(__I386__)
++#define MAX_NUM_CSTATES 4
++#define MAX_NUM_PSTATES 5
++
++#elif defined(OMAP3)
++#define MAX_NUM_CSTATES 7
++#define MAX_NUM_PSTATES 5
++
++#else
++#error "No valid architecture is defined."
++#endif
++
++#define MAX_CSTATE_LINES (MAX_NUM_CSTATES + 3)
++
+ struct line {
+ char *string;
+ int count;
+@@ -64,8 +78,8 @@
+
+
+
+-extern char cstate_lines[12][200];
+-extern char cpufreqstrings[6][80];
++extern char cstate_lines[MAX_CSTATE_LINES][200];
++extern char cpufreqstrings[MAX_NUM_PSTATES][80];
+
+ extern int topcstate;
+ extern int topfreq;
+Index: cpufreqstats.c
+===================================================================
+--- cpufreqstats.c (revision 314)
++++ cpufreqstats.c (working copy)
+@@ -42,7 +42,7 @@
+
+ struct cpufreqdata delta[16];
+
+-char cpufreqstrings[6][80];
++char cpufreqstrings[MAX_NUM_PSTATES][80];
+ int topfreq = -1;
+
+ static void zap(void)
+Index: Makefile
+===================================================================
+--- Makefile (revision 314)
++++ Makefile (working copy)
+@@ -1,7 +1,7 @@
+ BINDIR=/usr/bin
+ LOCALESDIR=/usr/share/locale
+ MANDIR=/usr/share/man/man1
+-WARNFLAGS=-Wall -W -Wshadow
++WARNFLAGS=-Wall -Wstrict-prototypes
+ CFLAGS?=-O1 -g ${WARNFLAGS}
+ CC?=gcc
+
+@@ -16,7 +16,7 @@
+ #
+
+ OBJS = powertop.o config.o process.o misctips.o bluetooth.o display.o suggestions.o wireless.o cpufreq.o \
+- sata.o xrandr.o ethernet.o cpufreqstats.o usb.o urbnum.o intelcstates.o
++ sata.o xrandr.o ethernet.o cpufreqstats.o usb.o urbnum.o intelcstates.o omapcstates.o
+
+
+ powertop: $(OBJS) Makefile powertop.h
diff --git a/recipes/powertop/powertop_1.10.bb b/recipes/powertop/powertop_1.10.bb
new file mode 100644
index 0000000000..4a429d68ba
--- /dev/null
+++ b/recipes/powertop/powertop_1.10.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "PowerTOP, a tool that helps you find what software is using the most power."
+HOMEPAGE = "http://www.linuxpowertop.org/"
+LICENSE = "GPLv2"
+DEPENDS = "virtual/libintl ncurses"
+
+SRC_URI = "http://www.lesswatts.org/projects/powertop/download/powertop-${PV}.tar.gz"
+
+CFLAGS += "${LDFLAGS}"
+
+do_configure() {
+ # We do not build ncurses with wide char support
+ sed -i -e "s/lncursesw/lncurses/" ${S}/Makefile
+}
+
+do_install() {
+ oe_runmake install DESTDIR=${D}
+}
diff --git a/recipes/powertop/powertop_1.11.bb b/recipes/powertop/powertop_1.11.bb
new file mode 100644
index 0000000000..2fb8061c59
--- /dev/null
+++ b/recipes/powertop/powertop_1.11.bb
@@ -0,0 +1,20 @@
+DESCRIPTION = "PowerTOP, a tool that helps you find what software is using the most power."
+HOMEPAGE = "http://www.linuxpowertop.org/"
+LICENSE = "GPLv2"
+DEPENDS = "virtual/libintl ncurses"
+
+SRC_URI = "http://www.lesswatts.org/projects/powertop/download/powertop-${PV}.tar.gz"
+
+SRC_URI_append_beagleboard = " file://omap.patch;patch=1;pnum=0"
+
+CFLAGS += "${LDFLAGS}"
+CFLAGS_beagleboard += "-DOMAP3"
+
+do_configure() {
+ # We do not build ncurses with wide char support
+ sed -i -e "s/lncursesw/lncurses/" ${S}/Makefile
+}
+
+do_install() {
+ oe_runmake install DESTDIR=${D}
+}
diff --git a/recipes/powertop/powertop_1.8.bb b/recipes/powertop/powertop_1.8.bb
new file mode 100644
index 0000000000..ab84161ddc
--- /dev/null
+++ b/recipes/powertop/powertop_1.8.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "PowerTOP, a tool that helps you find what software is using the most power."
+HOMEPAGE = "http://www.linuxpowertop.org/"
+LICENSE = "GPLv2"
+DEPENDS = "ncurses"
+
+SRC_URI = "http://www.linuxpowertop.org/download/powertop-${PV}.tar.gz"
+
+CFLAGS += "${LDFLAGS}"
+
+do_configure() {
+ # We do not build ncurses with wide char support
+ sed -i -e "s/lncursesw/lncurses/" ${S}/Makefile
+}
+
+do_install() {
+ oe_runmake install DESTDIR=${D}
+}