All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-11  6:19 Maksim Melnikau
  0 siblings, 0 replies; 12+ messages in thread
From: Maksim Melnikau @ 2013-10-11  6:19 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]

Hello!

I have 2 batteries in my thinkpad helix laptop, and it looks like powertop
shows "the estimated remaining time" just for first battery, what is a bit
confusing. May be it somehow connected to some hardware features of
batteries switching.

# powertop, Overview page
The battery reports a discharge rate of 7.67 W
The estimated remaining time is 2 hours, 17 minutes

# powertop -V
PowerTOP versionv2.4, compiled on Jul 29 2013

# cat /sys/class/power_supply/BAT0/uevent
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=12503000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=42010000
POWER_SUPPLY_ENERGY_FULL=42010000
POWER_SUPPLY_ENERGY_NOW=41940000
POWER_SUPPLY_CAPACITY=99
POWER_SUPPLY_MODEL_NAME=45N1103
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_SERIAL_NUMBER= 3507

# cat /sys/class/power_supply/BAT1/uevent
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
POWER_SUPPLY_VOLTAGE_NOW=15178000
POWER_SUPPLY_POWER_NOW=8165000
POWER_SUPPLY_ENERGY_FULL_DESIGN=28050000
POWER_SUPPLY_ENERGY_FULL=26370000
POWER_SUPPLY_ENERGY_NOW=16750000
POWER_SUPPLY_CAPACITY=63
POWER_SUPPLY_MODEL_NAME=45N1101
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_SERIAL_NUMBER= 1840

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 1982 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-11  8:16 Maksim Melnikau
  0 siblings, 0 replies; 12+ messages in thread
From: Maksim Melnikau @ 2013-10-11  8:16 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2786 bytes --]

When first battery discharged, kernel reports following info

% cat /sys/class/power_supply/BAT0/uevent
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=12401000
POWER_SUPPLY_POWER_NOW=7800000
POWER_SUPPLY_ENERGY_FULL_DESIGN=42010000
POWER_SUPPLY_ENERGY_FULL=42010000
POWER_SUPPLY_ENERGY_NOW=41810000
POWER_SUPPLY_CAPACITY=99
POWER_SUPPLY_MODEL_NAME=45N1103
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_SERIAL_NUMBER= 3507

% cat /sys/class/power_supply/BAT1/uevent
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
POWER_SUPPLY_VOLTAGE_NOW=13902000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=28050000
POWER_SUPPLY_ENERGY_FULL=26370000
POWER_SUPPLY_ENERGY_NOW=930000
POWER_SUPPLY_CAPACITY=3
POWER_SUPPLY_MODEL_NAME=45N1101
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_SERIAL_NUMBER= 1840

On Fri, Oct 11, 2013 at 9:19 AM, Maksim Melnikau <maxposedon(a)gmail.com> wrote:
> Hello!
>
> I have 2 batteries in my thinkpad helix laptop, and it looks like powertop
> shows "the estimated remaining time" just for first battery, what is a bit
> confusing. May be it somehow connected to some hardware features of
> batteries switching.
>
> # powertop, Overview page
> The battery reports a discharge rate of 7.67 W
> The estimated remaining time is 2 hours, 17 minutes
>
> # powertop -V
> PowerTOP versionv2.4, compiled on Jul 29 2013
>
> # cat /sys/class/power_supply/BAT0/uevent
> POWER_SUPPLY_NAME=BAT0
> POWER_SUPPLY_STATUS=Unknown
> POWER_SUPPLY_PRESENT=1
> POWER_SUPPLY_TECHNOLOGY=Li-poly
> POWER_SUPPLY_CYCLE_COUNT=0
> POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
> POWER_SUPPLY_VOLTAGE_NOW=12503000
> POWER_SUPPLY_POWER_NOW=0
> POWER_SUPPLY_ENERGY_FULL_DESIGN=42010000
> POWER_SUPPLY_ENERGY_FULL=42010000
> POWER_SUPPLY_ENERGY_NOW=41940000
> POWER_SUPPLY_CAPACITY=99
> POWER_SUPPLY_MODEL_NAME=45N1103
> POWER_SUPPLY_MANUFACTURER=SMP
> POWER_SUPPLY_SERIAL_NUMBER= 3507
>
> # cat /sys/class/power_supply/BAT1/uevent
> POWER_SUPPLY_NAME=BAT1
> POWER_SUPPLY_STATUS=Discharging
> POWER_SUPPLY_PRESENT=1
> POWER_SUPPLY_TECHNOLOGY=Li-poly
> POWER_SUPPLY_CYCLE_COUNT=0
> POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
> POWER_SUPPLY_VOLTAGE_NOW=15178000
> POWER_SUPPLY_POWER_NOW=8165000
> POWER_SUPPLY_ENERGY_FULL_DESIGN=28050000
> POWER_SUPPLY_ENERGY_FULL=26370000
> POWER_SUPPLY_ENERGY_NOW=16750000
> POWER_SUPPLY_CAPACITY=63
> POWER_SUPPLY_MODEL_NAME=45N1101
> POWER_SUPPLY_MANUFACTURER=SMP
> POWER_SUPPLY_SERIAL_NUMBER= 1840
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-11  8:22 Maksim Melnikau
  0 siblings, 0 replies; 12+ messages in thread
