Public bug reported:

Binary package hint: devicekit-power

While running on battery power, I noticed bursts of disk activity
lasting a few seconds and occurring at perhaps twenty-second intervals,
which of course is bad because it prevents the disk from spinning down
and drains battery power.

/usr/bin/top revealed that devkit-power-daemon was consuming ~10% CPU
during the periods when the laptop hard drive was active. I attached
strace and indeed saw it performing blocks of I/O work in /var/lib
/DeviceKit-power. Indeed this directory seems to be filled with lots of
rather large log files just from today (14Mb total in the dir!):

  -rw-r--r--  1 root root 1673328 2010-02-24 21:24 
history-charge-G71C0003WA10-95-0000000495.dat
  -rw-r--r--  1 root root 1060256 2010-02-24 21:24 
history-time-empty-G71C0003WA10-95-0000000495.dat
  -rw-r--r--  1 root root  807099 2010-02-24 21:24 
history-time-full-G71C0003WA10-95-0000000495.dat
  -rw-r--r--  1 root root 2363486 2010-02-24 21:24 
history-rate-G71C0003WA10-95-0000000495.dat
  -rw-r--r--  1 root root 1244830 2010-02-24 21:20 
history-charge-G71C0001W610-38-0000000177.dat
  -rw-r--r--  1 root root 1028622 2010-02-24 21:20 
history-time-empty-G71C0001W610-38-0000000177.dat
  -rw-r--r--  1 root root  399937 2010-02-24 21:20 
history-time-full-G71C0001W610-38-0000000177.dat
  -rw-r--r--  1 root root 2351404 2010-02-24 21:20 
history-rate-G71C0001W610-38-0000000177.dat

While I am not familiar with the daemon's source code, some offhand
suggestions for making it a better citizen:

1. Use a binary format. These log files waste a lot of space on ASCII
text that could easily be compressed:

....
1257278229      88.681  discharging
1257278246      88.492  discharging
1257278263      88.263  discharging
1257278281      88.111  discharging
....

2. Get rid of the open/close/mmap/munmap/rename cycle, especially fsync.
Surely new data can be appended to a log file just by keeping a file
descriptor open and writing a block of text to it occasionally, letting
the kernel synch to disk once in a while. (And atomicity of writes would
be less important if you were to use a fixed-length binary record
format, as in suggestion #1.)

3. Recording power history just isn't important enough to justify a lot
of I/O (and it is ironic that power efficiency is reduced this much just
by measuring it). Reduce the sampling rate, especially when on battery
power, if #1 and #2 do not pay off.

ProblemType: Bug
Architecture: i386
Date: Wed Feb 24 21:27:20 2010
DistroRelease: Ubuntu 9.10
ExecutablePath: /usr/lib/devicekit-power/devkit-power-daemon
NonfreeKernelModules: nvidia
Package: devicekit-power 011-1ubuntu2
ProcEnviron:
 
ProcVersionSignature: Ubuntu 2.6.31-19.56-generic
SourcePackage: devicekit-power
Uname: Linux 2.6.31-19-generic i686

** Affects: devicekit-power (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386

-- 
devkit-power-daemon drains my battery recording excessive history
https://bugs.launchpad.net/bugs/527525
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to