[Warning fixes 1/6] if 0/endif out unused function dbg_printf_pevent_info
by Joerg Mayer
Is someone intending to use it or should it be removed instead?
Signed-off-by: Joerg Mayer <jmpt(a)loplof.de>
diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
index cb7c672..3db5331 100644
--- a/src/process/do_process.cpp
+++ b/src/process/do_process.cpp
@@ -186,6 +186,7 @@ int dont_blame_me(char *comm)
return 0;
}
+#if 0
static void dbg_printf_pevent_info(struct event_format *event, struct pevent_record *rec)
{
static struct trace_seq s;
@@ -198,6 +199,7 @@ static void dbg_printf_pevent_info(struct event_format *event, struct pevent_rec
fprintf(stderr, "%.*s", s.len, s.buffer);
trace_seq_destroy(&s);
}
+#endif
static char * get_pevent_field_str(void *trace, struct event_format *event, struct format_field *field)
{
--
1.7.7
9 years, 8 months
[PATCH] tuninig: resize scaling support (v1)
by Sergey Senozhatsky
tuninig: resize scaling support v1
Initial version of terminal window resize support for tuning tab.
Supports both X and Y scalings:
-- X scaling: truncation (*)
* tunable result and description strings are now stored in dynamic
array, limited in size to current window X (mod MAX_LEN).
-- Y scaling: paging and scrolling
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
---
src/tuning/tuning.cpp | 87 +++++++++++++++++++++++++++++++++++----------------
1 file changed, 60 insertions(+), 27 deletions(-)
diff --git a/src/tuning/tuning.cpp b/src/tuning/tuning.cpp
index 4893597..541e9e0 100644
--- a/src/tuning/tuning.cpp
+++ b/src/tuning/tuning.cpp
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <ncurses.h>
-
+#include <math.h>
#include "tuning.h"
#include "tuningsysfs.h"
@@ -79,48 +79,81 @@ void initialize_tuning(void)
create_tab("Tunables", _("Tunables"), w, _(" <ESC> Exit | <Enter> Toggle tunable | <r> Window refresh"));
init_tuning();
-
w->cursor_max = all_tunables.size() - 1;
}
+#define XINDENT 3
+#define YINDENT 4
+#define MAX_LEN 4096
+static void redraw_window(WINDOW *win, int begin, int end, int cursor_pos)
+{
+ int x, y, i;
+ getmaxyx(stdscr, y, x);
+
+ wclrtoeol(win);
+ wmove(win, 1, 0);
+ x %= MAX_LEN;
+
+ for (y = 0, i = begin; i < end; i++, y++) {
+ char truncate = 0;
+ size_t sz = 0;
+ char line[x + 1];
+ if ((int)(y) != cursor_pos) {
+ wattrset(win, A_NORMAL);
+ sz = snprintf(line, x, " ");
+ } else {
+ wattrset(win, A_REVERSE);
+ sz = snprintf(line, x, ">> ");
+ }
+ sz += snprintf(line + sz, x, "%s", all_tunables[i]->result_string());
+ while (sz < 12)
+ sz += snprintf(line + sz, x, " ");
+ sz += snprintf(line + sz, x, "%s", all_tunables[i]->description());
+ if ((int)sz > x - XINDENT)
+ truncate = 1;
+ while ((int)sz < x - XINDENT)
+ sz += snprintf(line + sz, x, " ");
+ if (truncate)
+ sz += snprintf(line + x - XINDENT - 1, x, "~\n");
+ else
+ sz += snprintf(line + sz, x, "\n");
+
+ waddnstr(win, line, sz);
+ }
+}
static void __tuning_update_display(int cursor_pos)
{
+ static int last_frame_nr = 0;
+ int x, y, begin, end, frame_nr;
WINDOW *win;
- unsigned int i;
-
+
win = get_ncurses_win("Tunables");
-
if (!win)
return;
+ getmaxyx(stdscr, y, x);
+
+ y -= YINDENT;
+ frame_nr = ceil(cursor_pos / y);
+ end = (frame_nr + 1) * y;
+ if (end > (int)all_tunables.size())
+ end = all_tunables.size();
+
+ begin = frame_nr * y;
+ /* actual cursor position is frame-dependent */
+ cursor_pos -= frame_nr * y;
+ if (frame_nr != last_frame_nr)
+ should_clear = TRUE;
+ last_frame_nr = frame_nr;
if (should_clear) {
- should_clear = false;
+ should_clear = FALSE;
wclear(win);
}
- wmove(win, 2,0);
-
- for (i = 0; i < all_tunables.size(); i++) {
- char res[128];
- char desc[4096];
- strcpy(res, all_tunables[i]->result_string());
- strcpy(desc, all_tunables[i]->description());
- while (strlen(res) < 12)
- strcat(res, " ");
-
- while (strlen(desc) < 103)
- strcat(desc, " ");
- if ((int)i != cursor_pos) {
- wattrset(win, A_NORMAL);
- wprintw(win, " ");
- } else {
- wattrset(win, A_REVERSE);
- wprintw(win, ">> ");
- }
- wprintw(win, "%s %s\n", _(res), _(desc));
- }
+ redraw_window(win, begin, end, cursor_pos);
+ wnoutrefresh(win);
}
void tuning_update_display(void)
9 years, 8 months
Query: Weird Output values: Percentage over 100%
by viresh kumar
Hi,
I am noticing something strange in powertop reports.
When i run powertop with following parameters:
powertop -t 120 --html
I see following in summary section
Power Consumption Summary
0.1 wakeups/second, 0.0 GPU ops/second, 0.0 VFS ops/sec, 0.0 GFX
wakes/sec and 5375.4% CPU use
Usage Events/s Category Description
2693% 0.07 Timer tick_sched_timer
2680% 0.00 Timer ehci_watchdog
0.6% 0.00 Interrupt [7] sched(softirq)
0.2% 0.00 Interrupt [1] timer(softirq)
0.2% 0.00 Interrupt [29] twd
0.1% 0.00 kWork pm_runtime_work
0.1% 0.00 Timer led_heartbeat_function
0.1% 0.00 Interrupt [9] RCU(softirq)
0.1% 0.00 Interrupt [57] OMAP DISPC
0.1% 0.00 Process rsyslogd -c5
How is percentage over 100 %...
System Info:
PowerTOP Version v2.0
Kernel Version Linux version 3.4.0-01820-gcc96f22
(viresh@blr-linut-001) (gcc version 4.7.1 20120514 (prerelease)
(crosstool-NG linaro-1.13.1-2012.05-20120523 - Linaro GCC 2012.05) )
#5 SMP PREEMPT Tue Aug 28 12:44:52 IST 2012
System Name
CPU Information 2x
OS Information
Running on ARM: Panda Board.
--
viresh
9 years, 8 months
powertop 2.1 isn't measuring task power properly on my Thinkpad T530
by Marc MERLIN
Howdy,
I just downloaded and built 2.1, and a couple of things aren't right:
1) header columns aren't aligned with the data
2) power estimate shown in the kW range :)
See screenshot of 2.1 vs 1.98:
Is there other info I can provide?
Thanks,
Marc
----------------------------------------------------------------------------
PowerTOP 2.1 Overview Idle stats Frequency stats Device stats Tunables
The battery reports a discharge rate of 14.0 W
The estimated remaining time is 5 hours, 16 minutes
Summary: 448.2 wakeups/second, 82.7 GPU ops/seconds, 0.0 VFS ops/sec and 10.6% CPU use
Power est. Usage Events/s Category Description
10.0 kW 66.2 ms/s 257.2 Process /usr/bin/enlightenment
3.72 kW 566.5 µs/s 69.9 Process nm-applet --sm-disable
79.4 W 0.9 ms/s 9.7 Process xfce4-terminal -T window9 --role=window9
6.26 W 123.2 µs/s 0.00 Process xfce4-terminal -T window12 --role=window12
5.89 W 26.7% Device Display backlight
2.10 W 100.0% Device Audio codec alsa:hwC0D0: thinkpad (Realtek)
2.09 W 11.2 µs/s 0.15 Process xscreensaver
1.37 W 35.4 pkts/s Device Network interface: wlan0 (iwlwifi)
180 mW 3.7 ms/s 54.9 Interrupt [6] tasklet(softirq)
105 mW 1.1 ms/s 32.1 Process /usr/bin/python /usr/local/bin/offlineimap
77.8 mW 1.3 ms/s 23.7 Interrupt [47] i915@pci:0000:00:02.0
63.4 mW 0.8 ms/s 19.3 Timer hrtimer_wakeup
47.0 mW 1.1 ms/s 14.3 Timer tick_sched_timer
35.5 mW 1.5 ms/s 10.8 Interrupt [7] sched(softirq)
----------------------------------------------------------------------------
PowerTOP 1.98 Overview Idle stats Frequency stats Device stats Tunab
The battery reports a discharge rate of 14.1 W
Summary: 627.6 wakeups/second, 0.0 GPU ops/second and 0.0 VFS ops/sec
Power est. Usage Events/s Category Description
21.4 W 26.7% Device Display backlight
0 mW 88.5 ms/s 148.6 Process /usr/bin/enlightenment
0 mW 45.9 ms/s 0.5 Process powertop-2.1
0 mW 15.8 ms/s 147.2 Process /usr/bin/X :0 vt7 -br -no
0 mW 6.2 ms/s 1.4 Process /usr/sbin/NetworkManager
0 mW 4.7 ms/s 9.0 Interrupt [46] iwlwifi
0 mW 2.8 ms/s 0.15 Process [kswapd0]
0 mW 1.9 ms/s 85.0 Interrupt [6] tasklet(softirq)
0 mW 1.4 ms/s 5.9 Process gvim /home/merlin/powerto
0 mW 1.3 ms/s 39.3 Interrupt [47] i915@pci:0000:00:02.
0 mW 1.2 ms/s 49.7 Timer tick_sched_timer
0 mW 1.1 ms/s 30.5 Interrupt [7] sched(softirq)
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
9 years, 8 months
[Announcement] General PowerTOP Announcement
by Chris Ferron
Hello,
There are some new enhancements to the PowerTOP project coming, so
it's time to take a moment and send out an update. The project has seen
a steady increase in activity, and as such this is a good time to get
things kicked off.
UPDATES:
Community Meetings - There are plans to attempt community meetings over
IRC or GOOGLE+ hangout shortly after each release. The point of the
meeting is to communicate about what matters to the community for the
next release. In this meeting members will contribute to what is added
to PowerTOP's TODO list, discuss what PowerTOP needs for the next
release. The first meeting attempt will be held the second week of
September. A notice and more details will be sent in a separate email to
discuss and finalize.
Releases - Back in May PowerTOP v2.0 was released, and three months
later in August a minor release of v2.1 was completed. There is an
intent to execute a minor release every 3 months going forward. See
schedule below.
Email List - The PowerTOP project at this time uses the mailing list for
all communications. Starting ASAP it would be appreciated if all members
use categorize subject headings, as it is important to title your mail
for organization.
Example:
[Patch] - used to signify a patch or patch set
[Feature Request] - used to request a feature
[Bug] - used to report a Bug
[RFC] - used to request comments from the community on a patches or ideas
[Announcement] - used by maintainers to send announcements
This way the content of messages can be tracked more accurately.
Non-Intel Hardware - There has been some great additions to PowerTOP as
of late. Mostly work on getting ARM more enabled. This is fantastic, and
appreciated. But as a note, the current maintainers don't spend much
time working on non Intel Architecture for obvious reasons. BUT we (the
maintainers) are happy to accept work to enable non Intel Architectures,
and in fact encourage it. That said, members can also expect that
maintainers will not be doing a lot of testing or triage on areas not
evolving Intel Architecture. With that said, there will be some scouting
of participating members to possibly be trusted reviewers to help out
here. More about this below.
Roles - The PowerTOP project is growing, and we have some interesting
ambitions on PowerTOP's future. As needed rolls will be added and
scouting for prospective active members to fill those roles will also
happen as needed. As needs increase, so will the roles when it becomes
applicable. One of the roles we would like to start with is "Trusted
Reviewer". Please also note that roles are not going to be added without
good reason, the intent is not to build a huge hierarchy here.
A "Trusted Reviewer" is someone who maintainers trust to sign-off on
patches. For instance we will be scouting for someone to be a "Trusted
Reviewer" for ARM-specific patches. This person will be someone who
works and has experience with ARM architecture, and has been a solid
contributor to PowerTOP. "Trusted Reviewers" will not have commit rights
at this time, but patches will accepted or denied based on a "Trusted
Reviewers" comments. I'm hoping that this will help increase the quality
of code accepted while shortening the time it takes to review and accept
submissions.
With that explained, Sergey Senozhatsky has been named one of the first
Trusted Reviewers of PowerTOP. His high quality code, consistent
communication, and efforts towards PowerTOP has earned him trust with
the maintainers.
Current Roles - The current roles and persons are;
Project Owner / Maintainer - Arjan Van de ven
Maintainer - Chris Ferron
Transifex Project Owner - Margie Foster
General Trusted Reviewer - Sergey Senozhatsky
Arm Trusted Reviewer - TBD
Tentative Schedule - Here is the tentative schedule for the next nine
months.
Nov 1st (string freeze)
Nov 15th (release v2.2)
Nov 22nd (community meeting about v2.3)
Feb 1st (string freeze)
Feb 15th (release v2.3)
Feb 22nd (community meeting about v2.4)
May 1st (string freeze)
May 16th (release v2.5)
May 23nd (community meeting about v2.6)
Cheers,
Chris
9 years, 8 months
Support for printing report in text format in powertop2.x
by Viresh Kumar
Hi Guys,
I have following test case, i need to capture data using powertop
for some time and then analyse it.
There are two formats in which this is done as of today
- html
- csv
I believe we must also have a plain text version for it. Any cons
of that?
Without changing much of code, we can simply use html2text
at the end of program to create default file Powertop.txt.
Thanks for your inputs.
--
viresh
9 years, 8 months
[Warning fixes 2/6] Build with -Wno-unused-result for now, it seems at least some of these cases are intentional (see ml discussion)
by Joerg Mayer
Note: Is this this flag supported on all compilers?
Signed-off-by: Joerg Mayer <jmpt(a)loplof.de>
diff --git a/src/Makefile.am b/src/Makefile.am
index d233d85..ec70bc4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,8 +33,9 @@ powertop_SOURCES = parameters/persistent.cpp parameters/learn.cpp parameters/par
main.cpp css.h powertop.css cpu/intel_gpu.cpp
-powertop_CXXFLAGS = -fno-omit-frame-pointer -fstack-protector -Wall -Wshadow -Wformat $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(LIBNL_CFLAGS) $(GLIB2_CFLAGS)
-
+powertop_CXXFLAGS = \
+ -fno-omit-frame-pointer -fstack-protector -Wall -Wshadow -Wformat -Wno-unused-result \
+ $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(LIBNL_CFLAGS) $(GLIB2_CFLAGS)
powertop_CPPFLAGS = -D_FORTIFY_SOURCE=2 $(NCURSES_CFLAGS) $(PCIUTILS_CFLAGS) $(LIBNL_CFLAGS) $(GLIB2_CFLAGS) $(LIBZ_CFLAGS) -DLOCALEDIR=\"$(localedir)\"
--
1.7.7
9 years, 8 months
[Warning fixes 0/6] Fix or disable some warings
by Joerg Mayer
Mostly warning fixes. If you don't like some of them feel free to ignore,
otherwise either provide feedback or apply.
Oh, and no more trailing whitespace in two more directories
Joerg Mayer (6):
if 0/endif out unused function dbg_printf_pevent_info
Build with -Wno-unused-result for now, it seems at least some of
these cases are intentional (see ml discussion)
Remove trailing whitespace
Fix warning: warning: this decimal constant is unsigned only in
ISO C90 [enabled by default] by explicitely declaring the value
as UL
Fix warning: warning: this decimal constant is unsigned only in
ISO C90 [enabled by default] by explicitely declaring the value
as UL
Remove trailing whitespace in the cpu/ and process/ subdirs.
src/Makefile.am | 9 +++++----
src/cpu/abstract_cpu.cpp | 4 ++--
src/cpu/cpu.cpp | 12 ++++++------
src/cpu/intel_cpus.h | 2 +-
src/cpu/intel_gpu.cpp | 8 ++++----
src/process/do_process.cpp | 16 +++++++++-------
src/process/timer.cpp | 2 +-
7 files changed, 28 insertions(+), 25 deletions(-)
--
1.7.7
9 years, 8 months
[Warning fixes 6/6] Remove trailing whitespace in the cpu/ and process/ subdirs.
by Joerg Mayer
Signed-off-by: Joerg Mayer <jmpt(a)loplof.de>
diff --git a/src/cpu/abstract_cpu.cpp b/src/cpu/abstract_cpu.cpp
index 8b4c650..e3f9f9a 100644
--- a/src/cpu/abstract_cpu.cpp
+++ b/src/cpu/abstract_cpu.cpp
@@ -148,7 +148,7 @@ void abstract_cpu::insert_cstate(const char *linux_name, const char *human_name,
strcpy(state->human_name, human_name);
state->line_level = -1;
-
+
c = human_name;
while (*c) {
if (strcmp(linux_name, "active")==0) {
@@ -171,7 +171,7 @@ void abstract_cpu::insert_cstate(const char *linux_name, const char *human_name,
}
c++;
}
-
+
if (level >= 0)
state->line_level = level;
diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index c3f0c79..d31f0f9 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -235,7 +235,7 @@ static void handle_i965_gpu(void)
package = system_level.children[0];
-
+
core_number = package->children.size();
if (package->children.size() <= core_number)
@@ -310,7 +310,7 @@ void enumerate_cpus(void)
if (number >= 0) {
handle_one_cpu(number, vendor, family, model);
set_max_cpu(number);
- number = -2;
+ number = -2;
}
}
}
@@ -631,10 +631,10 @@ void report_display_cpu_pstates(void)
int line;
class abstract_cpu *_package, * _core, * _cpu;
unsigned int i, pstates_num;
-
+
for (i = 0, pstates_num = 0; i< all_cpus.size(); i++)
if (all_cpus[i]&& all_cpus[i]->pstates.size()> pstates_num)
- pstates_num = all_cpus[i]->pstates.size();
+ pstates_num = all_cpus[i]->pstates.size();
if ((!reportout.csv_report)&&(!reportout.http_report))
return;
@@ -981,7 +981,7 @@ void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time
cpu->go_idle(time);
}
- if (strcmp(event->name, "power_frequency") == 0
+ if (strcmp(event->name, "power_frequency") == 0
|| strcmp(event->name, "cpu_frequency") == 0){
ret = pevent_get_field_val(NULL, event, "state", &rec, &val, 0);
diff --git a/src/cpu/intel_cpus.h b/src/cpu/intel_cpus.h
index 1949af1..0762492 100644
--- a/src/cpu/intel_cpus.h
+++ b/src/cpu/intel_cpus.h
@@ -144,7 +144,7 @@ private:
uint64_t rc6_before, rc6_after;
uint64_t rc6p_before, rc6p_after;
uint64_t rc6pp_before, rc6pp_after;
-
+
struct timeval before;
struct timeval after;
diff --git a/src/cpu/intel_gpu.cpp b/src/cpu/intel_gpu.cpp
index 6b6df6c..18c998b 100644
--- a/src/cpu/intel_gpu.cpp
+++ b/src/cpu/intel_gpu.cpp
@@ -66,11 +66,11 @@ char * i965_core::fill_cstate_line(int line_nr, char *buffer, const char *separa
}
buffer[0] = 0;
-
+
time_delta = 1000000 * (after.tv_sec - before.tv_sec) + after.tv_usec - before.tv_usec;
ratio = 100000.0/time_delta;
- switch (line_nr) {
+ switch (line_nr) {
case 0:
d = 100.0 - ratio * (rc6_after + rc6p_after + rc6pp_after - rc6_before - rc6p_before - rc6pp_before);
break;
@@ -86,13 +86,13 @@ char * i965_core::fill_cstate_line(int line_nr, char *buffer, const char *separa
default:
return buffer;
}
-
+
/* cope with rounding errors due to the measurement interval */
if (d < 0.0)
d = 0.0;
if (d > 100.0)
d = 100.0;
-
+
sprintf(buffer,"%5.1f%%", d);
return buffer;
diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
index e127572..0b574b2 100644
--- a/src/process/do_process.cpp
+++ b/src/process/do_process.cpp
@@ -249,7 +249,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
field = pevent_find_any_field(event, "next_comm");
if (!field || !(field->flags & FIELD_IS_STRING))
return; /* ?? */
-
+
next_comm = get_pevent_field_str(trace, event, field);
ret = pevent_get_field_val(NULL, event, "next_pid", &rec, &val, 0);
@@ -308,8 +308,8 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
}
else if (strcmp(event->name, "sched_wakeup") == 0) {
class power_consumer *from = NULL;
- class process *dest_proc = NULL;
- class process *from_proc = NULL;
+ class process *dest_proc = NULL;
+ class process *from_proc = NULL;
const char *comm;
int flags;
int pid;
@@ -338,7 +338,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
field = pevent_find_any_field(event, "comm");
if (!field || !(field->flags & FIELD_IS_STRING))
- return;
+ return;
comm = get_pevent_field_str(trace, event, field);
@@ -635,7 +635,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
ret = pevent_get_field_val(NULL, event, "dev", &rec, &val, 0);
if (ret < 0)
-
+
return;
dev = (int)val;
@@ -789,7 +789,7 @@ void process_update_display(void)
WINDOW *win;
double pw;
int tl;
- int tlt;
+ int tlt;
int tlr;
int show_power;
diff --git a/src/process/timer.cpp b/src/process/timer.cpp
index 8917490..641328a 100644
--- a/src/process/timer.cpp
+++ b/src/process/timer.cpp
@@ -41,7 +41,7 @@ static bool timer_is_deferred(const char *handler)
bool ret = false;
char line[4096];
- file = fopen("/proc/timer_stats", "r");
+ file = fopen("/proc/timer_stats", "r");
if (!file) {
return ret;
}
--
1.7.7
9 years, 8 months