From: Maksim Melnikau @ 2013-10-11  8:22 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

# powertop, Overview page, when first battery discharged
The battery reports a discharge rate of 7.54 W
The estimated remaining time is 5 hours, 28 minutes

So, from the beginning I'm expecting to see not 2.5h estimate, and
later 5.5h. But smth like 8h from the beginning.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-11  8:30 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-11  8:30 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3412 bytes --]

On (10/11/13 11:16), Maksim Melnikau wrote:
> Date: Fri, 11 Oct 2013 11:16:34 +0300
> From: Maksim Melnikau <maxposedon(a)gmail.com>
> To: powertop(a)lists.01.org
> Subject: Re: [Powertop] [BUG] powertop shows estimates only for 1st battery
>  from 2
> 
> When first battery discharged, kernel reports following info

thank you. I'll take a look.

	-ss

> % cat /sys/class/power_supply/BAT0/uevent
> POWER_SUPPLY_NAME=BAT0
> POWER_SUPPLY_STATUS=Discharging
> POWER_SUPPLY_PRESENT=1
> POWER_SUPPLY_TECHNOLOGY=Li-poly
> POWER_SUPPLY_CYCLE_COUNT=0
> POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
> POWER_SUPPLY_VOLTAGE_NOW=12401000
> POWER_SUPPLY_POWER_NOW=7800000
> POWER_SUPPLY_ENERGY_FULL_DESIGN=42010000
> POWER_SUPPLY_ENERGY_FULL=42010000
> POWER_SUPPLY_ENERGY_NOW=41810000
> POWER_SUPPLY_CAPACITY=99
> POWER_SUPPLY_MODEL_NAME=45N1103
> POWER_SUPPLY_MANUFACTURER=SMP
> POWER_SUPPLY_SERIAL_NUMBER= 3507
> 
> % cat /sys/class/power_supply/BAT1/uevent
> POWER_SUPPLY_NAME=BAT1
> POWER_SUPPLY_STATUS=Unknown
> POWER_SUPPLY_PRESENT=1
> POWER_SUPPLY_TECHNOLOGY=Li-poly
> POWER_SUPPLY_CYCLE_COUNT=0
> POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
> POWER_SUPPLY_VOLTAGE_NOW=13902000
> POWER_SUPPLY_POWER_NOW=0
> POWER_SUPPLY_ENERGY_FULL_DESIGN=28050000
> POWER_SUPPLY_ENERGY_FULL=26370000
> POWER_SUPPLY_ENERGY_NOW=930000
> POWER_SUPPLY_CAPACITY=3
> POWER_SUPPLY_MODEL_NAME=45N1101
> POWER_SUPPLY_MANUFACTURER=SMP
> POWER_SUPPLY_SERIAL_NUMBER= 1840
> 
> On Fri, Oct 11, 2013 at 9:19 AM, Maksim Melnikau <maxposedon(a)gmail.com> wrote:
> > Hello!
> >
> > I have 2 batteries in my thinkpad helix laptop, and it looks like powertop
> > shows "the estimated remaining time" just for first battery, what is a bit
> > confusing. May be it somehow connected to some hardware features of
> > batteries switching.
> >
> > # powertop, Overview page
> > The battery reports a discharge rate of 7.67 W
> > The estimated remaining time is 2 hours, 17 minutes
> >
> > # powertop -V
> > PowerTOP versionv2.4, compiled on Jul 29 2013
> >
> > # cat /sys/class/power_supply/BAT0/uevent
> > POWER_SUPPLY_NAME=BAT0
> > POWER_SUPPLY_STATUS=Unknown
> > POWER_SUPPLY_PRESENT=1
> > POWER_SUPPLY_TECHNOLOGY=Li-poly
> > POWER_SUPPLY_CYCLE_COUNT=0
> > POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
> > POWER_SUPPLY_VOLTAGE_NOW=12503000
> > POWER_SUPPLY_POWER_NOW=0
> > POWER_SUPPLY_ENERGY_FULL_DESIGN=42010000
> > POWER_SUPPLY_ENERGY_FULL=42010000
> > POWER_SUPPLY_ENERGY_NOW=41940000
> > POWER_SUPPLY_CAPACITY=99
> > POWER_SUPPLY_MODEL_NAME=45N1103
> > POWER_SUPPLY_MANUFACTURER=SMP
> > POWER_SUPPLY_SERIAL_NUMBER= 3507
> >
> > # cat /sys/class/power_supply/BAT1/uevent
> > POWER_SUPPLY_NAME=BAT1
> > POWER_SUPPLY_STATUS=Discharging
> > POWER_SUPPLY_PRESENT=1
> > POWER_SUPPLY_TECHNOLOGY=Li-poly
> > POWER_SUPPLY_CYCLE_COUNT=0
> > POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
> > POWER_SUPPLY_VOLTAGE_NOW=15178000
> > POWER_SUPPLY_POWER_NOW=8165000
> > POWER_SUPPLY_ENERGY_FULL_DESIGN=28050000
> > POWER_SUPPLY_ENERGY_FULL=26370000
> > POWER_SUPPLY_ENERGY_NOW=16750000
> > POWER_SUPPLY_CAPACITY=63
> > POWER_SUPPLY_MODEL_NAME=45N1101
> > POWER_SUPPLY_MANUFACTURER=SMP
> > POWER_SUPPLY_SERIAL_NUMBER= 1840
> >
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-11  8:43 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-11  8:43 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3951 bytes --]

