devfreq: add devfreq devices stats support

add window to show frequency stats for devfreq devices

Signed-off-by: Rajagopal Venkat <rajagopal.venkat@gmail.com>
Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
Revert "devfreq: add devfreq devices stats support"

This reverts commit 88d4674ec29bf74bc7a3aa6ab8ef8a57660ccfa3. Will be
replaced for version 4 of the same commit.
devfreq: add devfreq devices stats support

add window to show frequency stats for devfreq devices

Signed-off-by: Rajagopal Venkat <rajagopal.venkat@gmail.com>
Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
Properly cleaning up the display tabs

This patch properly cleans up the display tabs so that none of the tab
data is being leaked between refresh changes

Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>

v2: rebased atop 41c54e8; there's a bug here

Signed-off-by: Joe Konno <joe.konno@intel.com>
Remove another memory leak

Pointer gets over written without ever being properly cleaned up.  This
should solve that problem.

v2: rebased atop 41c54e8, do not delete window in clear_tunables() to
prevent double-free in close_display().

Signed-off-by: Joe Konno <joe.konno@intel.com>
Mark pretty_print_init as initialized

There is a check for it, but it's never actually set.  Now it's set.

v2: rebased atop 41c54e8

Signed-off-by: Joe Konno <joe.konno@intel.com>
Adding a clean_shutdown function

Function is designed to be a on stop place to clean up the entire
application at shutdown time.

v2: rebased atop 41c54e8

Signed-off-by: Joe Konno <joe.konno@intel.com>
Removing a documented memory leak

A non-elegant solution to it, but it works well enough to remove the
documented memory leak.  Proves to provide a much larger impact on
memory constrained systems.

v2: rebased atop 41c54e8

Signed-off-by: Joe Konno <joe.konno@intel.com>
Addede support for Intel platforms

Enable PowerTOP support for: HSX, HSW, AVN, BDX, and BDX-DE.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Deletion of unnecessary checks before specific function calls

The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
configure: require new enough automake version

Andreas had build issues with older than 1.11 automake, and it seemed
like 1.11.1 would good required version until Alexandra pointed out that
1.12.2 is needed to be safe from CVE-2012-3386 vulnerability.

Reported-by: Andreas Mohr <andi@lisas.de>
Reported-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Reference: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-3386
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure: use autoconf-archive ax_pthread.m4

The configuration script "AX_PTHREAD" was added to the build specification
so that corresponding special parameters will be taken into account.

Reference: http://www.gnu.org/software/autoconf-archive/ax_pthread.html
Reviewed-by: SF Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
add missing space to --version print out

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
csstoh.sh: check every single return value

Earlier the script continued processing at errors.

$ ./csstoh.sh powertop.css /dev/full
./csstoh.sh: line 36: echo: write error: No space left on device
./csstoh.sh: line 37: echo: write error: No space left on device
[...]

Now the script will fail immediately when an error occurs.

$ ./csstoh.sh powertop.css /dev/full ; echo $?
cat: write error: No space left on device
1

As a minor improvement the script now writes errors to stderr rather than
stdout, that is more appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure: use AC_USE_SYSTEM_EXTENSIONS to determine features

The AC_USE_SYSTEM_EXTENSIONS will enable everything that a system allows
to be enabled, so there is no longer need for a source file specific
*_SOURCE definitions.  Secondly the uses of _BSD_SOURCE that are removed
in this change are part of deprecated API.  See reference link for
details.

Reference: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=c941736c92fa3a319221f65f6755659b2a5e0a20
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
powertop.m4: GCC_FORTIFY_SOURCE_CC copy idea of macro from Archlinux pacman

The powertop.m4 is a collection file for autoconf m4 helper macros, such
as GCC_FORTIFY_SOURCE_CC.  The macro in case will define feature
_FORTIFY_SOURCE=2 when it is possible, instead of trying to enable when
it will not work, such as at times when optimization is turned off.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure: use autoconf-archive ax_cxx_compile_stdcxx_11.m4

Ensure the powertop is compiled C++11 compliant compiler.  That allows
project contributors to use features from the latest standard without
hesitation are they allowed in this project.  The idea is to grant
greater liberties to upstream in cost of a dependency to downstream.

Notice that adding a downstream dependency to C++11 compliant compiler is
not outrageously unreasonable.  Many of the C++11 features has been
supported quite a while.  That said use of some features, such as
attributes (N2761), may still make maintainers to be unhappy if the case
is not justified well enough.

Reference: http://en.cppreference.com/w/cpp/compiler_support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
main: fix incompatible operand type

main.cpp:430:35: error: incompatible operand types ('char *' and 'char')
                        sprintf(workload, "%s", optarg ? optarg : '\0');

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
move variables to protected scope

This fixes series of issues reported by clang++ compiler the same way.

cpu/rapl/rapl_interface.h:37:6: error: private field
'measurment_interval' is not used [-Werror,-Wunused-private-field]
        int measurment_interval;

The measurment_interval() in relation to first_cpu() is moved to avoid
following compiler warning.

make[3]: Entering directory '/home/src/powertop/src'
  CXX      cpu/rapl/powertop-rapl_interface.o
cpu/rapl/rapl_interface.cpp:78:2: warning: field 'measurment_interval' will be initialized after field 'first_cpu' [-Wreorder]
        measurment_interval(def_sampling_interval),

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
make --quiet option to suppress various info messages

When --quiet is defined messages such as'RAPL device for cpu 0' and
'Leaving PowerTOP' are not expected to be printed.  This change makes
them to be printed to stderr, that the --quiet is redirecting to
/dev/null.

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