cpu - Android Get Processor Model -
i want processor model similar du booster. cpu model contains arm processor version , revision. example: armv7 processor rev 3 (v7l)
i have tried system.getproperty("os.arch")
returns architecture
and
string[] args = {"/system/bin/cat", "/proc/cpuinfo"};
to cpu info. able right information in of devices not in all.
i tried in asus fonepad 7 doesn't return property of processor(but returns processor(small p)
it returns like
processor : 0 vendor_id : genuineintel cpu family : 6 model : 53 model name : intel(r) atom(tm) cpu z2520 @ 1.20ghz stepping : 1 microcode : 0x10e cpu mhz : 800.000 cache size : 512 kb physical id : 0 siblings : 4
i want result "armv7 processor rev 3 (v7l)". in advance..
you don't need implement separated methods work differ processors types. use code show info architectures. model_name
string differ, replace cpu_model
, here go. i've underscored keys names, can use want.
public map<string, string> getcpuinfo () throws ioexception { map<string, string> output = new hashmap<> (); bufferedreader br = new bufferedreader (new filereader ("/proc/cpuinfo")); string str; while ((str = br.readline ()) != null) { string[] data = str.split (":"); if (data.length > 1) { string key = data[0].trim ().replace (" ", "_"); if (key.equals ("model_name")) key = "cpu_model"; string value = data[1].trim (); if (key.equals ("cpu_model")) value = value.replaceall ("\\s+", " "); output.put (key, value); } } br.close (); return output; }
Comments
Post a Comment