On (10/11/13 11:22), Maksim Melnikau wrote:
> # powertop, Overview page, when first battery discharged
> The battery reports a discharge rate of 7.54 W
> The estimated remaining time is 5 hours, 28 minutes
> 
> So, from the beginning I'm expecting to see not 2.5h estimate, and
> later 5.5h. But smth like 8h from the beginning.

could you please try the following patch.

/* just for testing. w/o commit message and credits at the momemnt. */

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

---

 src/measurement/measurement.cpp | 23 ++++++-----------------
 src/measurement/measurement.h   | 24 +++++++++++++++++-------
 src/measurement/sysfs.cpp       |  7 ++++---
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/measurement/measurement.cpp b/src/measurement/measurement.cpp
index 0b68940..8aea3a8 100644
--- a/src/measurement/measurement.cpp
+++ b/src/measurement/measurement.cpp
@@ -54,23 +54,6 @@ double power_meter::joules_consumed(void)
 	return 0.0;
 }
 
-double power_meter::time_left(void)
-{
-	double cap, rate;
-
-	cap = dev_capacity();
-	rate = joules_consumed();
-
-	if (cap < 0.001)
-		return 0.0;
-
-	/* return 0.0 instead of INF+ */
-	if (rate < 0.001)
-		return 0.0;
-
-	return cap / rate;
-}
-
 vector<class power_meter *> power_meters;
 
 void start_power_measurement(void)
