Suppress decimal constant compilation warning

From: Paul Menzel <paulepanter@users.sourceforge.net>

g++ reports the following warning:
	warning: this decimal constant is unsigned only in ISO C90
	[enabled by default]

Reported-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Seg Fault due to function format_watts in file src/lib.cpp

Use
size_t mbsrtowcs (wchar t *restrict dst, const char **restrict src,
        size t len, mbstate t *restrict ps)

which explicitly handles dst == NULL case:

	If dst is not a null pointer, the result is stored in the array pointed to by dst; otherwise,
	the conversion result is not available since it is stored in an internal buffer.

while

size_t mbstowcs (wchar t *wstring, const char *string, size t size)

does not (at least not in my glibc 2.17 docs), thus is free to cause undefined behavior.

Reported-by: Ganapati Bhat <life.mytake@gmail.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Use symbolic instead of numeric constants for keys

This improves the readability of the key handling code.

Since there is no symbolic constant for Escape, a comment with an
explanation is added.

Signed-off-by: Hans-Peter Deifel <hpdeifel@gmx.de>
Document key bindings in man page

Signed-off-by: Hans-Peter Deifel <hpdeifel@gmx.de>
Do not leak fd in perf_bundle read_file()

- Do not leak file descriptor in perf_bundle read_file().
- Clear perf event (unmap memory and close fd) on event destruction.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
README: add CONFIG_DEBUG_FS to Kernel Parameters

Add CONFIG_DEBUG_FS to the Kernel Parameters README section.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Fix running failure when > 69 CPUs for open file limitation

Powertop 2.3 fails to run on machine with > 69 CPUs because system open files
limitation of one process is 1024 default,  While powertop will open one file
for every monitored perf_event (at least 15) each CPU.

Like on 80 CPUs Westmere-EX machine, powertop will fail to run with below:

PowerTOP v2.3 needs the kernel to support the 'perf' subsystem
as well as support for trace points in the kernel:
CONFIG_PERF_EVENTS=y
CONFIG_PERF_COUNTERS=y
CONFIG_TRACEPOINTS=y
CONFIG_TRACING=y

This patch is to change RLIMIT_NOFILE from default (1024) to max limition.

Signed-off-by: Youquan Song <youquan.song@intel.com>
Introduce --auto-tune mode

Original idea by Mark Boorer <markboo99@gmail.com>

Introduce --auto-tune mode.
Auto tune toggles all existing tunables to GOOD state and finishes
powertop execution.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Embed self-contained javascript

using self-contained javascript offers several improvements:

 * powertop html report can be viewed offline
 * less overall javascript code is loaded when online
 * no opportunity for report leakage or modification by third parties

These changes also make it simpler to update the html report when a
new section is added: just add a new entry to powertop.blocks
dictionary, with the section's human-readable string as its value.
Merge branch 'master' of github.com:sergey-senozhatsky/powertop2-next