5 ms·
Time(1) and CPU Frequency Scaling
- siddhant09 5y agoYes, and which is why most benchmarks today are somewhat misleading as well. My personal laptop's CPU is Intel i7-9750H. I always run it with turbo boost disabled for predictable, sustained performance. Turbo boost is weird as in it can lead to a sub-par user experience (lag) when your processor throttles. Interestingly enough I can simultaneously compile a ~250k LOC purescript project & attend a google meets call with TB disabled but not with it enabled. (This is on MBP-16)
- user_7832 5y agoWouldn’t this be due to thermal throttling? In which case a better heat dissipation system would help avoid it.
- siddhant09 5y agoNot really. Intel tries to push the thermal envelop as much as it can for as long as it can. While the CPU is rated at 45W, TB actually pushes it to 70W+ for short intervals. On Windows, instead of disabling TB, I just limit the CPU TDP at 40W via throttle-stop. TB just makes the laptop loud and hot even when the added performance is not required.
- genewitch 5y agoAs a reference, my laptop is a Ryzen 4800H and I only hear the fans... Well, never. I even have the laptop set to "agressive cooling" which turns an LED red indicating I am not being green. I was using the laptop to mine verium during this past winter in the US south to keep my hands and arms warm in lieu of running HVAC more. I never bothered to switch it back to normal or "quiet" mode. I take my first statement back, running blender benchmarks or some other benchmark that tries to tap out the GPU tends to make a bit of noise, but normal gaming and stuff like handbrake or whatever I can't hear anything.
- magila 5y agoThe OS is doing something screwy if frequency scaling causes noticeable performance regression. A modern Intel CPU like the 9750H supports very low latency (on the order of microseconds) hardware driven frequency scaling which should pretty much always perform better than leaving the CPU locked at the base frequency. Intel Macbooks are also notoriously thermally limited so I wonder if the settings you're using are just causing the CPU to run hotter than it would at stock.
- hnuser123456 5y agoI have a thin gaming laptop with the same CPU, and stock settings let it climb to 100C and then figure out how fast it can run without getting hotter, usually also with far too much voltage. Decreasing the voltage, and even power limit, and disabling boost, lets you set that temp ceiling to something closer to 60-80C, which will make the CPU more comfortable running at higher frequencies, although with a theoretically slightly reduced stability margin due to less voltage overhead. However, long-term use at high temps and voltage can also degrade stability, so it's a delicate balancing act. The only way to guarantee sustained performance at low temps is to improve cooling, with higher fan speeds or a laptop cooler.
- gruez 5y ago>My personal laptop's CPU is Intel i7-9750H. I always run it with turbo boost disabled for predictable, sustained performance. Turbo boost is weird as in it can lead to a sub-par user experience (lag) when your processor throttles. Does your laptop have such atrocious cooling that it can't sustain frequencies higher than base? When my laptop undergoes thermal throttling (ie. hits 95C), the frequency is still above the base frequency, so I'm still getting more performance than if turbo was disabled. edit: tested with cinebench. On my laptop with intel cpu the sustained all-core turbo frequency is 45% higher than the base frequency. This is with throttlestop enabled, otherwise TDP/tau throttling kicks in first rather than thermal throttling.
- siddhant09 5y agoIt's a MSI-GF65 Thin which has excellent cooling. However with TB enabled both Ubuntu & Windows randomly starts a process (usually updates) which hits the CPU hard and consequently all the fans spin up. At base clock, I see no visible loss in performance and a much quieter workstation. The performance loss in compilation is offset by continuously compiling (watch) which I can do with TB disabled but not with TB enabled. For gaming, I limit the turbo boost to 3.2Ghz and get a more consistent performance with no sudden drops.
- rambojazz 5y agoWhy turbo boost disabled instead of always-enabled?
- secondcoming 5y ago> I really wanted to know: > “How much work did the CPU have to do in order to complete this task?” > But what time(1) tells me is: > “How long did the CPU work to complete this task?” Yes, exactly. It's essentially impossible to accurately time things, especially on a laptop. To answer the second question, the best bet is to use rdtscp() when micro-benchmarking, but even that has pitfalls.
- brirec 5y agoSee also https://news.ycombinator.com/item?id=27725286 https://news.ycombinator.com/item?id=27725286 My thoughts on this are that we could do with a better CPU usage measurement, which the author of this article found to be cycles.
- ivegotnoaccount 5y agoOne issue with cycles is that the results you will get may not reflect what end users, who probably have throtling enabled if it is made to run on laptops or desktop computers, will experience. All instructions do not have the same thermal cost, and even though my laptop's CPU is able to stand at 3.99GHz when running stress tests whereas its base clock is 2.59GHz, I doubt it would be able to do the same if it was running AVX2 instructions (or it does have quite impressive thermals for a laptop). Also, does disabling throtling disable dynamic frequency scaling of the CPU's cache too ?
- marbu 5y agoA minor nitpick: the author most likely doesn't use time(1), which usually is https://www.gnu.org/software/time/ https://www.gnu.org/software/time/), but internal shell command time. See: ``` $ type -a time time is a shell keyword time is /usr/bin/time time is /bin/time ```
- oandrew 5y agoyou can skip shell built-ins by pretending "command": $ time -V -V: command not found $ command time -V GNU time 1.7
- nonameiguess 5y agoTry to compile ATLAS and you will become intimately familiar with this problem. It refuses to compile if you have any kind of throttling or scaling enabled because it relies on benchmarking all of the alternative compute kernels to determine which is best for your specific hardware. Just following the instructions in the README to set the governor from userspace is not nearly enough. I had to completely re-compile my kernel with the default governor set to performance, on-demand enabled, and all thermal throttling not even available as an option. The basic issue is consumer kernels are all general-purpose and have to work on laptops and mobile devices, so a whole lot of options are set that make no sense on workstations, and you end up throttling when it isn't necessary, i.e. you're not on battery and you have plenty of fan power or a water loop to prevent actual damage. Heck, in many cases, you may even need to disable throttling in the BIOS, which is doubly disappointing because a desktop BIOS definitely doesn't need settings that work on laptops and mobile.
- zinekeller 5y ago> Heck, in many cases, you may even need to disable throttling in the BIOS, which is doubly disappointing because a desktop BIOS definitely doesn't need settings that work on laptops and mobile. For you, probably, but companies in Asia (due to shareholder and regulatory reasons) needs to power manage their systems hard and only will disable power management when really required. That option exists not for you but for them.
- nonameiguess 5y agoHonestly, I had no idea that was the case, but it explains a lot, so thanks.
- mcint 5y agoCan you say more? I’m not even sure how I’d search for more information about this. Because of the large and dense population centers, and therefore power requirements, governments require aggressive power management settings on computers??
- zekrioca 5y ago