@@ -101,13 +84,19 @@ double global_joules_consumed(void)
 
 double global_time_left(void)
 {
+	bool global_discharging = false;
 	double total_capacity = 0.0;
 	double total_rate = 0.0;
 	unsigned int i;
 	for (i = 0; i < power_meters.size(); i++) {
+		global_discharging |= power_meters[i]->is_discharging();
 		total_capacity += power_meters[i]->dev_capacity();
 		total_rate += power_meters[i]->joules_consumed();
 	}
+	/* report global time left if at least one battery is discharging */
+	if (!global_discharging)
+		return 0.0;
+
 	/* return 0.0 instead of INF+ */
 	if (total_rate < 0.001)
 		return 0.0;
diff --git a/src/measurement/measurement.h b/src/measurement/measurement.h
index 5bcd8e2..83ffc34 100644
--- a/src/measurement/measurement.h
+++ b/src/measurement/measurement.h
@@ -30,18 +30,29 @@
 using namespace std;
 
 class power_meter {
+	bool discharging;
 public:
+	virtual ~power_meter() {};
+
 	virtual void start_measurement(void);
 	virtual void end_measurement(void);
-
 	virtual double joules_consumed(void);
-	virtual double dev_capacity(void) { return 0.0;};  /* in Joules */
 
-	virtual double time_left(void);
+	virtual double dev_capacity(void)
+	{
+		return 0.0; /* in Joules */
+	}
 
-	virtual ~power_meter() {};
-};
+	virtual void set_discharging(bool d)
+	{
+		discharging = d;
+	}
 
+	virtual bool is_discharging()
+	{
+		return discharging;
+	}
+};
 
 extern vector<class power_meter *> power_meters;
 
@@ -53,7 +64,6 @@ extern double global_time_left(void);
 extern void detect_power_meters(void);
 extern void extech_power_meter(const char *devnode);
 
-
 extern double min_power;
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/measurement/sysfs.cpp b/src/measurement/sysfs.cpp
index 66cb1cd..ed42ed4 100644
--- a/src/measurement/sysfs.cpp
+++ b/src/measurement/sysfs.cpp
@@ -126,11 +126,13 @@ void sysfs_power_meter::measure()
 
 	rate = 0.0;
 	capacity = 0.0;
+	this->set_discharging(false);
 
 	if (!is_present())
 		return;
-	if (read_sysfs_string("/sys/class/power_supply/%s/status", name) != "Discharging")
-		return;
+	/** do not jump over. we may have discharging battery */
+	if (read_sysfs_string("/sys/class/power_supply/%s/status", name) == "Discharging")
+		this->set_discharging(true);
 
 	got_rate = set_rate_from_power();
 	got_capacity = set_capacity_from_energy();
@@ -146,7 +148,6 @@ void sysfs_power_meter::measure()
 	}
 }
 
-
 void sysfs_power_meter::end_measurement(void)
 {
 	measure();


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-11  9:17 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-11  9:17 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 4484 bytes --]

On (10/11/13 11:22), Maksim Melnikau wrote:
> # powertop, Overview page, when first battery discharged
> The battery reports a discharge rate of 7.54 W
> The estimated remaining time is 5 hours, 28 minutes
> 
> So, from the beginning I'm expecting to see not 2.5h estimate, and
> later 5.5h. But smth like 8h from the beginning.

v2. fix joules consumed reporting (didn't notice this in v1).

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

---

 src/measurement/measurement.cpp | 32 ++++++++++++++------------------
 src/measurement/measurement.h   | 24 +++++++++++++++++-------
 src/measurement/sysfs.cpp       |  7 ++++---
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/src/measurement/measurement.cpp b/src/measurement/measurement.cpp
index 0b68940..8b63eb3 100644
--- a/src/measurement/measurement.cpp
+++ b/src/measurement/measurement.cpp
@@ -54,23 +54,6 @@ double power_meter::joules_consumed(void)
 	return 0.0;
 }
 
