Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2137 closed enhancement (worksforme)

use modern timers

Reported by: psusi@… Owned by: reimar
Priority: normal Component: core
Version: HEAD Severity: minor
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:


Mplayer prefers to use the old /dev/rtc device to generate high resolution interrupts for it to wait on for timing purposes. This interface can only be used by a single task on the system and is wasteful of cpu and power. When this is not available, or not configured to allow setting 1024 interrupts per second ( it isn't by default ), it falls back to wasteful busy waiting. It needs patched to use modern posix timers that can use the modern tickless and HPET kernel features to allow the cpu to remain in deep low power state until the exact time requested.

Change History (4)

comment:1 Changed 7 years ago by reimar

  • Resolution set to worksforme
  • Status changed from new to closed

I don't know how you came to these conclusions, but as far as I can tell none of the are true.
/dev/rtc is not used by default, only if explicitly requested by the user.
Busy waiting (aka "softsleep") is also disabled by default, so it will in fact not be used unless the user enable it explicitly.
MPlayer already uses usleep(), which will make use of RTC, HPET or whatever else may be available.
So I cannot see anything that would need to be done, not only is the feature there, it is also already used unless disabled explicitly.

comment:2 Changed 7 years ago by psusi@…

Forwarded from an old bug in Ubuntu. I googled and the current docs at seem to indicate that it still prefers the rtc. I glanced at the source code and it looked like there was a flag to disable it, but that it was on by default. If you are sure it is now off by default then those docs should be updated and I'll close the Ubuntu bug.

comment:3 Changed 7 years ago by reimar

I don't follow your conclusions. The page you link to says that usleep is the default, it also says you explicitly need to use either the -rtc or -softsleep options. The only thing that's outdated is that usleep _usually_ has better than 10 ms accuracy nowadays.
And the source history tells that these features (rtc and softsleep) never, ever were enabled by default since they were introduced.

comment:4 Changed 7 years ago by psusi@…

The docs characterize the usleep method as "old" and the rtc method as "new". That implies better. It should probably be updated to indicate that there was a period of time when the normal method did not work very well and thus, the rtc method was used as a workaround, but these days it is no longer needed.

Note: See TracTickets for help on using tickets.