camera app is polling the file system every second when in foreground

Bug #1471906 reported by John McAleely
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
Medium
Bill Filler
camera-app
Confirmed
Medium
Florian Boucault
camera-app (Ubuntu)
Confirmed
Medium
Florian Boucault

Bug Description

from OEM bug #1471310

running fnotifystat, I can see that every second the camera-app is polling away as follows:

Total Open Close Read Write PID Process Pathname
  8.0 1.0 1.0 6.0 0.0 3175 camera-app /proc/3175/mounts
  2.0 1.0 1.0 0.0 0.0 3175 camera-app /dev/disk/by-label

Total Open Close Read Write PID Process Pathname
  8.0 1.0 1.0 6.0 0.0 3175 camera-app /proc/3175/mounts
  2.0 1.0 1.0 0.0 0.0 3175 camera-app /dev/disk/by-label

Total Open Close Read Write PID Process Pathname
  8.0 1.0 1.0 6.0 0.0 3175 camera-app /proc/3175/mounts
  2.0 1.0 1.0 0.0 0.0 3175 camera-app /dev/disk/by-label

so it is consistently polling away. That's kinda wasteful on resources (e.g. battery drain).

Tags: power-bugs
Revision history for this message
John McAleely (john.mcaleely) wrote :

Duplicate bug notes this as happening on recent vivid / mako

Revision history for this message
Sturm Flut (sturmflut) wrote :

As far as I can see this is intentional, the app continuously checks the remaining space and disables itself when disk space turns critically low. Also the polling only happens when the app is being actively used.

Revision history for this message
Colin Ian King (colin-king) wrote :

I'm not sure what mechanism is being used, but it certainly does not look like it is using a more efficient mechanism such as statfs(2) or fstatfs(2) both of which return struct statfs containing f_blocks and f_bfree that allow one to determine how much of a percentage of free space is available.

These system calls interrogate the kernel's current view of file system state rather than having to poll and read /proc entries. It is more efficient and better still returns correct data.

Changed in canonical-devices-system-image:
assignee: nobody → Bill Filler (bfiller)
importance: Undecided → High
milestone: none → ww34-2015
status: New → Confirmed
Changed in camera-app:
importance: Undecided → High
status: New → Confirmed
Bill Filler (bfiller)
Changed in camera-app (Ubuntu):
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Florian Boucault (fboucault)
Changed in camera-app:
assignee: nobody → Florian Boucault (fboucault)
Revision history for this message
Florian Boucault (fboucault) wrote :

The app uses the Qt API QStorageInfo::bytesAvailable() method [1] every 1 second.
For lack of a better API, one that would not require polling, we decided to go ahead with this one.
As Simon said, the polling only happens when the app is being actively used which means that even though it is indeed wasteful the amount of CPU used is not much in comparison to what the viewfinder uses in CPU and GPU when the camera app is up.

[1] https://doc-snapshots.qt.io/qt5-5.4/qstorageinfo.html

Revision history for this message
Colin Ian King (colin-king) wrote :

OK, I guess that is the cost of a high level API that doesn't use statfs().

Bill Filler (bfiller)
summary: - camera app is polling the file system every second
+ camera app is polling the file system every second when in foreground
Changed in canonical-devices-system-image:
importance: High → Medium
Changed in camera-app:
importance: High → Medium
Changed in camera-app (Ubuntu):
importance: High → Medium
Changed in canonical-devices-system-image:
milestone: ww34-2015 → none
tags: added: power-bugs
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.