-double power_meter::time_left(void)
-{
-	double cap, rate;
-
-	cap = dev_capacity();
-	rate = joules_consumed();
-
-	if (cap < 0.001)
-		return 0.0;
-
-	/* return 0.0 instead of INF+ */
-	if (rate < 0.001)
-		return 0.0;
-
-	return cap / rate;
-}
-
 vector<class power_meter *> power_meters;
 
 void start_power_measurement(void)
@@ -88,10 +71,17 @@ void end_power_measurement(void)
 
 double global_joules_consumed(void)
 {
+	bool global_discharging = false;
 	double total = 0.0;
 	unsigned int i;
-	for (i = 0; i < power_meters.size(); i++)
+
+	for (i = 0; i < power_meters.size(); i++) {
+		global_discharging |= power_meters[i]->is_discharging();
 		total += power_meters[i]->joules_consumed();
+	}
+	/* report global time left if at least one battery is discharging */
+	if (!global_discharging)
+		return 0.0;
 
 	all_results.power = total;
 	if (total < min_power && total > 0.01)
@@ -101,13 +91,19 @@ double global_joules_consumed(void)
 
 double global_time_left(void)
 {
+	bool global_discharging = false;
 	double total_capacity = 0.0;
 	double total_rate = 0.0;
 	unsigned int i;
 	for (i = 0; i < power_meters.size(); i++) {
+		global_discharging |= power_meters[i]->is_discharging();
 		total_capacity += power_meters[i]->dev_capacity();
 		total_rate += power_meters[i]->joules_consumed();
 	}
+	/* report global time left if at least one battery is discharging */
+	if (!global_discharging)
+		return 0.0;
+
 	/* return 0.0 instead of INF+ */
 	if (total_rate < 0.001)
 		return 0.0;
diff --git a/src/measurement/measurement.h b/src/measurement/measurement.h
index 5bcd8e2..83ffc34 100644
--- a/src/measurement/measurement.h
+++ b/src/measurement/measurement.h
@@ -30,18 +30,29 @@
 using namespace std;
 
 class power_meter {
+	bool discharging;
 public:
+	virtual ~power_meter() {};
+
 	virtual void start_measurement(void);
 	virtual void end_measurement(void);
-
 	virtual double joules_consumed(void);
-	virtual double dev_capacity(void) { return 0.0;};  /* in Joules */
 
-	virtual double time_left(void);
+	virtual double dev_capacity(void)
+	{
+		return 0.0; /* in Joules */
+	}
 
-	virtual ~power_meter() {};
-};
+	virtual void set_discharging(bool d)
+	{
+		discharging = d;
+	}
 
+	virtual bool is_discharging()
+	{
+		return discharging;
+	}
+};
 
 extern vector<class power_meter *> power_meters;
 
@@ -53,7 +64,6 @@ extern double global_time_left(void);
 extern void detect_power_meters(void);
 extern void extech_power_meter(const char *devnode);
 
-
 extern double min_power;
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/measurement/sysfs.cpp b/src/measurement/sysfs.cpp
index 66cb1cd..ed42ed4 100644
--- a/src/measurement/sysfs.cpp
+++ b/src/measurement/sysfs.cpp
@@ -126,11 +126,13 @@ void sysfs_power_meter::measure()
 
 	rate = 0.0;
 	capacity = 0.0;
+	this->set_discharging(false);
 
 	if (!is_present())
 		return;
-	if (read_sysfs_string("/sys/class/power_supply/%s/status", name) != "Discharging")
-		return;
+	/** do not jump over. we may have discharging battery */
+	if (read_sysfs_string("/sys/class/power_supply/%s/status", name) == "Discharging")
+		this->set_discharging(true);
 
 	got_rate = set_rate_from_power();
 	got_capacity = set_capacity_from_energy();
@@ -146,7 +148,6 @@ void sysfs_power_meter::measure()
 	}
 }
 
-
 void sysfs_power_meter::end_measurement(void)
 {
 	measure();


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-12 12:14 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-12 12:14 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3068 bytes --]

