comment out try -catch Include unistd.h files in files which use it Add missing declaration of ethtool.h Include the nl80211.h which comes along with powertop Include sys/socket.h Add virtual destructors to classes to fix compliation errors
Signed-off-by: John Mathew <[email protected]> --- cpu/cpu.h | 2 ++ devices/ahci.cpp | 2 +- devices/alsa.cpp | 2 +- devices/device.cpp | 1 + devices/device.h | 2 ++ devices/i915-gpu.cpp | 2 +- devices/network.cpp | 14 +++++++++++++- devices/rfkill.cpp | 2 +- devices/thinkpad-fan.cpp | 2 +- devices/thinkpad-light.cpp | 2 +- html.cpp | 1 + main.cpp | 4 +++- measurement/measurement.cpp | 1 + measurement/measurement.h | 2 ++ parameters/parameters.cpp | 1 + perf/perf.h | 2 +- perf/perf_bundle.h | 1 + process/powerconsumer.h | 1 + process/process.h | 3 +++ process/timer.cpp | 2 +- tuning/ethernet.cpp | 1 + tuning/iw.h | 2 +- tuning/tunable.h | 1 + 23 files changed, 42 insertions(+), 11 deletions(-) diff --git a/cpu/cpu.h b/cpu/cpu.h index b111b5c..23d76d9 100644 --- a/cpu/cpu.h +++ b/cpu/cpu.h @@ -101,6 +101,8 @@ public: vector<struct idle_state *> cstates; vector<struct frequency *> pstates; + virtual ~abstract_cpu() {}; + class abstract_cpu *parent; diff --git a/devices/ahci.cpp b/devices/ahci.cpp index d505642..fb8ac70 100644 --- a/devices/ahci.cpp +++ b/devices/ahci.cpp @@ -293,4 +293,4 @@ double ahci::power_usage(struct result_bundle *result, struct parameter_bundle * power += util * factor / 100.0; return power; -} \ No newline at end of file +} diff --git a/devices/alsa.cpp b/devices/alsa.cpp index b0bcd3f..5100c36 100644 --- a/devices/alsa.cpp +++ b/devices/alsa.cpp @@ -39,7 +39,7 @@ using namespace std; #include "../devlist.h" #include <string.h> - +#include <unistd.h> alsa::alsa(char *_name, char *path): device() { diff --git a/devices/device.cpp b/devices/device.cpp index 2db3de0..6493864 100644 --- a/devices/device.cpp +++ b/devices/device.cpp @@ -49,6 +49,7 @@ using namespace std; #include "../html.h" #include "../measurement/measurement.h" #include "../devlist.h" +#include <unistd.h> device::device(void) { diff --git a/devices/device.h b/devices/device.h index 20b20ec..a46165b 100644 --- a/devices/device.h +++ b/devices/device.h @@ -45,6 +45,8 @@ public: device(void); + virtual ~device() {}; + void register_sysfs_path(const char *path); virtual double utilization(void); /* percentage */ diff --git a/devices/i915-gpu.cpp b/devices/i915-gpu.cpp index a9dc899..a0a9679 100644 --- a/devices/i915-gpu.cpp +++ b/devices/i915-gpu.cpp @@ -38,7 +38,7 @@ using namespace std; #include "../process/powerconsumer.h" #include <string.h> - +#include <unistd.h> i915gpu::i915gpu(): device() { diff --git a/devices/network.cpp b/devices/network.cpp index 5f3ddf2..a87c4c9 100644 --- a/devices/network.cpp +++ b/devices/network.cpp @@ -50,10 +50,22 @@ extern "C" { #include <net/if.h> #include <linux/sockios.h> #include <sys/ioctl.h> - +#include <unistd.h> static map<string, class network *> nics; +static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, + __u32 speed) +{ + + ep->speed = (__u16)speed; + ep->speed_hi = (__u16)(speed >> 16); +} + +static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) +{ + return (ep->speed_hi << 16) | ep->speed; +} static void do_proc_net_dev(void) { diff --git a/devices/rfkill.cpp b/devices/rfkill.cpp index 5bf40c4..6bfcf07 100644 --- a/devices/rfkill.cpp +++ b/devices/rfkill.cpp @@ -38,7 +38,7 @@ using namespace std; #include "../parameters/parameters.h" #include <string.h> - +#include <unistd.h> rfkill::rfkill(char *_name, char *path): device() { diff --git a/devices/thinkpad-fan.cpp b/devices/thinkpad-fan.cpp index 4ac3d11..939a826 100644 --- a/devices/thinkpad-fan.cpp +++ b/devices/thinkpad-fan.cpp @@ -39,7 +39,7 @@ #include "../process/powerconsumer.h" #include <string.h> - +#include <unistd.h> thinkpad_fan::thinkpad_fan(): device() { diff --git a/devices/thinkpad-light.cpp b/devices/thinkpad-light.cpp index ba4c553..0b9f67e 100644 --- a/devices/thinkpad-light.cpp +++ b/devices/thinkpad-light.cpp @@ -39,7 +39,7 @@ #include "../process/powerconsumer.h" #include <string.h> - +#include <unistd.h> thinkpad_light::thinkpad_light(): device() { diff --git a/html.cpp b/html.cpp index 0a4db2e..7b8b4b4 100644 --- a/html.cpp +++ b/html.cpp @@ -32,6 +32,7 @@ #include "css.h" #include "lib.h" +#include <unistd.h> using namespace std; diff --git a/main.cpp b/main.cpp index 801ae85..4241d44 100644 --- a/main.cpp +++ b/main.cpp @@ -33,6 +33,8 @@ #include <time.h> #include <sys/stat.h> #include <getopt.h> +#include <unistd.h> +#include <locale.h> #include "cpu/cpu.h" #include "process/process.h" @@ -269,7 +271,7 @@ int main(int argc, char **argv) int option_index; int c; - set_new_handler(out_of_memory); + //set_new_handler(out_of_memory); setlocale (LC_ALL, ""); #ifndef DISABLE_I18N diff --git a/measurement/measurement.cpp b/measurement/measurement.cpp index 0d679f7..9073a9b 100644 --- a/measurement/measurement.cpp +++ b/measurement/measurement.cpp @@ -33,6 +33,7 @@ #include <dirent.h> #include <stdio.h> #include <fstream> +#include <unistd.h> double min_power = 50000.0; diff --git a/measurement/measurement.h b/measurement/measurement.h index e225606..5bcd8e2 100644 --- a/measurement/measurement.h +++ b/measurement/measurement.h @@ -38,6 +38,8 @@ public: virtual double dev_capacity(void) { return 0.0;}; /* in Joules */ virtual double time_left(void); + + virtual ~power_meter() {}; }; diff --git a/parameters/parameters.cpp b/parameters/parameters.cpp index f2958f9..d599836 100644 --- a/parameters/parameters.cpp +++ b/parameters/parameters.cpp @@ -29,6 +29,7 @@ #include <stdlib.h> #include <math.h> #include <vector> +#include <unistd.h> struct parameter_bundle all_parameters; diff --git a/perf/perf.h b/perf/perf.h index 6af7af6..cf3395b 100644 --- a/perf/perf.h +++ b/perf/perf.h @@ -49,7 +49,7 @@ public: perf_event(void); perf_event(const char *event_name, int cpu = 0, int buffer_size = 128); - ~perf_event(void); + virtual ~perf_event(void); void set_event_name(const char *event_name); diff --git a/perf/perf_bundle.h b/perf/perf_bundle.h index 52c2cd7..9e46cb2 100644 --- a/perf/perf_bundle.h +++ b/perf/perf_bundle.h @@ -41,6 +41,7 @@ protected: std::map<int, char*> event_names; public: vector<void *> records; + virtual ~perf_bundle() {}; virtual void release(void); void add_event(const char *event_name); diff --git a/process/powerconsumer.h b/process/powerconsumer.h index b0dcee4..2916d52 100644 --- a/process/powerconsumer.h +++ b/process/powerconsumer.h @@ -51,6 +51,7 @@ public: class power_consumer *last_waker; power_consumer(void); + virtual ~power_consumer() {}; virtual double Witts(void); virtual const char * description(void) { return ""; }; diff --git a/process/process.h b/process/process.h index a230461..0d9e349 100644 --- a/process/process.h +++ b/process/process.h @@ -33,6 +33,9 @@ #define BIT64 1 #endif +#define TRUE 1 +#define FALSE 0 + /* Need to collect * CPU time consumed by each application diff --git a/process/timer.cpp b/process/timer.cpp index 8d81da1..44a5032 100644 --- a/process/timer.cpp +++ b/process/timer.cpp @@ -169,4 +169,4 @@ bool timer::is_deferred(void) } fclose(file); return false; -} +} \ No newline at end of file diff --git a/tuning/ethernet.cpp b/tuning/ethernet.cpp index 4666ac1..95a4105 100644 --- a/tuning/ethernet.cpp +++ b/tuning/ethernet.cpp @@ -34,6 +34,7 @@ #include <fstream> #include <unistd.h> #include <dirent.h> +#include <sys/socket.h> #include <errno.h> #include <sys/types.h> #include <dirent.h> diff --git a/tuning/iw.h b/tuning/iw.h index ea2b660..cdf5679 100644 --- a/tuning/iw.h +++ b/tuning/iw.h @@ -39,7 +39,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <netlink/genl/family.h> #include <netlink/genl/ctrl.h> -#include <linux/nl80211.h> +#include "nl80211.h" #define ETH_ALEN 6 diff --git a/tuning/tunable.h b/tuning/tunable.h index a4e994d..14a00eb 100644 --- a/tuning/tunable.h +++ b/tuning/tunable.h @@ -48,6 +48,7 @@ public: tunable(void); tunable(const char *str, double _score, const char *good = "", const char *bad = "", const char *neutral =""); + virtual ~tunable() {}; virtual int good_bad(void) { return TUNE_NEUTRAL; } -- 1.7.1 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ Power mailing list [email protected] https://bughost.org/mailman/listinfo/power
