am 77fa24a5: Merge change 26136 into eclair
Merge commit '77fa24a5ef3ee3bc108d4bf3c77b7b4c7d0d5451' into eclair-plus-aosp * commit '77fa24a5ef3ee3bc108d4bf3c77b7b4c7d0d5451': Fix NPE crash-loop when cpufreq not available in the kernel.
This commit is contained in:
@@ -509,23 +509,26 @@ public class ProcessStats {
|
|||||||
}
|
}
|
||||||
int speed = 0;
|
int speed = 0;
|
||||||
String file = readFile("/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state", '\0');
|
String file = readFile("/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state", '\0');
|
||||||
StringTokenizer st = new StringTokenizer(file, "\n ");
|
// Note: file may be null on kernels without cpufreq (i.e. the emulator's)
|
||||||
while (st.hasMoreElements()) {
|
if (file != null) {
|
||||||
String token = st.nextToken();
|
StringTokenizer st = new StringTokenizer(file, "\n ");
|
||||||
try {
|
while (st.hasMoreElements()) {
|
||||||
long val = Long.parseLong(token);
|
String token = st.nextToken();
|
||||||
tempSpeeds[speed] = val;
|
try {
|
||||||
token = st.nextToken();
|
long val = Long.parseLong(token);
|
||||||
val = Long.parseLong(token);
|
tempSpeeds[speed] = val;
|
||||||
tempTimes[speed] = val;
|
token = st.nextToken();
|
||||||
speed++;
|
val = Long.parseLong(token);
|
||||||
if (speed == MAX_SPEEDS) break; // No more
|
tempTimes[speed] = val;
|
||||||
if (localLOGV && out == null) {
|
speed++;
|
||||||
Log.v(TAG, "First time : Speed/Time = " + tempSpeeds[speed - 1]
|
if (speed == MAX_SPEEDS) break; // No more
|
||||||
+ "\t" + tempTimes[speed - 1]);
|
if (localLOGV && out == null) {
|
||||||
|
Log.v(TAG, "First time : Speed/Time = " + tempSpeeds[speed - 1]
|
||||||
|
+ "\t" + tempTimes[speed - 1]);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
Log.i(TAG, "Unable to parse time_in_state");
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
Log.i(TAG, "Unable to parse time_in_state");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out == null) {
|
if (out == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user