[MountPointObserverCache] Update mounts less frequently
ClosedPublic

Authored by broulik on Sep 14 2018, 2:03 PM.

Details

Summary

Even on fastest disks, filling up the disk in 10 seconds is unlikely.
Moreover, Plasma's "low disk" warning only polls every minute as well and Dolphin doesn't warn you about the fact that it's full.
Reduces needless wake ups of disks and network.

CCBUG: 398612

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Sep 14 2018, 2:03 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptSep 14 2018, 2:03 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
broulik requested review of this revision.Sep 14 2018, 2:03 PM
broulik edited the summary of this revision. (Show Details)Sep 14 2018, 2:07 PM
anthonyfieroni added inline comments.
src/statusbar/mountpointobservercache.cpp
55

Maybe true will be better.

65

Here will be isSlow = false

81–82

It can be removed

102

You mean stop ? If you do single shot timer fit better, you don't need to check it's active and it don't need to stop.

broulik added inline comments.Sep 15 2018, 7:20 AM
src/statusbar/mountpointobservercache.cpp
81–82

Why? There are protocols that aren't file but still local (e.g. desktop)

As mentioned on IRC I was thinking that we should simply bump the overall poll interval to 1 minute instead of splitting timers. The additional code seems hardly worthwhile considering the original 10s value is really odd if you do some quick maths... from IRC:

[13:18] <sitter> I am not sure how those 10 seconds came to be really ... it seems to me the diff is not noticable with anything but tiny disks. I mean, say you have 300mb/s throughput, which seems generous even on the same partition, you'd be having 3gb in 10s. what's a common SSD size? 320? So you'd be looking at a 1% change from one poll to the next. on my system the bar seems to be some 75px, so within one poll frame the bar wouldn't even move. and that's already 
[13:18] <sitter> assuming I'd be logging around such huge amounts of data
[13:20] <sitter> at the same time if you consider the entire thing for an HDD it's an even weirder default

... and then you also have to ask yourself how often would a user have to move such substantial amount of data around that it'd justify such a short poll interval. After all, 99% of a partitions live data <3gb/s are being added/removed, so the general situation is next to no change with the occasional massive change.

src/statusbar/mountpointobservercache.cpp
55

Doesn't really matter, does it?

If we can get a KMountPoint we'll defer the decision there.
If the protocol is clearly not local it gets mark slow.

Changing the default value doesn't remove the need for either of those condition.

But, I think we can simplify this by initializing the value correctly, i.e. move the scheme check up:

bool isSlow = (KProtocolInfo::protocolClass(cachedObserverUrl.scheme()) != QLatin1String(":local"));
[......]
            isSlow = mountPoint->probablySlow();
81–82

Yeah, I don't see what's wrong with this?

Also note that Plasma's "disk low" warning only polls every minute either.

src/statusbar/mountpointobservercache.cpp
81–82

Good point, it's better to be here.

+1 to always reducing the interval to one minute.

broulik updated this revision to Diff 41881.Sep 18 2018, 8:30 AM
broulik retitled this revision from [MountPointObserverCache] Update remote and slow mounts less frequently to [MountPointObserverCache] Update mounts less frequently.
broulik edited the summary of this revision. (Show Details)
broulik edited the test plan for this revision. (Show Details)
  • Just bump interval to 60 seconds
ngraham accepted this revision.Oct 8 2018, 5:30 PM
This revision is now accepted and ready to land.Oct 8 2018, 5:30 PM
elvisangelaccio accepted this revision.Oct 8 2018, 7:19 PM
sitter accepted this revision.Oct 9 2018, 9:06 AM
This revision was automatically updated to reflect the committed changes.