Add Hardware Details to CPU Info Plugin.
Summary: Added an additional field which contains hardware information regarding the chipset manufacturer and model. Reviewed By: danielbuechele Differential Revision: D9294547 fbshipit-source-id: 45c577475f156ee4a83140f506df161cd4ed4330
This commit is contained in:
committed by
Facebook Github Bot
parent
a35765335e
commit
e51b8c0742
@@ -38,6 +38,7 @@ type CPUState = {|
|
|||||||
cpuFreq: Array<CPUFrequency>,
|
cpuFreq: Array<CPUFrequency>,
|
||||||
cpuCount: number,
|
cpuCount: number,
|
||||||
monitoring: boolean,
|
monitoring: boolean,
|
||||||
|
hardwareInfo: string,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
type ShellCallBack = (output: string) => void;
|
type ShellCallBack = (output: string) => void;
|
||||||
@@ -109,12 +110,15 @@ export default class CPUFrequencyTable extends SonarDevicePlugin<CPUState> {
|
|||||||
cpuFreq: [],
|
cpuFreq: [],
|
||||||
cpuCount: 0,
|
cpuCount: 0,
|
||||||
monitoring: false,
|
monitoring: false,
|
||||||
|
hardwareInfo: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let device = ((this.device: any): AndroidDevice);
|
let device = ((this.device: any): AndroidDevice);
|
||||||
this.adbClient = device.adb;
|
this.adbClient = device.adb;
|
||||||
|
|
||||||
|
this.updateHardwareInfo();
|
||||||
|
|
||||||
// check how many cores we have on this device
|
// check how many cores we have on this device
|
||||||
this.executeShell((output: string) => {
|
this.executeShell((output: string) => {
|
||||||
let idx = output.indexOf('-');
|
let idx = output.indexOf('-');
|
||||||
@@ -179,6 +183,41 @@ export default class CPUFrequencyTable extends SonarDevicePlugin<CPUState> {
|
|||||||
this.updateCoreFrequency(core, 'scaling_max_freq');
|
this.updateCoreFrequency(core, 'scaling_max_freq');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
updateHardwareInfo = () => {
|
||||||
|
this.executeShell((output: string) => {
|
||||||
|
let hwInfo = '';
|
||||||
|
if (
|
||||||
|
output.startsWith('msm') ||
|
||||||
|
output.startsWith('apq') ||
|
||||||
|
output.startsWith('sdm')
|
||||||
|
) {
|
||||||
|
hwInfo = 'QUALCOMM ' + output.toUpperCase();
|
||||||
|
} else if (output.startsWith('exynos')) {
|
||||||
|
this.executeShell((output: string) => {
|
||||||
|
if (output != null) {
|
||||||
|
this.setState({
|
||||||
|
hardwareInfo: 'SAMSUMG ' + output.toUpperCase(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 'getprop ro.chipname');
|
||||||
|
return;
|
||||||
|
} else if (output.startsWith('mt')) {
|
||||||
|
hwInfo = 'MEDIATEK ' + output.toUpperCase();
|
||||||
|
} else if (output.startsWith('sc')) {
|
||||||
|
hwInfo = 'SPREADTRUM ' + output.toUpperCase();
|
||||||
|
} else if (output.startsWith('hi') || output.startsWith('kirin')) {
|
||||||
|
hwInfo = 'HISILICON ' + output.toUpperCase();
|
||||||
|
} else if (output.startsWith('rk')) {
|
||||||
|
hwInfo = 'ROCKCHIP ' + output.toUpperCase();
|
||||||
|
} else if (output.startsWith('bcm')) {
|
||||||
|
hwInfo = 'BROADCOM ' + output.toUpperCase();
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
hardwareInfo: hwInfo,
|
||||||
|
});
|
||||||
|
}, 'getprop ro.board.platform');
|
||||||
|
};
|
||||||
|
|
||||||
onStartMonitor = () => {
|
onStartMonitor = () => {
|
||||||
if (this.intervalID) {
|
if (this.intervalID) {
|
||||||
return;
|
return;
|
||||||
@@ -308,6 +347,7 @@ export default class CPUFrequencyTable extends SonarDevicePlugin<CPUState> {
|
|||||||
Start
|
Start
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
{this.state.hardwareInfo}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
<ManagedTable
|
<ManagedTable
|
||||||
multiline={true}
|
multiline={true}
|
||||||
|
|||||||
Reference in New Issue
Block a user