清理告警

Signed-off-by: 钱玉英 <qianyuying@huawei.com>
This commit is contained in:
钱玉英 2024-05-06 14:56:26 +08:00
parent e78edb0eed
commit 64bbb561f9
17 changed files with 605 additions and 752 deletions

View File

@ -192,7 +192,11 @@ void ProfilerFPS::GetSectionsFps(FpsInfoProfiler &fpsInfoResult) const
currLastTime += harTime; currLastTime += harTime;
count--; count--;
} }
if (i == (static_cast<int>(fpsInfoResult.currTimeStamps.size()) - 1)) { long long size = fpsInfoResult.currTimeStamps.size();
if (size < 1) {
return;
}
if (i == (size - 1)) {
printf("sectionsFps:%d|%lld\n", msCount * ten, currLastTime); printf("sectionsFps:%d|%lld\n", msCount * ten, currLastTime);
printCount++; printCount++;
GetSectionsPrint(printCount, currLastTime); GetSectionsPrint(printCount, currLastTime);
@ -224,8 +228,7 @@ FpsInfoProfiler ProfilerFPS::GetFpsInfo()
{ {
fpsInfoMax.fps = 0; fpsInfoMax.fps = 0;
std::string uniteLayer = "UniRender"; std::string uniteLayer = "UniRender";
if (pkgName.empty() || pkgName.find("desktops") != std::string::npos) { if (pkgName.empty()) {
LOGI("ProfilerFPS.pkgName===: %s", pkgName.c_str());
GetCurrentTime(fifty); GetCurrentTime(fifty);
fpsInfoMax = GetSurfaceFrame(uniteLayer); fpsInfoMax = GetSurfaceFrame(uniteLayer);
} else { } else {

View File

@ -247,15 +247,12 @@ void StartUpDelay::InitXY2(const std::string &curAppName, const std::string &fil
size_t appIndex = strLine.find(curAppName); size_t appIndex = strLine.find(curAppName);
if (appIndex != std::string::npos) { if (appIndex != std::string::npos) {
findIndex = appIndex; findIndex = appIndex;
if (findIndex == std::string::npos) {
break;
}
} else { } else {
findIndex = appPkgIndex; findIndex = appPkgIndex;
}
if (findIndex == std::string::npos) { if (findIndex == std::string::npos) {
break; break;
} }
}
size_t bounds = strLine.rfind("bounds", findIndex); size_t bounds = strLine.rfind("bounds", findIndex);
if (bounds > 0) { if (bounds > 0) {
std::string boundStr = strLine.substr(bounds, 30); std::string boundStr = strLine.substr(bounds, 30);
@ -276,8 +273,12 @@ void StartUpDelay::InitXY2(const std::string &curAppName, const std::string &fil
} else { } else {
size_t leftStart = boundStr.find_first_of("["); size_t leftStart = boundStr.find_first_of("[");
size_t leftEnd = boundStr.find_first_of("]"); size_t leftEnd = boundStr.find_first_of("]");
pointXY = boundStr.substr(leftStart + 1, static_cast<int>(leftEnd - leftStart - 1)); if (leftStart != std::string::npos && leftEnd != std::string::npos && leftEnd > leftStart) {
pointXY = pointXY.replace(pointXY.find(","), 1, " "); std::string pointSubstr = boundStr.substr(leftStart + 1, leftEnd - leftStart - 1);
pointXY = std::regex_replace(pointSubstr, std::regex(","), " ");
} else {
std::cout << "Error extracting bounds." << std::endl;
}
} }
break; break;
} }
@ -319,9 +320,12 @@ void StartUpDelay::InitXY(const std::string &curAppName, const std::string &file
} else { } else {
size_t leftStart = boundStr.find_first_of("["); size_t leftStart = boundStr.find_first_of("[");
size_t leftEnd = boundStr.find_first_of("]"); size_t leftEnd = boundStr.find_first_of("]");
int pointXYLength = static_cast<int>(leftEnd - leftStart - 1); if (leftStart != std::string::npos && leftEnd != std::string::npos && leftEnd > leftStart) {
pointXY = boundStr.substr(leftStart + 1, pointXYLength); std::string pointSubstr = boundStr.substr(leftStart + 1, leftEnd - leftStart - 1);
pointXY = pointXY.replace(pointXY.find(","), 1, " "); pointXY = std::regex_replace(pointSubstr, std::regex(","), " ");
} else {
std::cout << "Error extracting bounds." << std::endl;
}
} }
break; break;
} }

View File

@ -59,7 +59,7 @@ HWTEST_F(SPdaemonGpuTest, Init001, TestSize.Level1)
int ret = GpuCounter::GetInstance().Init(recvBuf, data); int ret = GpuCounter::GetInstance().Init(recvBuf, data);
SPUtils::LoadCmd(constCheckProductInfo, result); SPUtils::LoadCmd(constCheckProductInfo, result);
if (result.empty() || std::string::npos == result.find(constProductInfo)) { if (result.empty() || result.find(constProductInfo) == std::string::npos) {
EXPECT_EQ(ret, -4); EXPECT_EQ(ret, -4);
return; return;
} }

View File

@ -297,6 +297,10 @@ static std::string GetSurFace()
} }
static void GetFpsUniteInfo(int num) static void GetFpsUniteInfo(int num)
{ {
if (num <= 0) {
printf("Invalid value for num: %d\n", num);
return;
}
FpsInfo gfpsInfo; FpsInfo gfpsInfo;
FpsInfo gfpsUniteInfo; FpsInfo gfpsUniteInfo;
std::string layerName; std::string layerName;

View File

@ -24,7 +24,7 @@ export struct FloatWindowComponent {
private settings: RenderingContextSettings = new RenderingContextSettings(true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
@State title: string = 'SmartPerf' @State title: string = 'SmartPerf'
private xPoint: number = 5 //x起始坐标 private xPoint: number = 5
private yPoint: number = 108 //Y起始坐标 private yPoint: number = 108 //Y起始坐标
private xScale: number = 8 //刻度 private xScale: number = 8 //刻度
private yScale: number = 21 //刻度 private yScale: number = 21 //刻度

View File

@ -159,6 +159,7 @@ export default {
name: dbName, name: dbName,
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TGeneralInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -183,7 +184,6 @@ export default {
]); ]);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TGeneralInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sessionId = resultSet.getString( let sessionId = resultSet.getString(
resultSet.getColumnIndex('sessionId') resultSet.getColumnIndex('sessionId')
@ -244,6 +244,7 @@ export default {
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR(TAG, 'resultSet queryGeneralData:err' + err); SPLogger.ERROR(TAG, 'resultSet queryGeneralData:err' + err);
return results;
} }
}, },
@ -253,6 +254,7 @@ export default {
name: dbPath, name: dbPath,
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TIndexInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -299,7 +301,6 @@ export default {
]); ]);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TIndexInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let timestamp = resultSet.getString( let timestamp = resultSet.getString(
resultSet.getColumnIndex('timestamp') resultSet.getColumnIndex('timestamp')
@ -461,6 +462,7 @@ export default {
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR(TAG, 'resultSet queryIndexInfo Data:err' + err); SPLogger.ERROR(TAG, 'resultSet queryIndexInfo Data:err' + err);
return results;
} }
}, },
/** /**
@ -642,7 +644,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -664,7 +666,6 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'display'; let sensor = 'display';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
@ -692,6 +693,7 @@ export default {
TAG, TAG,
'resultSet query_applications_display err22222:' + err 'resultSet query_applications_display err22222:' + err
); );
return results;
} }
}, },
//查询表task_powersensor_info //查询表task_powersensor_info
@ -702,18 +704,16 @@ export default {
name: pathSuffix + '.db', name: pathSuffix + '.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
.then(async (rdbStore) => { .then(async (rdbStore) => {
let strSQL: string = let strSQL: string =
'select * ' + 'from task_powersensor_info order by power desc '; 'select * ' + 'from task_powersensor_info order by power desc ';
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = resultSet.getString( let sensor = resultSet.getString(
resultSet.getColumnIndex('sensor') resultSet.getColumnIndex('sensor')
@ -738,6 +738,7 @@ export default {
TAG, TAG,
'resultSet query_applications_display err22222:' + err 'resultSet query_applications_display err22222:' + err
); );
return results;
} }
}, },
//查询表detailed_applications_cpu //查询表detailed_applications_cpu
@ -750,7 +751,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -768,34 +769,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'cpu'; let sensor = 'cpu';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----cpu' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_gpu //查询表detailed_applications_gpu
@ -808,7 +794,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -826,34 +812,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'gpu'; let sensor = 'gpu';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----gpu' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_wifi_data //查询表detailed_applications_wifi_data
@ -866,7 +837,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -883,34 +854,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'wifi_data'; let sensor = 'wifi_data';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----wifi_data' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_system_idle //查询表detailed_applications_system_idle
@ -923,7 +879,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -940,34 +896,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'system_idle'; let sensor = 'system_idle';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----system_idle' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_audio //查询表detailed_applications_audio
@ -980,7 +921,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -997,34 +938,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'audio'; let sensor = 'audio';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----audio' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_dss //查询表detailed_applications_dss
@ -1037,7 +963,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -1054,34 +980,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'dss'; let sensor = 'dss';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----dss' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_ddr //查询表detailed_applications_ddr
@ -1094,7 +1005,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -1111,36 +1022,22 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'ddr'; let sensor = 'ddr';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----ddr' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, //查询表detailed_applications_sensor },
//查询表detailed_applications_sensor
async query_applications_sensor( async query_applications_sensor(
start_time: String, start_time: String,
end_time: String, end_time: String,
@ -1150,7 +1047,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -1167,34 +1064,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'sensor'; let sensor = 'sensor';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----sensor' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询表detailed_applications_rom //查询表detailed_applications_rom
@ -1207,7 +1089,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerSensorInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -1224,34 +1106,19 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerSensorInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let sensor = 'rom'; let sensor = 'rom';
let power = resultSet.getString(resultSet.getColumnIndex('power')); let power = resultSet.getString(resultSet.getColumnIndex('power'));
let current = resultSet.getString( let current = resultSet.getString(
resultSet.getColumnIndex('current') resultSet.getColumnIndex('current')
); );
let tPowerSensorInfo = new TPowerSensorInfo( let tPowerSensorInfo = new TPowerSensorInfo('', sensor, power, current, '');
'',
sensor,
power,
current,
''
);
results.push(tPowerSensorInfo); results.push(tPowerSensorInfo);
} }
SPLogger.INFO(
'TAG',
'resultSet query_applications_display-----rom' +
JSON.stringify(results)
);
return results; return results;
}); });
} catch (err) { } catch (err) {
SPLogger.ERROR( return results;
TAG,
'resultSet query_applications_display err22222:' + err
);
} }
}, },
//查询dubai 所有进程功耗 并插入表 t_power_appinfo //查询dubai 所有进程功耗 并插入表 t_power_appinfo
@ -1263,7 +1130,7 @@ export default {
name: 'dubai.db', name: 'dubai.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerAppInfo[] = [];
let strSQL: String = ''; let strSQL: String = '';
try { try {
return await relationalStore return await relationalStore
@ -1334,7 +1201,6 @@ export default {
tMap.set(name, sum_energy); tMap.set(name, sum_energy);
} }
} }
let results: TPowerAppInfo[] = [];
//遍历去重相加后的arr //遍历去重相加后的arr
for (let [name, power] of tMap) { for (let [name, power] of tMap) {
let percent = (Number(power) * 100) / totalSumEnergy; let percent = (Number(power) * 100) / totalSumEnergy;
@ -1373,6 +1239,7 @@ export default {
TAG, TAG,
'resultSet query_applications_display err22222:' + err 'resultSet query_applications_display err22222:' + err
); );
return results;
} }
}, },
@ -1382,6 +1249,7 @@ export default {
name: pathSuffix + '.db', name: pathSuffix + '.db',
securityLevel: relationalStore.SecurityLevel.S1, securityLevel: relationalStore.SecurityLevel.S1,
}; };
let results: TPowerAppInfo[] = [];
try { try {
return await relationalStore return await relationalStore
.getRdbStore(globalThis.abilityContext, STORE_CONFIG) .getRdbStore(globalThis.abilityContext, STORE_CONFIG)
@ -1392,7 +1260,6 @@ export default {
return rdbStore.querySql(strSQL); return rdbStore.querySql(strSQL);
}) })
.then((resultSet) => { .then((resultSet) => {
let results: TPowerAppInfo[] = [];
while (resultSet.goToNextRow()) { while (resultSet.goToNextRow()) {
let process = resultSet.getString( let process = resultSet.getString(
resultSet.getColumnIndex('process') resultSet.getColumnIndex('process')
@ -1421,6 +1288,7 @@ export default {
TAG, TAG,
'resultSet query_applications_display query_powerapp_info:' + err 'resultSet query_applications_display query_powerapp_info:' + err
); );
return results;
} }
}, },
}; };

View File

@ -36,8 +36,8 @@ export struct Performance {
@State private gpData: TIndexInfo[] = [] @State private gpData: TIndexInfo[] = []
@State lostList: FpsLostFrame[] = [] @State lostList: FpsLostFrame[] = []
public lostLine: Array<number> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] public lostLine: Array<number> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
public fpsValues: Array<number> = [] public fpsValues: number[] = []
public fpsJitterValues: Array<string> = [] public fpsJitterValues: string[] = []
public topAxis: XAxis = new XAxis(); //顶部X轴 public topAxis: XAxis = new XAxis(); //顶部X轴
public bottomAxis: XAxis = new XAxis(); //底部X轴 public bottomAxis: XAxis = new XAxis(); //底部X轴
public atWidth: number = 350; //表的宽度 public atWidth: number = 350; //表的宽度

View File

@ -125,7 +125,7 @@ export struct Summary {
cpuB = cpuFreqMap.get('cpu' + cpuCoreArr[1] + 'FreqSum') / 1e3 cpuB = cpuFreqMap.get('cpu' + cpuCoreArr[1] + 'FreqSum') / 1e3
cpuC = cpuFreqMap.get('cpu' + cpuCoreArr[2] + 'FreqSum') / 1e3 cpuC = cpuFreqMap.get('cpu' + cpuCoreArr[2] + 'FreqSum') / 1e3
} }
var cpuList = [cpuA, cpuB, cpuC].sort() let cpuList = [cpuA, cpuB, cpuC].sort()
cpuMin = cpuList[0] cpuMin = cpuList[0]
cpuMid = cpuList[1] cpuMid = cpuList[1]

View File

@ -123,7 +123,7 @@ export struct Current {
} }
let gradientFillColor: Array<ColorStop> = []; let gradientFillColor: ColorStop[] = [];
gradientFillColor.push([0x0C0099CC, 0.2]) gradientFillColor.push([0x0C0099CC, 0.2])
gradientFillColor.push([0x7F0099CC, 0.4]) gradientFillColor.push([0x7F0099CC, 0.4])
gradientFillColor.push([0x0099CC, 1.0]) gradientFillColor.push([0x0099CC, 1.0])

View File

@ -555,8 +555,7 @@ export default abstract class Chart<T> {
if (callListener && this.mSelectionListener != null) { if (callListener && this.mSelectionListener != null) {
if (!this.valuesToHighlight()) { if (!this.valuesToHighlight()) {
this.mSelectionListener.onNothingSelected(); this.mSelectionListener.onNothingSelected();
} } else {
else {
// notify the listener // notify the listener
this.mSelectionListener.onValueSelected(e, high); this.mSelectionListener.onValueSelected(e, high);
} }

View File

@ -104,24 +104,18 @@ export default class LegendRenderer extends Renderer {
public computeLegend(data?: ChartData<IDataSet<EntryOhos>>): void { public computeLegend(data?: ChartData<IDataSet<EntryOhos>>): void {
if (!this.mLegend.isLegendCustom() && data) { if (!this.mLegend.isLegendCustom() && data) {
this.computedEntries.clear(); this.computedEntries.clear();
// loop for building up the colors and labels used in the legend
for (let i: number = 0; i < data.getDataSetCount(); i++) { for (let i: number = 0; i < data.getDataSetCount(); i++) {
let dataSet: IDataSet<EntryOhos> = data.getDataSetByIndex(i); let dataSet: IDataSet<EntryOhos> = data.getDataSetByIndex(i);
if (dataSet == null) { if (dataSet == null) {
continue; continue;
} }
let clrs: JArrayList<Number> = dataSet.getColors(); let clrs: JArrayList<Number> = dataSet.getColors();
let entryCount: number = dataSet.getEntryCount(); let entryCount: number = dataSet.getEntryCount();
// if we have a barchart with stacked bars // if we have a barchart with stacked bars
if (dataSet.constructor.name == 'IBarDataSet<EntryOhos>' && (<IBarDataSet>dataSet).isStacked()) { if (dataSet.constructor.name == 'IBarDataSet<EntryOhos>' && (<IBarDataSet>dataSet).isStacked()) {
let bds: IBarDataSet = <IBarDataSet>dataSet; let bds: IBarDataSet = <IBarDataSet>dataSet;
let sLabels: string[] = bds.getStackLabels(); let sLabels: string[] = bds.getStackLabels();
let minEntries: number = Math.min(clrs.size(), bds.getStackSize()); let minEntries: number = Math.min(clrs.size(), bds.getStackSize());
for (let j: number = 0; j < minEntries; j++) { for (let j: number = 0; j < minEntries; j++) {
let label: string; let label: string;
if (sLabels.length > 0) { if (sLabels.length > 0) {
@ -130,7 +124,6 @@ export default class LegendRenderer extends Renderer {
} else { } else {
label = null; label = null;
} }
this.computedEntries.add( this.computedEntries.add(
new LegendEntry( new LegendEntry(
label, label,
@ -142,9 +135,7 @@ export default class LegendRenderer extends Renderer {
) )
); );
} }
if (bds.getLabel() != null) { if (bds.getLabel() != null) {
// add the legend description label
this.computedEntries.add( this.computedEntries.add(
new LegendEntry( new LegendEntry(
dataSet.getLabel(), dataSet.getLabel(),
@ -157,19 +148,13 @@ export default class LegendRenderer extends Renderer {
); );
} }
} else { } else {
// all others
for (let j: number = 0; j < clrs.size() && j < entryCount; j++) { for (let j: number = 0; j < clrs.size() && j < entryCount; j++) {
let label: string; let label: string;
// if multiple colors are set for a DataSet, group them
if (j < clrs.size() - 1 && j < entryCount - 1) { if (j < clrs.size() - 1 && j < entryCount - 1) {
label = null; label = null;
} else { } else {
// add label to the last entry
label = data.getDataSetByIndex(i).getLabel(); label = data.getDataSetByIndex(i).getLabel();
} }
this.computedEntries.add( this.computedEntries.add(
new LegendEntry( new LegendEntry(
label, label,
@ -183,33 +168,23 @@ export default class LegendRenderer extends Renderer {
} }
} }
} }
if (this.mLegend.getExtraEntries() != null) { if (this.mLegend.getExtraEntries() != null) {
let datas: LegendEntry[] = this.mLegend.getExtraEntries(); let datas: LegendEntry[] = this.mLegend.getExtraEntries();
for (let i: number = 0; i < datas.length; i++) { for (let i: number = 0; i < datas.length; i++) {
this.computedEntries.add(datas[i]); this.computedEntries.add(datas[i]);
} }
} }
this.mLegend.setEntries(this.computedEntries); this.mLegend.setEntries(this.computedEntries);
} }
let tf: FontWeight /*Typeface*/ = this.mLegend.getTypeface(); let tf: FontWeight /*Typeface*/ = this.mLegend.getTypeface();
if (tf != null) { if (tf != null) {
this.mLegendLabelPaint.setTypeface(tf); this.mLegendLabelPaint.setTypeface(tf);
} }
this.mLegendLabelPaint.setTextSize(this.mLegend.getTextSize()); this.mLegendLabelPaint.setTextSize(this.mLegend.getTextSize());
this.mLegendLabelPaint.setColor(this.mLegend.getTextColor()); this.mLegendLabelPaint.setColor(this.mLegend.getTextColor());
// calculate all dimensions of the mLegend
this.mLegend.calculateDimensions(this.mLegendLabelPaint, this.mViewPortHandler); this.mLegend.calculateDimensions(this.mLegendLabelPaint, this.mViewPortHandler);
} }
protected legendFontMetrics: FontMetrics = new FontMetrics(); protected legendFontMetrics: FontMetrics = new FontMetrics();
// public void renderLegend(Canvas c) {
public renderLegend(): Paint[] { public renderLegend(): Paint[] {
let datas: Point[] = []; let datas: Point[] = [];
if (!this.mLegend.isEnabled()) { if (!this.mLegend.isEnabled()) {
@ -440,16 +415,16 @@ export default class LegendRenderer extends Renderer {
let posY: number = 0.1; let posY: number = 0.1;
switch (verticalAlignment) { switch (verticalAlignment) {
case LegendVerticalAlignment.TOP: { case LegendVerticalAlignment.TOP: {
posY = horizontalAlignment == LegendHorizontalAlignment.CENTER posY = horizontalAlignment == LegendHorizontalAlignment.CENTER ?
? 0.1 : this.mViewPortHandler.contentTop(); 0.1 : this.mViewPortHandler.contentTop();
posY += yoffset; posY += yoffset;
break; break;
} }
case LegendVerticalAlignment.BOTTOM: { case LegendVerticalAlignment.BOTTOM: {
posY = posY =
horizontalAlignment == LegendHorizontalAlignment.CENTER horizontalAlignment == LegendHorizontalAlignment.CENTER ?
? this.mViewPortHandler.getChartHeight() this.mViewPortHandler.getChartHeight() :
: this.mViewPortHandler.contentBottom(); this.mViewPortHandler.contentBottom();
posY -= this.mLegend.mNeededHeight + yoffset; posY -= this.mLegend.mNeededHeight + yoffset;
break; break;
} }

View File

@ -343,9 +343,9 @@ export default class XAxisRenderer extends AxisRenderer {
public renderLimitLines(): Paint[] { public renderLimitLines(): Paint[] {
let limitLines: JArrayList<LimitLine> = this.mXAxis.getLimitLines(); let limitLines: JArrayList<LimitLine> = this.mXAxis.getLimitLines();
if (limitLines == null if (limitLines == null ||
|| limitLines.size() <= 0 limitLines.size() <= 0 ||
|| !this.mAxis.isDrawLimitLinesBehindDataEnabled()) { !this.mAxis.isDrawLimitLinesBehindDataEnabled()) {
return []; return [];
} }

View File

@ -93,7 +93,7 @@ export struct Report {
}) })
} }
} }
}, item => JSON.stringify(item)) }, item => item.toString())
} }
.edgeEffect(EdgeEffect.None) // 滑动到边缘无效果 .edgeEffect(EdgeEffect.None) // 滑动到边缘无效果
.chainAnimation(false) // 联动特效关闭 .chainAnimation(false) // 联动特效关闭