开发者

Slow down CPU to simulate slower computers in browser testing

开发者 https://www.devze.com 2023-02-04 21:40 出处:网络
I\'m trying to see how our web pages behave on an average customer\'s computer. We have not yet pinned down this configuration, but it\'s likely开发者_运维百科 to be slower than what our developers an

I'm trying to see how our web pages behave on an average customer's computer. We have not yet pinned down this configuration, but it's likely开发者_运维百科 to be slower than what our developers and testers will have.

I've seen answers to similar questions that suggest throttling bandwidth and using a VM where the memory has been limited, but do I also need to slow down the CPU? I am under the impression that the CPU will run fairly close to full speed, even in a VM. Are there virtual machine platforms that allow you to limit the CPU cycles? I saw one suggestion to run something like Folding @ Home, but I would welcome other suggestions to throttle the CPU speed.

I've seen this question: How to Slow down the browser, and others that talk about limiting bandwidth.

Edit: I suppose I need to be concerned about how many cores/processors are available to the VM as well. Do most VM platforms give you the option of limiting this?


This is a fast solution, but not very accurate when it comes to end-user specs, but it helps a lot to test things on slower systems:

Go to Power Options -> Create a power plan -> Change advanced power settings and set CPU Maximum Rate to 5% or how much you need.

This usually helps test browser apps on slower configs.


In multi core systems running vista or better you can set the cpu affinity forcing the browser to run only on a single core

For example

c:\windows\system32\cmd.exe /C start /affinity 1 notepad.exe

Individual cores on most machines these days aren't significantly faster than a couple of generations ago. That said you will find that due to architecture changes the cache is probably larger and the ram will be faster both of which make a significant difference.

Have you considered just buying an old pc from ebay or your local free adds. I suspect the cost in wages of having a member of staff do the necessary research, set up your limited ram vm and add core binding shortcuts for the major browsers etc would buy you a fair few old boxes, complete with older os (and if you're really lucky all the last owners spyware and browser toolbars for an extra accurate simulation of your end users pcs)


Adding to CatalinBerta's answer which worked great for me. You also need to keep in mind that it's not just the CPU you want slow down.

Browsers typically rely on GPU's for painting and composting the webpage as well as for complex animations. If you want to simulate worst case scenario, try disabling all of your Display Adapters in Device Manager, which will closely resemble clients using computers at public libraries.

For Windows:

Start > search "Device Manager" > Expand Display Adapters > right click each item > Disable


Seems like it would be simpler to acquire an "average customer's computer" on the used computer market.

Or build it yourself from parts.


I created a free simple tool for Windows that allows anyone to enter the process ID and the desired CPU speed percentage, and it proceeds to simulate a slow CPU for that process. The utility itself barely consumes CPU time, which is a benefit. :)

It's called "Slow CPU Emulator", check it out here: https://github.com/mathusummut/SlowCpuEmulator

Precompiled binaries can be found here: https://sourceforge.net/projects/slowcpu


Found a solution for this on Mac as well.

http://jesperrasmussen.com/blog/2013/03/07/limiting-cpu-cores-on-the-fly-in-os-x-mountain-lion/

Using the instruments app, you can limit the CPU usage of one or all running processes.


For MacOS/Linux, there is cpulimit.

To install on Ubuntu:

sudo apt install cpulimit


VirtualBox can customize virtual machines to run on only limited CPU cores and RAM. it could help a bit.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号