WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: battery depleted too fast with just firefox + flwm  (Read 4293 times)

Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #15 on: May 24, 2020, 02:31:11 PM »
By the way, results of the governor job can be checked in
Code: [Select]
cat /sys/devices/system/cpufreq/policyX/stats/time_in_state
Thanks. I think you use another tinycore kernel version, because for me the path is
Code: [Select]
tc@box:~$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
1800000 11498
1600000 4323
1400000 10918
1200000 63785
1000000 1078128
tc@box:~$
anyway is near 94% in lower frequency.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #16 on: May 24, 2020, 03:04:24 PM »
wow, just started powertop again, after fixed guvernator to powersave:
Code: [Select]
The battery reports a discharge rate of 8.95 W
The power consumed was 171 J
The estimated remaining time is 2 hours, 19 minutes

Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #17 on: May 24, 2020, 05:39:51 PM »
Test finished. With wire(cable) network, using the lower CPU frequency (1GHz) forced by governor = powersave, with only firefox running (with 1-3 tabs) and reading just text (httml docs), and all tricks suggested by powertop (to sleep not used devices): battery depleted in 2h 24' (144 minutes from 100% until 4%).
it is similar with win10 (156 minutes from 100% until 7%). it seams that on laptop win10 is better by default to manage the power consumption.

PS: I do not try to think about how fast laptop will shut-down if is on wireless, with sound watching a movie.
« Last Edit: May 24, 2020, 05:46:32 PM by nick65go »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: battery depleted too fast with just firefox + flwm
« Reply #18 on: May 24, 2020, 11:44:45 PM »
By the way, results of the governor job can be checked in
Code: [Select]
cat /sys/devices/system/cpufreq/policyX/stats/time_in_state
Thanks. I think you use another tinycore kernel version, because for me the path is
Code: [Select]
tc@box:~$ cat /sys/devices/system/cpu/cpufreq/policy0/stats/time_in_state
1800000 11498
1600000 4323
1400000 10918
1200000 63785
1000000 1078128
tc@box:~$
anyway is near 94% in lower frequency.

Hi, nick65go!

Sorry, it was a typo. My bad, I was browsing /sys with mc and didn't checked the command, just typed it here. You caught the idea, nevertheless it is wrong to propose untested commands, this can cause unexpected consequencies. Sorry.

And yeah! testdrive was exciting! My congratulations! You've prolonged the battery life more than twice!
Thanks a lot for spending Your time and battery (no one lives forever, and batteries too ), I hope this was interesting and usefull for many readers, and will make our overheated world a little bit cooler.

Cheers :)

Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #19 on: May 25, 2020, 11:43:12 AM »
@jazzbiker: Thank you for your kind words! :)
Now that I know what commands to issue, I try to write a script for my laptop, to be executed from /home/tc/.X.d/If someone else what to publish a more generic script, I will gladly test it.Basically it is about to run the script with a parameter ("auto" for battery, or "on" for power cable), something like
Code: [Select]
echo $1 >  /sys/bus/pci/device/*/power/controlwhere * could eventual be restricted to some mask like 0000:??:??.? or 0000:##:##.#

and add (maybe redundant, but worth to have it):
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'echo 'auto' > '/sys/block/sd?/device/power/control'
echo 'med_power_with_dipm' > '/sys/class/scsi_host/host?/link_power_management_policy'
echo 'auto' > '/sys/bus/i2c/devices/i2c-?/device/power/control'
echo 'auto' > '/sys/bus/usb/devices/?/power/control'
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'

Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #20 on: May 25, 2020, 11:54:58 AM »
Here below is why my UEFI (badly written by HP,as usually!) is misleading linux, on my laptop.This info was from reading with
Code: [Select]
tc@box:~$ dmesgACPI BIOS Warning (bug): Optional FADT field Pm2ControlBlock has valid Length but zero Address: 0x0000000000000000/0x1 (20190816/tbfadt-615)
...
BIOS may not properly restore RDRAND after suspend, hiding RDRAND via CPUID. Use rdrand=force to reenable.
...
ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
...
acpi PNP0A03:00: _OSC: platform does not support [PME LTR] <- wrong, it does!
pci 0000:00:12.0: PME# does not work under D3, disabling it
pci 0000:00:13.0: PME# does not work under D3, disabling it
   00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 39)
   00:13.0 USB c ontroller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 39)

Trying to unpack rootfs image as initramfs..
AMD-Vi: AMD IOMMUv2 functionality not available on this system <--??

ata1.00: LPM support broken, forcing max_power
   ata1.00: ATA-9: ST1000LM024 HN-M101MBB, 2BA30001, max UDMA/133  <--Realy? should be SATA2!!
      scsi 0:0:0:0: Direct-Access     ATA      ST1000LM024 HN-M 0001 PQ: 0 ANSI: 5
      sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
      sd 0:0:0:0: [sda] 4096-byte physical blocks
   ata2.00: ATAPI: hp DVDRW  SU208GB, HH00, max UDMA/100
     scsi 1:0:0:0: CD-ROM  hp DVDRW  SU208GB   HH00 PQ: 0 ANSI: 5
     sr 1:0:0:0: [sr0] scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray

hp_wmi: query 0xd returned error 0x5


Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #21 on: May 25, 2020, 05:06:04 PM »
and here is the generic script, according to powertop:
Code: [Select]
tc@box:~$ for i in `ls /sys/bus/pci/devices`; do cat /sys/bus/pci/devices/$i/power/control; done;
tc@box:~$ for i in `ls /sys/bus/pci/devices`; do echo "auto" | sudo tee /sys/bus/pci/devices/$i/power/control; done;

tc@box:~$ for i in `ls /sys/bus/i2c/devices`; do cat /sys/bus/i2c/devices/$i/device/power/control; done;
tc@box:~$ for i in `ls /sys/bus/i2c/devices`; do echo "auto" | sudo tee /sys/bus/i2c/devices/$i/device/power/control; done;

tc@box:~$ for i in `ls /sys/bus/usb/devices | grep usb`; do cat /sys/bus/usb/devices/$i/power/control; done;
tc@box:~$ for i in `ls /sys/bus/usb/devices | grep usb`; do echo "auto" | sudo tee /sys/bus/usb/devices/$i/power/control; done;
« Last Edit: May 25, 2020, 05:08:11 PM by nick65go »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 799
Re: battery depleted too fast with just firefox + flwm
« Reply #22 on: May 25, 2020, 06:30:26 PM »
I think now I have an optimized script. Maybe is useful for someone. you are welcome to improve it.
Code: [Select]
#!/bin/sh
# lower energy consumption

echo "auto" | sudo tee /sys/block/sda/device/power/control
echo 1500 | sudo tee /proc/sys/vm/dirty_writeback_centisecs

for g in `ls /sys/module/snd*/parameters/power_save`; do echo 1 | sudo tee $g; done;
for h in `ls /sys/bus/pci/devices/*/ata*/power/control`; do echo "auto" | sudo tee $h; done;
for i in `ls /sys/bus/pci/devices/*/power/control`; do echo "auto" | sudo tee $i; done;
for j in `ls /sys/bus/i2c/devices/*/device/power/control`; do echo "auto" | sudo tee $j; done;
for k in `ls /sys/bus/usb/devices/*//power/control`; do echo "auto" | sudo tee $k; done;
for m in `ls /sys/class/scsi_host/*/link_power_management_policy`; do echo "med_power_with_dipm" | sudo tee $m; done;
« Last Edit: May 25, 2020, 06:40:31 PM by nick65go »