On (10/11/13 11:22), Maksim Melnikau wrote:
> # powertop, Overview page, when first battery discharged
> The battery reports a discharge rate of 7.54 W
> The estimated remaining time is 5 hours, 28 minutes
> 
> So, from the beginning I'm expecting to see not 2.5h estimate, and
> later 5.5h. But smth like 8h from the beginning.

and here is one for baseline power
--------8<---------8<---------

devices: report correct system baseline power

Reported-by: Maksim Melnikau <maxposedon(a)gmail.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

---

 src/devices/device.cpp        |  4 ++--
 src/main.cpp                  |  2 --
 src/parameters/parameters.cpp |  2 --
 src/process/do_process.cpp    | 14 --------------
 4 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/devices/device.cpp b/src/devices/device.cpp
index 00ec5e6..89add8d 100644
--- a/src/devices/device.cpp
+++ b/src/devices/device.cpp
@@ -175,7 +175,7 @@ void report_devices(void)
 	if (show_power) {
 		char buf[32];
 		wprintw(win, _("System baseline power is estimated at %sW\n"),
-				fmt_prefix(get_parameter_value("base power"), buf));
+				fmt_prefix(compute_bundle(), buf));
 	}
 
 	if (pw > 0.0001 || show_power)
@@ -240,7 +240,7 @@ void show_report_devices(void)
 
 		report.begin_paragraph();
 		report.addf("System baseline power is estimated at %sW",
-			    fmt_prefix(get_parameter_value("base power"), buf));
+			    fmt_prefix(compute_bundle(), buf));
 	}
 
 	report.begin_table(TABLE_WIDE);
diff --git a/src/main.cpp b/src/main.cpp
index 4e34ee6..043eb7d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -225,8 +225,6 @@ void one_measurement(int seconds, char *workload)
 	end_process_data();
 
 	global_joules_consumed();
-	compute_bundle();
-
 	show_report_devices();
 	report_show_open_devices();
 
diff --git a/src/parameters/parameters.cpp b/src/parameters/parameters.cpp
index 936d789..1b8cb38 100644
--- a/src/parameters/parameters.cpp
+++ b/src/parameters/parameters.cpp
@@ -176,8 +176,6 @@ void report_utilization(int index, double value, struct result_bundle *bundle)
 	set_result_value(index, value, bundle);
 }
 
-
-
 double compute_bundle(struct parameter_bundle *parameters, struct result_bundle *results)
 {
 	double power = 0;
diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
index d81a2a9..d81d27c 100644
--- a/src/process/do_process.cpp
+++ b/src/process/do_process.cpp
@@ -802,22 +802,8 @@ void process_update_display(void)
 		return;
 
 	wclear(win);
-
 	wmove(win, 1,0);
 
-#if 0
-	double sum;
-	calculate_params();
-	sum = 0.0;
-	sum += get_parameter_value("base power");
-	for (i = 0; i < all_power.size(); i++) {
-		sum += all_power[i]->Witts();
-	}
-
-	wprintw(win, _("Estimated power: %5.1f    Measured power: %5.1f    Sum: %5.1f\n\n"),
-				all_parameters.guessed_power, global_joules_consumed(), sum);
-#endif
-
 	pw = global_joules_consumed();
 	tl = global_time_left() / 60;
 	tlt = (tl /60);


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-12 14:14 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-12 14:14 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]

On (10/11/13 11:22), Maksim Melnikau wrote:
> # powertop, Overview page, when first battery discharged
> The battery reports a discharge rate of 7.54 W
> The estimated remaining time is 5 hours, 28 minutes
> 
> So, from the beginning I'm expecting to see not 2.5h estimate, and
> later 5.5h. But smth like 8h from the beginning.

v2: after some thinking, better to fix parameters.


parameters: report correct "base power" parameter

Reported-by: Maksim Melnikau <maxposedon(a)gmail.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>

---

 src/parameters/parameters.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/parameters/parameters.cpp b/src/parameters/parameters.cpp
