aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajagopal Venkat <rajagopal.venkat@linaro.org>2012-09-14 16:57:41 +0530
committerLisa Nguyen <lisa.nguyen@linaro.org>2016-08-08 11:14:40 -0700
commitcd4617155617375cd54ed6b54473234c3bd2a2fa (patch)
tree9f56e87a3543fc2c836c5e4b3edad0330c662662
parent08421dfc6c8895020fbcae7ecd3550c6099c2c2d (diff)
Updates to support Android platform
This patch adds following minor changes to prepare powertop to support Android platform. - Add missing HAVE_CONFIG_H conditional check. - remove un-used ethtool_cmd_speed_set and ethtool_cmd_speed functions. - Minimize dependency on exception handling in catch blocks. These changes will not affect powertop functionality. Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
-rw-r--r--src/devices/ahci.cpp4
-rw-r--r--src/devices/alsa.cpp4
-rw-r--r--src/devices/network.cpp16
-rw-r--r--src/main.cpp2
4 files changed, 6 insertions, 20 deletions
diff --git a/src/devices/ahci.cpp b/src/devices/ahci.cpp
index e5b6750..e65cff9 100644
--- a/src/devices/ahci.cpp
+++ b/src/devices/ahci.cpp
@@ -192,7 +192,7 @@ void ahci::start_measurement(void)
#ifndef DISABLE_TRYCATCH
}
catch (std::ios_base::failure &c) {
- fprintf(stderr, "%s\n", c.what());
+ fprintf(stderr, "Failed to start measurement for ahci device\n");
}
#endif
}
@@ -235,7 +235,7 @@ void ahci::end_measurement(void)
#ifndef DISABLE_TRYCATCH
}
catch (std::ios_base::failure &c) {
- fprintf(stderr, "%s\n", c.what());
+ fprintf(stderr, "Failed to end measurement for ahci device\n");
}
#endif
if (end_active < start_active)
diff --git a/src/devices/alsa.cpp b/src/devices/alsa.cpp
index 3488e86..28a172f 100644
--- a/src/devices/alsa.cpp
+++ b/src/devices/alsa.cpp
@@ -105,7 +105,7 @@ void alsa::start_measurement(void)
#ifndef DISABLE_TRYCATCH
}
catch (std::ios_base::failure &c) {
- fprintf(stderr, "%s\n", c.what());
+ fprintf(stderr, "Failed to start measurement for alsa device\n");
}
#endif
}
@@ -135,7 +135,7 @@ void alsa::end_measurement(void)
#ifndef DISABLE_TRYCATCH
}
catch (std::ios_base::failure &c) {
- fprintf(stderr, "%s\n", c.what());
+ fprintf(stderr, "Failed to end measurement for alsa device\n");
}
#endif
p = (end_active - start_active) / (0.001 + end_active + end_inactive - start_active - start_inactive) * 100.0;
diff --git a/src/devices/network.cpp b/src/devices/network.cpp
index f8f4212..ffc0b28 100644
--- a/src/devices/network.cpp
+++ b/src/devices/network.cpp
@@ -55,22 +55,6 @@ extern "C" {
static map<string, class network *> nics;
-#ifdef DISABLE_TRYCATCH
-
-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;
-}
-
-#endif
static void do_proc_net_dev(void)
{
diff --git a/src/main.cpp b/src/main.cpp
index 9334b2b..e692218 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -45,7 +45,9 @@
#include "perf/perf.h"
#include "perf/perf_bundle.h"
#include "lib.h"
+#ifdef HAVE_CONFIG_H
#include "../config.h"
+#endif
#include "devices/device.h"