tunables: check usb autosuspend support before add

Some usb devices do not have drivers that support autosuspend.
These drivers should not be added to the list of tunables, because
toggling their good/bad value does nothing.

Signed-off-by: Nanley Chery <nanleychery@gmail.com>
configure: use vertical lists

Horizontal lists has downside of being managed as a single entry in
version control, which makes commits that add and remove items difficult
to follow.  With vertical lists each entry is managed separately, which
is much nicer.

Additionally add project URL to autoconfig init, and pretty print macro
expressions to have indentation, and bracing that follows more or less in
K&R style.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure: prefer AS_IF macro rather than shell if statement

Jumping in between shell and m4 syntaxes makes reading the code more
difficult, so stick to m4 when ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
add src/cpu/rapl/.deps to .gitignore

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up Makefile.am files

Use vertical rather than horizontal lists, and get rid of deprecated
ACLOCAL_AMFLAGS instruction.  The src/Makefile.am source file list also
needed sorting, as the items order seemed more or less random.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fix clang++ compilation errors

The same error was fixed in multiple files to made clang++ work.

error: variable length array of non-POD element type 'string' (aka
'basic_string<char>')

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
remove unnecessary assignments

Found using scan-build, Clang static analyzer.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
remove unnecessary code reported by cppcheck

Return values in c_rapl_interface::rapl_measure_energy() are set, but
never read.  The create_all_alsa_callback() variable is not in use.  In
cursor_up() if clause had same expression in both true and false cases.
In add_runtime_tunables() filename variable was immediately overwrote.
The report_show_tunables variable srt_tmp is not in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
add short options to usage, and reorder options in code

Earlier user experience was pretty unintuitive.  For example -h is often
help, and it generated following error message.

powertop: option requires an argument -- 'h'

This change re-assigned short option -h from --html to --help, and made
-r to be assigned with --html.  All other short vs long option pairs
remain untouched.

The option data in struct option, print_usage(), getopt_long() optstring,
and getopt_long switch() case, are reorderd be in same order in all four
places.  All options are in long-option alphabetical order, with
exception of --version and --help that are the last in the lists.

Some options where meant to be used as long-only options.  These are made
unreachable by making the option character to be out side of range what
user can type.

Finally if an unknown option is found exit the value is changed from zero
to one to indicate an error.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
do not use ncurses with --auto-tune

The --auto-tune is not expected to be interactive, so all fiddling with
ncurses can and should be skipped.  This also makes the --auto-tune more
suitable to be used in script(s).

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
improve manual groff syntax

Use header macro .TH expected way.  Use English spacing, that means two
spaces after a dot.  Use simple font macros, such as .B or .BR, where
possible rather than \fB inline selectors.  Highlight option arguments
consistently, also in description segments.  Convert interactive commands
to a table.  Use mail and web address macros when appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fix couple typos

Found with misspell-check.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
wrap lines in README.traceevent

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
clean up .gitignore file

Keep the regular expressions, directories, and individual files separate
understandable way.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
add --auto-tune and --workload to manual page

Options in manual page are now in same order as in usage output, and they
include short options when aplicable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
allow none-ncurses messaging with ui_notify_user()

The ui_notify_user() is made to be a function pointer, and depending on
need it will either send messages using ncurses functions or simply print
to console.  At the moment the ui_notify_user_console() is not reachable,
but that might change in future.

Proposed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>