index 936d789..8ffda16 100644
--- a/src/parameters/parameters.cpp
+++ b/src/parameters/parameters.cpp
@@ -188,18 +188,14 @@ double compute_bundle(struct parameter_bundle *parameters, struct result_bundle
 	if (!bpi)
 		bpi = get_param_index("base power");
 
-	power = parameters->parameters[bpi];
-
-	for (i = 0; i < all_devices.size(); i++) {
-
+	for (i = 0; i < all_devices.size(); i++)
 		power += all_devices[i]->power_usage(results, parameters);
-	}
-//	printf("result power is %6.2f  guessed is %6.2f\n", results->power, power);
+
 	parameters->actual_power = results->power;
 	parameters->guessed_power = power;
 	/* scale the squared error by the actual power so that non-idle data points weigh heavier */
 	parameters->score += results->power * (power - results->power) * (power - results->power);
-
+	parameters->parameters[bpi] = power;
 	return power;
 }
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-12 16:08 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-12 16:08 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

On (10/12/13 18:06), Maksim Melnikau wrote:
> On Sat, Oct 12, 2013 at 5:14 PM, Sergey Senozhatsky
> <sergey.senozhatsky(a)gmail.com> wrote:
> > v2: after some thinking, better to fix parameters.
> I'm don't think that values below is correct now

Cc the list


thanks.
that is probably a separate issue. will take a look in a day or two.

	-ss

> # powertop, Device stats page
> The battery reports a discharge rate of 12.9 W
> System baseline power is estimated at 16.5 W
> Power est.    Usage     Device name
>   12.2 W     86.2%        Display backlight
>   3.17 W     44.0%        Display backlight
>   639 mW      9.4%        CPU core
>   475 mW      9.4%        CPU misc
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-12 16:09 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-12 16:09 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

On (10/12/13 17:57), Maksim Melnikau wrote:
> > v2. fix joules consumed reporting (didn't notice this in v1).
> Battery estimate now looks correct for me.
> 

Cc the list

thanks.

	-ss

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-12 17:53 Sergey Senozhatsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2013-10-12 17:53 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

On (10/12/13 18:06), Maksim Melnikau wrote:
> > v2: after some thinking, better to fix parameters.
> I'm don't think that values below is correct now
> 
> # powertop, Device stats page
> The battery reports a discharge rate of 12.9 W
> System baseline power is estimated at 16.5 W

could you please post:

ls /sys/class/backlight/

cat /sys/class/backlight/*/device/enabled
cat /sys/class/backlight/*/type

	-ss

> Power est.    Usage     Device name
>   12.2 W     86.2%        Display backlight
>   3.17 W     44.0%        Display backlight
>   639 mW      9.4%        CPU core
>   475 mW      9.4%        CPU misc
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Powertop] [BUG] powertop shows estimates only for 1st battery from 2
@ 2013-10-13  8:10 Maksim Melnikau
  0 siblings, 0 replies; 12+ messages in thread
From: Maksim Melnikau @ 2013-10-13  8:10 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

On Sat, Oct 12, 2013 at 8:53 PM, Sergey Senozhatsky
<sergey.senozhatsky(a)gmail.com> wrote:
> could you please post:
# ls /sys/class/backlight
acpi_video0  intel_backlight
# cat /sys/class/backlight/acpi_video0/device/enable
1
# cat /sys/class/backlight/acpi_video0/type
firmware
# cat /sys/class/backlight/intel_backlight/device/enabled
enabled
# cat /sys/class/backlight/intel_backlight/type
raw

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-10-13  8:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-12 14:14 [Powertop] [BUG] powertop shows estimates only for 1st battery from 2 Sergey Senozhatsky
  -- strict thread matches above, loose matches on Subject: below --
2013-10-13  8:10 Maksim Melnikau
2013-10-12 17:53 Sergey Senozhatsky
2013-10-12 16:09 Sergey Senozhatsky
2013-10-12 16:08 Sergey Senozhatsky
2013-10-12 12:14 Sergey Senozhatsky
2013-10-11  9:17 Sergey Senozhatsky
2013-10-11  8:43 Sergey Senozhatsky
2013-10-11  8:30 Sergey Senozhatsky
2013-10-11  8:22 Maksim Melnikau
2013-10-11  8:16 Maksim Melnikau
2013-10-11  6:19 Maksim Melnikau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.