Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

performance - How to detect android cpu speed?

I would like to detect how fast is the device on which my Android application is running?

Is there any API to do it on Android? Or do I have to benchmark it by myself?

If the device has slow CPU I would like to turn off some time consuming operations like animations or limit maximum number of simultaneous HTTP request.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The best way to do it in my opinion is to monitor the time it takes to do these actions. If it is taking too much time, then the system is too slow and you can disable fancy features until it is fast enough.

Reading the CPU speed or other specs and attempting to judge the system speed is a bad idea. Future hardware changes might make these specs meaningless.

Look at the Pentium 4 vs the Core 2 for example. Which is the faster CPU, a 2.4 GHz Pentium 4, or the 1.8 GHz Core 2? Is a 2 GHz Opteron faster than a 1.4 GHz Itanium 2? How are you going to know what kind of ARM CPU is actually faster?

To get system speed ratings for Windows Vista and 7 Microsoft actually benchmarks the machine. This is the only halfway accurate method to determine system capabilities.

It looks like a good method is to use SystemClock.uptimeMillis().


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...