http://defect.opensolaris.org/bz/show_bug.cgi?id=7951
Rafael Vanoni <rafael.vanoni at sun.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ACCEPTED |FIXINPROGRESS
--- Comment #3 from Rafael Vanoni <rafael.vanoni at sun.com> 2009-05-04
00:03:30 ---
This patch is proposing a fix for all the issues mentioned above, plus the
functionality proposed in 7953 PowerTOP should allow the user to freeze its
subwindows.
A good amount of code was rewritten for this patch, here's a summary of the
changes to each file. I've posted a webrev @
http://cr.opensolaris.org/~rafaelv/ptop-display/
battery.c: simple renaming of the routine to follow the rest of the coding
style
cpufreq.c: also renaming routines to follow the overall coding style.
pt_cpufreq_check_pm() was extracted from pt_cpufreq_suggest() so that both the
routines that suggests turning CPUPM on and the routine that does the change
will check if it isn't already activated. This was done to avoid possible
duplicated keywords in power.etc. pt_cpufreq_close() closes the DTrace program
to freeze this subwindow - for 7953.
cpuidle.c: pt_cpuidle_close() also for 7953.
display.c: moving #defines from powertop.h here, as these are locally used.
Created a new structure "sb_slot_t" (sb == status bar) to hold each status bar
entry. The status bar is now dynamically allocated, anchored at *status_bar,
entries are automatically added or removed by calling
pt_display_mod_status_bar(), only one per message is allowed.
zap_windows() is gone, we don't need to destroy and recreate all subwindows at
every refresh. pt_display_init_curses() (also renamed to follow coding style)
now checks the size of the terminal window to make sure there's at least room
for the states window.
events.c: another renaming.
suggestions.c : changing how the display is refreshed and adding the
functionality to allow the user to freeze each subwindow (which adds a status
bar slot every time a window is freezed) called for the re-write of the status
bar and the way suggestions are displayed. In addition to that, I took the
liberty to rewrite most of suggestions.c for the following reasons:
(a) suggestions were being completely removed and added at every loop
iteration, unnecessarily.
(b) the routine that selected a suggestion was using a random based hash
against the weight to chose one, which I think could be improved. IMHO,
suggestions should be ordered by weight and presented to the user in that
ordering, but still allowing all existing suggestions to be displayed.
The new routine to add suggestions inserts the new one in a liked list ordered
from the 'heaviest' to the 'thinnest' suggestion. pt_sugg_pick() walks that
list presenting each suggestion for PT_SUGG_DEF_SLICE intervals, with the idea
that each suggestion has a time slice, zero'ed when we've displayed them all.
When a suggestion is activated, we remove it from the list.
powertop.c: all of the changes above required a handful of changes in main(),
mostly notable the addition of the 'I' (idle), 'F' (frequency) and 'E' (events)
handlers for pressed keys to implement 7953.
Because these changes required a re-write of this much code, I had to make a
few design decisions which were not discussed previously. I believe the changes
are improving both the code and functionality, but if you feel I went too far
somewhere, please let me know and we can decide the best way to go about it.
--
Configure bugmail: http://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.