mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-11-23 06:50:12 +00:00
commit
ebbe5e28fd
@ -29,8 +29,8 @@ void ByTrace::SetTraceConfig(int mSum, int mInterval, long long mThreshold, int
|
||||
threshold = mThreshold;
|
||||
lowfps = mLowfps;
|
||||
curNum = mCurNum;
|
||||
LOGI("ByTrace::SetTraceConfig mSum(%d) mInterval(%d) mThreshold(%lld) mLowfps(%d) mCurNum(%d)", mSum, mInterval,
|
||||
mThreshold, mLowfps, mCurNum);
|
||||
LOGD("ByTrace::SetTraceConfig mSum(%d) mInterval(%d) mThreshold(%lld) mLowfps(%d) mCurNum(%d)",
|
||||
mSum, mInterval, mThreshold, mLowfps, mCurNum);
|
||||
}
|
||||
void ByTrace::ThreadGetTrace() const
|
||||
{
|
||||
@ -45,7 +45,7 @@ void ByTrace::ThreadGetTrace() const
|
||||
std::string traceFile = "/data/local/tmp/sptrace_" + time + ".ftrace";
|
||||
std::string traceCmdExe = cmdString + traceFile;
|
||||
SPUtils::LoadCmd(traceCmdExe, result);
|
||||
LOGI("TRACE threadGetTrace CMD(%s)", traceCmdExe.c_str());
|
||||
LOGD("TRACE threadGetTrace CMD(%s)", traceCmdExe.c_str());
|
||||
}
|
||||
TraceStatus ByTrace::CheckFpsJitters(std::vector<long long> jitters, int cfps) const
|
||||
{
|
||||
|
@ -81,14 +81,14 @@ std::map<std::string, std::string> CPU::ItemData()
|
||||
}
|
||||
}
|
||||
|
||||
LOGI("CPU::ItemData map size(%u)", result.size());
|
||||
LOGD("CPU::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
void CPU::SetPackageName(const std::string &pName)
|
||||
{
|
||||
packageName = pName;
|
||||
LOGI("CPU SetPackageName name(%s)", pName.c_str());
|
||||
LOGD("CPU SetPackageName name(%s)", pName.c_str());
|
||||
}
|
||||
|
||||
void CPU::SetProcessId(const std::string &pid)
|
||||
@ -107,8 +107,8 @@ std::vector<CpuFreqs> CPU::GetCpuFreq()
|
||||
cpuFreqs.cpuId = cpufreq[i].cpuId;
|
||||
cpuFreqs.curFreq = cpufreq[i].curFreq;
|
||||
cpuFrequency.push_back(cpuFreqs);
|
||||
LOGI("cpuFreqs.cpuId: %s", std::to_string(cpufreq[i].cpuId).c_str());
|
||||
LOGI("cpuFreqs.curFreq: %s", std::to_string(cpufreq[i].curFreq).c_str());
|
||||
LOGD("cpuFreqs.cpuId: %s, cpuFreqs.curFreq: %s",
|
||||
std::to_string(cpufreq[i].cpuId).c_str(), std::to_string(cpufreq[i].curFreq).c_str());
|
||||
}
|
||||
return cpuFrequency;
|
||||
}
|
||||
@ -133,14 +133,12 @@ std::vector<CpuUsageInfos> CPU::GetCpuUsage()
|
||||
cpuUsageInfos.irqUsage = cpuInfo.irqUsage;
|
||||
cpuUsageInfos.softIrqUsage = cpuInfo.softIrqUsage;
|
||||
workload.push_back(cpuUsageInfos);
|
||||
LOGI("UsageCpuId: %s", cpuInfo.cpuId.c_str());
|
||||
LOGI("userUsage: %s", std::to_string(cpuInfo.userUsage).c_str());
|
||||
LOGI("niceUsage: %s", std::to_string(cpuInfo.niceUsage).c_str());
|
||||
LOGI("systemUsage: %s", std::to_string(cpuInfo.systemUsage).c_str());
|
||||
LOGI("idleUsage: %s", std::to_string(cpuInfo.idleUsage).c_str());
|
||||
LOGI("ioWaitUsage: %s", std::to_string(cpuInfo.ioWaitUsage).c_str());
|
||||
LOGI("irqUsage: %s", std::to_string(cpuInfo.irqUsage).c_str());
|
||||
LOGI("softIrqUsage: %s", std::to_string(cpuInfo.softIrqUsage).c_str());
|
||||
LOGD("UsageCpuId: %s, userUsage: %s, niceUsage: %s, systemUsage: %s",
|
||||
"idleUsage: %s, ioWaitUsage: %s, irqUsage: %s, softIrqUsage: %s",
|
||||
cpuInfo.cpuId.c_str(), std::to_string(cpuInfo.userUsage).c_str(),
|
||||
std::to_string(cpuInfo.niceUsage).c_str(), std::to_string(cpuInfo.systemUsage).c_str(),
|
||||
std::to_string(cpuInfo.idleUsage).c_str(), std::to_string(cpuInfo.ioWaitUsage).c_str(),
|
||||
std::to_string(cpuInfo.irqUsage).c_str(), std::to_string(cpuInfo.softIrqUsage).c_str());
|
||||
}
|
||||
return workload;
|
||||
}
|
||||
@ -161,12 +159,10 @@ std::map<std::string, std::string> CPU::GetSysProcessCpuLoad() const
|
||||
processCpuInfo["ProcCpuUsage"] = std::to_string(data.cpuUsage * oneHundred);
|
||||
processCpuInfo["ProcUCpuUsage"] = std::to_string(data.uCpuUsage * oneHundred);
|
||||
processCpuInfo["ProcSCpuUsage"] = std::to_string(data.sCpuUsage * oneHundred);
|
||||
LOGI("ProcId: %s", std::to_string(data.pid).c_str());
|
||||
LOGI("ProcAppName: %s", data.procName.c_str());
|
||||
LOGI("ProcCpuLoad: %s", std::to_string(data.cpuLoad).c_str());
|
||||
LOGI("ProcCpuUsage: %s", std::to_string(data.cpuUsage).c_str());
|
||||
LOGI("ProcUCpuUsage: %s", std::to_string(data.uCpuUsage).c_str());
|
||||
LOGI("ProcSCpuUsage: %s", std::to_string(data.sCpuUsage).c_str());
|
||||
LOGD("ProcId: %s, ProcAppName: %s, ProcCpuLoad: %s, ProcCpuUsage: %s, ProcUCpuUsage: %s, ProcSCpuUsage: %s",
|
||||
std::to_string(data.pid).c_str(), data.procName.c_str(), std::to_string(data.cpuLoad).c_str(),
|
||||
std::to_string(data.cpuUsage).c_str(), std::to_string(data.uCpuUsage).c_str(),
|
||||
std::to_string(data.sCpuUsage).c_str());
|
||||
} else {
|
||||
processCpuInfo["ProcId"] = "NA";
|
||||
processCpuInfo["ProcAppName"] = packageName;
|
||||
|
@ -55,7 +55,7 @@ std::map<std::string, std::string> Capture::ItemData()
|
||||
}
|
||||
result["capture"] = path;
|
||||
|
||||
LOGI("Capture::ItemData map size(%u)", result.size());
|
||||
LOGD("Capture::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -76,16 +76,16 @@ void Capture::ThreadGetCatch()
|
||||
if (!SPUtils::FileAccess(captureDir)) {
|
||||
std::string capturePath = CMD_COMMAND_MAP.at(CmdCommand::CREAT_DIR) + captureDir;
|
||||
if (!SPUtils::LoadCmd(capturePath, cmdResult)) {
|
||||
LOGI("%s capture not be created!", captureDir.c_str());
|
||||
LOGE("%s capture not be created!", captureDir.c_str());
|
||||
return;
|
||||
} else {
|
||||
LOGI("%s created successfully!", captureDir.c_str());
|
||||
LOGD("%s created successfully!", captureDir.c_str());
|
||||
}
|
||||
};
|
||||
std::ostringstream errorRecv;
|
||||
auto fd = open(savePath.c_str(), O_RDWR | O_CREAT, 0666);
|
||||
if (fd == -1) {
|
||||
LOGI("Failed to open file: %s", savePath.c_str());
|
||||
LOGE("Failed to open file: %s", savePath.c_str());
|
||||
}
|
||||
if (!TakeScreenCap(savePath)) {
|
||||
LOGE("Screen Capture Failed!");
|
||||
@ -102,10 +102,10 @@ void Capture::ThreadGetCatchSocket(const std::string &captureTime) const
|
||||
if (!SPUtils::FileAccess(captureDir)) {
|
||||
std::string capturePath = CMD_COMMAND_MAP.at(CmdCommand::CREAT_DIR) + captureDir;
|
||||
if (!SPUtils::LoadCmd(capturePath, cmdResult)) {
|
||||
LOGI("%s capture not be created!", captureDir.c_str());
|
||||
LOGE("%s capture not be created!", captureDir.c_str());
|
||||
return;
|
||||
} else {
|
||||
LOGI("%s created successfully!", captureDir.c_str());
|
||||
LOGD("%s created successfully!", captureDir.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
@ -114,13 +114,13 @@ void Capture::ThreadGetCatchSocket(const std::string &captureTime) const
|
||||
std::cout << "" << std::endl;
|
||||
}
|
||||
|
||||
auto fd = open(realPath, O_RDWR | O_CREAT, 0644);
|
||||
auto fd = open(savePath.c_str(), O_RDWR | O_CREAT, 0644);
|
||||
if (fd == -1) {
|
||||
LOGI("Failed to open file: %s", savePath.c_str());
|
||||
LOGE("Failed to open file: %s", savePath.c_str());
|
||||
}
|
||||
std::string snapshot = CMD_COMMAND_MAP.at(CmdCommand::SNAPSHOT);
|
||||
if (!SPUtils::LoadCmd(snapshot + savePath, cmdResult)) {
|
||||
LOGI("snapshot_display command failed!");
|
||||
LOGE("snapshot_display command failed!");
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ std::map<std::string, std::string> DDR::ItemData()
|
||||
if (result.find("ddrFrequency") != result.end() && result["ddrFrequency"].empty()) {
|
||||
result["ddrFrequency"] = "NA";
|
||||
}
|
||||
LOGI("DDR::ItemData map size(%u)", result.size());
|
||||
LOGD("DDR::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
long long DDR::GetDdrFreq()
|
||||
|
@ -25,14 +25,12 @@ void Dubai::DumpDubaiBegin()
|
||||
std::string result;
|
||||
std::string dumpBubaiB = HIDUMPER_CMD_MAP.at(HidumperCmd::DUMPER_DUBAI_B);
|
||||
SPUtils::LoadCmd(dumpBubaiB, result);
|
||||
LOGI("Dubai::DumpDubaiBegin");
|
||||
}
|
||||
void Dubai::DumpDubaiFinish()
|
||||
{
|
||||
std::string result;
|
||||
std::string dumpBubaiF = HIDUMPER_CMD_MAP.at(HidumperCmd::DUMPER_DUBAI_F);
|
||||
SPUtils::LoadCmd(dumpBubaiF, result);
|
||||
LOGI("Dubai::DumpDubaiFinish");
|
||||
}
|
||||
|
||||
void Dubai::MoveDubaiDb()
|
||||
@ -44,8 +42,8 @@ void Dubai::MoveDubaiDb()
|
||||
const std::string PkgEntry = "/entry/rdb";
|
||||
const std::string cpDubai = "cp -r " + dubaiXpower + XpowerDb + " " + Database + dubaiPkgName + PkgEntry;
|
||||
const std::string dubaiPathChmod = "chmod 777 " + Database + dubaiPkgName + PkgEntry + XpowerDb;
|
||||
LOGI("cpDubai: (%s)", cpDubai.c_str());
|
||||
LOGI("dubaiPathChmod: (%s)", dubaiPathChmod.c_str());
|
||||
LOGD("cpDubai: (%s), dubaiPathChmod: (%s)",
|
||||
cpDubai.c_str(), dubaiPathChmod.c_str());
|
||||
SPUtils::LoadCmd(cpDubai, result);
|
||||
SPUtils::LoadCmd(dubaiPathChmod, result);
|
||||
}
|
||||
@ -54,7 +52,6 @@ void Dubai::CallBeginAndFinish()
|
||||
{
|
||||
DumpDubaiBegin();
|
||||
DumpDubaiFinish();
|
||||
LOGI("Dubai::CallBeginAndFinish");
|
||||
}
|
||||
|
||||
std::string Dubai::CallMoveDubaiDbFinished()
|
||||
@ -62,7 +59,6 @@ std::string Dubai::CallMoveDubaiDbFinished()
|
||||
std::string dubaiMoveFinish;
|
||||
if (isDumpDubaiFinish) {
|
||||
MoveDubaiDb();
|
||||
LOGI("Dubai::MoveDubaiDbFinished");
|
||||
}
|
||||
dubaiMoveFinish = "get_dubai_db";
|
||||
return dubaiMoveFinish;
|
||||
|
@ -56,8 +56,6 @@ std::map<std::string, std::string> FPS::ItemData()
|
||||
fpsInfoResult.fps = fullFrame;
|
||||
}
|
||||
result["fps"] = std::to_string(fpsInfoResult.fps);
|
||||
LOGI("result.fps: %s", std::to_string(fpsInfoResult.fps).c_str());
|
||||
LOGI("result.curTime: %s", std::to_string(fpsInfoResult.curTime).c_str());
|
||||
std::string jitterStr = "";
|
||||
std::string split = "";
|
||||
for (size_t i = 0; i < fpsInfoResult.jitters.size(); i++) {
|
||||
@ -67,7 +65,10 @@ std::map<std::string, std::string> FPS::ItemData()
|
||||
jitterStr += split + std::to_string(fpsInfoResult.jitters[i]);
|
||||
}
|
||||
result["fpsJitters"] = jitterStr;
|
||||
LOGI("result.jitters: %s", jitterStr.c_str());
|
||||
LOGD("result.fps: %s, result.curTime: %s, result.jitters: %s",
|
||||
std::to_string(fpsInfoResult.fps).c_str(),
|
||||
std::to_string(fpsInfoResult.curTime).c_str(),
|
||||
jitterStr.c_str());
|
||||
SetFpsCurrentFpsTime(fpsInfoResult);
|
||||
}
|
||||
return result;
|
||||
@ -127,7 +128,7 @@ FpsInfo FPS::GetFpsInfo()
|
||||
OHOS::SmartPerf::SPUtils::GetCurrentTime(fifty, prevResultFpsInfo.curTime);
|
||||
fpsInfoMax = GetSurfaceFrame(uniteLayer);
|
||||
} else {
|
||||
LOGI("FPS:app is in the background");
|
||||
LOGE("FPS:app is in the background");
|
||||
if (processId.empty()) {
|
||||
processFlag = true;
|
||||
fpsInfoMax.Clear();
|
||||
@ -184,13 +185,12 @@ void FPS::ReadDataFromPipe(int fd)
|
||||
char tmp[1024];
|
||||
fpsNum = 0;
|
||||
prevScreenTimestamp = -1;
|
||||
LOGI("FPS::dump time: start!");
|
||||
struct timespec time1 = { 0 };
|
||||
clock_gettime(CLOCK_MONOTONIC, &time1);
|
||||
fpsInfo.curTime = static_cast<int>(time1.tv_sec - 1);
|
||||
fpsInfo.currTimeDump = (time1.tv_sec - 1) * mod + time1.tv_nsec;
|
||||
LOGI("FPS:fpsInfo.curTime: %d", fpsInfo.curTime);
|
||||
LOGI("FPS:psInfo.currTimeDump: %lld", fpsInfo.currTimeDump);
|
||||
LOGD("FPS:fpsInfo.curTime: %d, FPS:psInfo.currTimeDump: %lld",
|
||||
fpsInfo.curTime, fpsInfo.currTimeDump);
|
||||
FILE *fp = fdopen(fd, "r");
|
||||
if (!fp) {
|
||||
LOGE("FPS::Failed to open file descriptor");
|
||||
|
@ -43,7 +43,7 @@ std::map<std::string, std::string> GPU::ItemData()
|
||||
result["gpuFrequency"] = "NA";
|
||||
result["gpuLoad"] = "NA";
|
||||
}
|
||||
LOGI("GPU::ItemData map size(%u)", result.size());
|
||||
LOGD("GPU::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ int GPU::GetGpuFreq()
|
||||
{
|
||||
std::shared_ptr<GpuCollector> collector = GpuCollector::Create();
|
||||
CollectResult<GpuFreq> result = collector->CollectGpuFrequency();
|
||||
LOGI("GpuFrequency: %s", std::to_string(result.data.curFeq).c_str());
|
||||
LOGD("GpuFrequency: %s", std::to_string(result.data.curFeq).c_str());
|
||||
return result.data.curFeq;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ float GPU::GetGpuLoad()
|
||||
{
|
||||
std::shared_ptr<GpuCollector> collector = GpuCollector::Create();
|
||||
CollectResult<SysGpuLoad> result = collector->CollectSysGpuLoad();
|
||||
LOGI("SysGpuLoad: %s", std::to_string(result.data.gpuLoad).c_str());
|
||||
LOGD("SysGpuLoad: %s", std::to_string(result.data.gpuLoad).c_str());
|
||||
return float(result.data.gpuLoad);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace OHOS {
|
||||
|
||||
void* handle = dlopen(soFilePathChar, RTLD_LAZY);
|
||||
if (!handle) {
|
||||
LOGI("open GpuCounterPlugin so file error.");
|
||||
LOGE("open GpuCounterPlugin so file error.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -65,15 +65,12 @@ namespace OHOS {
|
||||
int ret = startGetGpuPerfInfo()->StartGetGpuPerfInfo(duration, std::move(gpuCounterCallback));
|
||||
if (ret == 0) {
|
||||
gcStatus = GC_RUNNING;
|
||||
LOGI("GpuCounter collect start.");
|
||||
} else {
|
||||
LOGE("GpuCounter call gameService error, ret = %d", ret);
|
||||
}
|
||||
} else if (type == GC_RESTART && gcStatus == GC_RUNNING) {
|
||||
int ret = startGetGpuPerfInfo()->StartGetGpuPerfInfo(duration, std::move(gpuCounterCallback));
|
||||
if (ret == 0) {
|
||||
LOGI("GpuCounter recollect start.");
|
||||
} else {
|
||||
if (ret != 0) {
|
||||
LOGE("GpuCounter call gameService error, ret = %d", ret);
|
||||
}
|
||||
} else {
|
||||
@ -86,7 +83,6 @@ namespace OHOS {
|
||||
if (gcStatus != GC_RUNNING || gpuCounterData.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
LOGI("GpuCounter collect stop.");
|
||||
char gpuCounterDataDirChar[PATH_MAX] = {0x00};
|
||||
if (realpath(path.c_str(), gpuCounterDataDirChar) == nullptr) {
|
||||
LOGE("data dir %s is nullptr", path.c_str());
|
||||
@ -177,7 +173,6 @@ namespace OHOS {
|
||||
int ret = startGetGpuPerfInfo()->StopGetGpuPerfInfo();
|
||||
if (ret == 0) {
|
||||
gcStatus = GC_INIT;
|
||||
LOGI("GpuCounter collect finish.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,6 @@ namespace OHOS {
|
||||
}
|
||||
|
||||
if (gpuPerfInfos[0].remainTime <= restartTime) {
|
||||
LOGI("remain time to restart");
|
||||
gpuCounterInstance.StartCollect(GpuCounter::GC_RESTART);
|
||||
}
|
||||
return 0;
|
||||
|
@ -33,7 +33,7 @@ namespace SmartPerf {
|
||||
std::map<std::string, std::string> Network::ItemData()
|
||||
{
|
||||
std::map<std::string, std::string> result = Network::GetNetworkInfo();
|
||||
LOGI("Network ItemData map siez=%u", result.size());
|
||||
LOGD("Network ItemData map siez=%u", result.size());
|
||||
if (result.find("networkUp") != result.end() && result["networkUp"].empty()) {
|
||||
result["networkUp"] = "NA";
|
||||
}
|
||||
|
@ -34,12 +34,10 @@ std::map<std::string, std::string> Power::ItemData()
|
||||
if (result.find("voltageNow") != result.end() && result["voltageNow"].empty()) {
|
||||
result["voltageNow"] = "NA";
|
||||
}
|
||||
LOGI("currentNow: %s", currentNow.c_str());
|
||||
LOGI("voltageNow: %s", voltageNow.c_str());
|
||||
LOGI("Power::ItemData map size(%u)", result.size());
|
||||
LOGD("Power::ItemData map size(%u)", result.size());
|
||||
} else {
|
||||
result["failed"] = "RK does not support power acquisition";
|
||||
LOGI("failed:RK does not support power acquisition");
|
||||
LOGE("failed:RK does not support power acquisition");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ std::map<std::string, std::string> RAM::ItemData()
|
||||
result.insert(*it);
|
||||
}
|
||||
}
|
||||
LOGI("RAM::ItemData map size(%u)", result.size());
|
||||
LOGD("RAM::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ std::map<std::string, std::string> Temperature::ItemData()
|
||||
struct dirent *dirp;
|
||||
std::vector<std::string> dirs;
|
||||
if (dp == nullptr) {
|
||||
std::cout << "Open directory failed!" << std::endl;
|
||||
LOGE("Open directory failed!");
|
||||
}
|
||||
while ((dirp = readdir(dp)) != nullptr) {
|
||||
if (strcmp(dirp->d_name, ".") != 0 && strcmp(dirp->d_name, "..") != 0) {
|
||||
@ -39,9 +39,7 @@ std::map<std::string, std::string> Temperature::ItemData()
|
||||
std::map<std::string, std::string> result;
|
||||
for (auto dir : dirs) {
|
||||
std::string dirType = dir + "/type";
|
||||
LOGI("dirType====: %s", dirType.c_str());
|
||||
std::string dirTemp = dir + "/temp";
|
||||
LOGI("dirTemp====: %s", dirTemp.c_str());
|
||||
|
||||
if (!SPUtils::FileAccess(dirType)) {
|
||||
continue;
|
||||
@ -53,9 +51,7 @@ std::map<std::string, std::string> Temperature::ItemData()
|
||||
SPUtils::LoadFile(dirTemp, temp);
|
||||
for (auto node : collectNodes) {
|
||||
if (type.find(node) != std::string::npos) {
|
||||
LOGI("type====: %s", type.c_str());
|
||||
float t = SPUtilesTye::StringToSometype<float>(temp);
|
||||
LOGI("temp====: %s", temp.c_str());
|
||||
if (node == "gpu") {
|
||||
result[type] = std::to_string(t);
|
||||
} else {
|
||||
@ -65,7 +61,7 @@ std::map<std::string, std::string> Temperature::ItemData()
|
||||
}
|
||||
}
|
||||
|
||||
LOGI("Temperature::ItemData map size(%u)", result.size());
|
||||
LOGD("Temperature::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ int ClientControl::SocketStart(const std::string &args)
|
||||
OHOS::SmartPerf::StartUpDelay sd;
|
||||
sd.GetSpClear();
|
||||
}
|
||||
LOGI("ClientControl::SocketStart() OK");
|
||||
return 0;
|
||||
}
|
||||
int ClientControl::SocketStop()
|
||||
@ -74,7 +73,6 @@ int ClientControl::SocketStop()
|
||||
} else {
|
||||
std::cout << "SP_daemon Collection ended failed" << std::endl;
|
||||
}
|
||||
LOGI("ClientControl::SocketStop() OK");
|
||||
return 0;
|
||||
}
|
||||
int ClientControl::InitSocket()
|
||||
@ -93,7 +91,6 @@ int ClientControl::InitSocket()
|
||||
LOGE("Failed to connect to server");
|
||||
return 1;
|
||||
}
|
||||
LOGI("ClientControl::InitSocket() OK");
|
||||
return 0;
|
||||
}
|
||||
void ClientControl::StartSPDaemon() const
|
||||
@ -102,14 +99,12 @@ void ClientControl::StartSPDaemon() const
|
||||
std::string server = CMD_COMMAND_MAP.at(CmdCommand::SERVER);
|
||||
SPUtils::LoadCmd(server, result);
|
||||
sleep(1);
|
||||
LOGI("ClientControl::StartSPDaemon() OK");
|
||||
}
|
||||
int ClientControl::CloseSocket()
|
||||
{
|
||||
shutdown(clientSocket, SHUT_RD);
|
||||
close(clientSocket);
|
||||
clientSocket = -1;
|
||||
LOGI("ClientControl::CloseSocket() OK");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -52,11 +52,8 @@ void Heartbeat::HeartbeatRule()
|
||||
{
|
||||
while (isrunning) {
|
||||
auto end = std::chrono::steady_clock::now();
|
||||
LOGI("endTime: %lld", std::chrono::time_point_cast<std::chrono::microseconds>(end).time_since_epoch().count());
|
||||
auto duration = std::chrono::duration_cast<std::chrono::seconds>(end - updateStart).count();
|
||||
LOGI("ListeningTimeJitter: %lld", duration);
|
||||
if (duration > timeout) {
|
||||
LOGI("connect timeout have Disconnected successfully!");
|
||||
KillSpId();
|
||||
}
|
||||
sleep(checkMessageTime);
|
||||
@ -67,7 +64,6 @@ void Heartbeat::UpdatestartTime()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
updateStart = std::chrono::steady_clock::now();
|
||||
LOGI("Listening to messages from edtior or device");
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
|
@ -56,16 +56,13 @@ public:
|
||||
void Process(ProtoType type) const
|
||||
{
|
||||
std::cout << "Socket Process called!" << std::endl;
|
||||
LOGI("Socket Process called!");
|
||||
SpServerSocket spSocket;
|
||||
spSocket.Init(type);
|
||||
if (type == ProtoType::TCP) {
|
||||
std::cout << "Socket TCP Init called!" << std::endl;
|
||||
LOGI("Socket TCP Init called!");
|
||||
TypeTcp(spSocket);
|
||||
}
|
||||
if (type == ProtoType::UDP || type == ProtoType::UDPEX) {
|
||||
LOGI("Socket UDP Init called! type(%d)", static_cast<int>(type));
|
||||
SocketHeartbeat();
|
||||
while (1) {
|
||||
spSocket.Recvfrom();
|
||||
@ -73,7 +70,6 @@ public:
|
||||
}
|
||||
}
|
||||
std::cout << "Socket Process finished!" << std::endl;
|
||||
LOGI("Socket Process finished!");
|
||||
spSocket.Close();
|
||||
}
|
||||
void TypeTcp(SpServerSocket &spSocket) const
|
||||
@ -100,18 +96,17 @@ public:
|
||||
std::string errorInfo;
|
||||
std::string checkStr = recvStr.substr(std::string("init::").length());
|
||||
if (!SPTask::GetInstance().CheckTcpParam(checkStr, errorInfo)) {
|
||||
LOGE("init error(%s) recvStr(%s)", errorInfo.c_str(), recvStr.c_str());
|
||||
LOGD("init error(%s) recvStr(%s)", errorInfo.c_str(), recvStr.c_str());
|
||||
spSocket.Send("init::False,\"error\":" + errorInfo);
|
||||
return;
|
||||
}
|
||||
ErrCode code = SPTask::GetInstance().InitTask(SplitMsg(recvStr));
|
||||
LOGI("init::%s", (code == ErrCode::OK) ? "True" : "False");
|
||||
LOGD("init::%s", (code == ErrCode::OK) ? "True" : "False");
|
||||
spSocket.Send(std::string("init::") + ((code == ErrCode::OK) ? "True" : "False"));
|
||||
}
|
||||
void StartRecv(SpServerSocket &spSocket) const
|
||||
{
|
||||
if (flagRunning) {
|
||||
LOGI("SP_daemon is running");
|
||||
spSocket.Send("SP_daemon is running");
|
||||
return;
|
||||
}
|
||||
@ -120,7 +115,7 @@ public:
|
||||
};
|
||||
ErrCode code = SPTask::GetInstance().StartTask(lambdaTask);
|
||||
SPTask::GetInstance().StartRecord();
|
||||
LOGI("start:::%s", (code == ErrCode::OK) ? "True" : "False");
|
||||
LOGD("start:::%s", (code == ErrCode::OK) ? "True" : "False");
|
||||
if (code == ErrCode::OK) {
|
||||
spSocket.Send("start::True");
|
||||
flagRunning = true;
|
||||
@ -132,7 +127,7 @@ public:
|
||||
{
|
||||
auto lambdaTask = [&spSocket](const std::string &data) { spSocket.Send(data); };
|
||||
ErrCode code = SPTask::GetInstance().StartTask(lambdaTask);
|
||||
LOGI("start::%s", (code == ErrCode::OK) ? "True" : "False");
|
||||
LOGD("start::%s", (code == ErrCode::OK) ? "True" : "False");
|
||||
if (code == ErrCode::OK) {
|
||||
spSocket.Send("start::True");
|
||||
} else if (code == ErrCode::FAILED) {
|
||||
@ -142,14 +137,12 @@ public:
|
||||
void StopRecvRealtime(SpServerSocket &spSocket) const
|
||||
{
|
||||
SPTask::GetInstance().StopTask();
|
||||
LOGI("stop::True");
|
||||
spSocket.Send("stop::True");
|
||||
flagRunning = false;
|
||||
spSocket.Close();
|
||||
}
|
||||
void StartRecvRecord(SpServerSocket &spSocket) const
|
||||
{
|
||||
LOGI("startRecord::True");
|
||||
SPTask::GetInstance().StartRecord();
|
||||
SPTask::GetInstance().SaveScreenShot();
|
||||
|
||||
@ -157,7 +150,6 @@ public:
|
||||
}
|
||||
void StopRecvRecord(SpServerSocket &spSocket) const
|
||||
{
|
||||
LOGI("stopRecord::True");
|
||||
SPTask::GetInstance().StopRecord();
|
||||
|
||||
spSocket.Send("stopRecord::True");
|
||||
@ -240,7 +232,7 @@ public:
|
||||
}
|
||||
HandleUDPMsg(spSocket, data, retCode, iterator);
|
||||
}
|
||||
LOGI("sendData key(%d) content(%s)", iterator->first, retCode.c_str());
|
||||
LOGD("sendData key(%d) content(%s)", iterator->first, retCode.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -345,7 +337,7 @@ public:
|
||||
} else {
|
||||
retCode = iterator->second;
|
||||
spSocket.Sendto(retCode);
|
||||
LOGI("UDP sendData: (%s)", retCode.c_str());
|
||||
LOGD("UDP sendData: (%s)", retCode.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ namespace SmartPerf {
|
||||
std::map<std::string, std::string> Navigation::ItemData()
|
||||
{
|
||||
std::map<std::string, std::string> result = Navigation::GetNavInfo();
|
||||
LOGI("Navigation::ItemData map size(%u)", result.size());
|
||||
LOGD("Navigation::ItemData map size(%u)", result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,6 @@ std::string ParseRadar::ParseRadarAppStrart(const std::string &string) const
|
||||
"ms\n"
|
||||
"CompleteTime:" +
|
||||
streamComplete.str() + "ms\n";
|
||||
LOGI("Radar.result====: %s", result.c_str());
|
||||
return result;
|
||||
}
|
||||
double ParseRadar::ParseRadarResponse(const std::string &string) const
|
||||
@ -149,7 +148,6 @@ std::string ParseRadar::ParseRadarFrame(const std::string &string) const
|
||||
}
|
||||
std::string ParseRadar::ExtractString(const std::string &str, const std::string &target) const
|
||||
{
|
||||
LOGI("Radar.str: %s", str.c_str());
|
||||
size_t pos = str.find(target);
|
||||
if (pos != std::string::npos) {
|
||||
pos += target.length();
|
||||
|
@ -50,21 +50,21 @@ double ParseSlideFpsTrace::CalculateTime()
|
||||
needTime = true;
|
||||
frameNow = 0;
|
||||
touchTime = SPUtilesTye::StringToSometype<double>(ParseSlideFpsTrace::GetLineTime(line));
|
||||
LOGI("ParseSlideFpsTrace::touchTime: (%s)", std::to_string(touchTime).c_str());
|
||||
LOGD("ParseSlideFpsTrace::touchTime: (%s)", std::to_string(touchTime).c_str());
|
||||
swiperFlingFlag = 0;
|
||||
}
|
||||
} else if (line.find("H:RSMainThread::DoComposition") != std::string::npos) {
|
||||
frameNow++;
|
||||
doCompositionTime = SPUtilesTye::StringToSometype<double>(ParseSlideFpsTrace::GetLineTime(line));
|
||||
LOGI("ParseSlideFpsTrace::doCompositionTime: (%s)", std::to_string(doCompositionTime).c_str());
|
||||
LOGD("ParseSlideFpsTrace::doCompositionTime: (%s)", std::to_string(doCompositionTime).c_str());
|
||||
} else if (line.find("H:WEB_LIST_FLING") != std::string::npos ||
|
||||
line.find("H:APP_LIST_FLING,") != std::string::npos) {
|
||||
listFlag++;
|
||||
if (listFlag == two) {
|
||||
completeTime = doCompositionTime;
|
||||
LOGI("ParseSlideFpsTrace::completeTime: (%s)", std::to_string(completeTime).c_str());
|
||||
frameNum = frameNow;
|
||||
LOGI("ParseSlideFpsTrace::frameNum: (%d)", frameNum);
|
||||
LOGD("ParseSlideFpsTrace::completeTime: (%s), ParseSlideFpsTrace::frameNum: (%d)",
|
||||
std::to_string(completeTime).c_str(), frameNum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ void ParseSlideFpsTrace::AppSwiperScroll(std::string line)
|
||||
if (line.find("H:APP_SWIPER_SCROLL,") != std::string::npos) {
|
||||
if (swiperScrollFlag == 0) {
|
||||
touchTime = SPUtilesTye::StringToSometype<double>(ParseSlideFpsTrace::GetLineTime(line));
|
||||
LOGI("AppSwiperScroll.touchTime: (%s)", std::to_string(touchTime).c_str());
|
||||
LOGD("AppSwiperScroll.touchTime: (%s)", std::to_string(touchTime).c_str());
|
||||
needTime = true;
|
||||
swiperScrollFlag = 1;
|
||||
}
|
||||
@ -102,9 +102,9 @@ void ParseSlideFpsTrace::AppSwiperScroll(std::string line)
|
||||
if (line.find("H:APP_SWIPER_FLING,") != std::string::npos) {
|
||||
if (swiperFlingFlag == 1) {
|
||||
completeTime = doCompositionTime;
|
||||
LOGI("AppSwiperScroll.completeTime: (%s)", std::to_string(completeTime).c_str());
|
||||
frameNum = frameNow;
|
||||
LOGI("AppSwiperScroll.frameNum: (%d)", frameNum);
|
||||
LOGD("AppSwiperScroll.completeTime: (%s), AppSwiperScroll.frameNum: (%d)",
|
||||
std::to_string(completeTime).c_str(), frameNum);
|
||||
}
|
||||
swiperFlingFlag++;
|
||||
}
|
||||
@ -112,7 +112,7 @@ void ParseSlideFpsTrace::AppSwiperScroll(std::string line)
|
||||
frameNow = 1;
|
||||
needTime = false;
|
||||
responseTime = doCompositionTime;
|
||||
LOGI("AppSwiperScroll.responseTime: (%s)", std::to_string(responseTime).c_str());
|
||||
LOGD("AppSwiperScroll.responseTime: (%s)", std::to_string(responseTime).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ std::map<std::string, std::string> ProfilerFPS::ItemData()
|
||||
finalResult.fps = fullFrame;
|
||||
}
|
||||
result["fps"] = std::to_string(finalResult.fps);
|
||||
LOGI("ProfilerFPS.result.fps: %s", std::to_string(finalResult.fps).c_str());
|
||||
LOGI("ProfilerFPS.result.curTime: %s", std::to_string(finalResult.curTime).c_str());
|
||||
LOGD("ProfilerFPS.result.fps: %s, ProfilerFPS.result.curTime: %s",
|
||||
std::to_string(finalResult.fps).c_str(), std::to_string(finalResult.curTime).c_str());
|
||||
std::string jitterStr = "";
|
||||
std::string split = "";
|
||||
for (size_t i = 0; i < finalResult.jitters.size(); i++) {
|
||||
@ -59,7 +59,7 @@ std::map<std::string, std::string> ProfilerFPS::ItemData()
|
||||
jitterStr += split + std::to_string(finalResult.jitters[i]);
|
||||
}
|
||||
result["fpsJitters"] = jitterStr;
|
||||
LOGI("ProfilerFPS.result.jitters: %s", jitterStr.c_str());
|
||||
LOGD("ProfilerFPS.result.jitters: %s", jitterStr.c_str());
|
||||
if (isCatchTrace > 0) {
|
||||
ByTrace::GetInstance().CheckFpsJitters(finalResult.jitters, finalResult.fps);
|
||||
}
|
||||
@ -110,15 +110,15 @@ void ProfilerFPS::GetResultFPS(int sectionsNum)
|
||||
}
|
||||
time_t now = time(nullptr);
|
||||
if (now == -1) {
|
||||
LOGI("Failed to get current time.");
|
||||
LOGE("Failed to get current time.");
|
||||
return;
|
||||
}
|
||||
char *dt = ctime(&now);
|
||||
LOGI("printf time is: %s", dt);
|
||||
LOGD("printf time is: %s", dt);
|
||||
fflush(stdout);
|
||||
gettimeofday(&end, nullptr);
|
||||
runTime = end.tv_sec * 1e6 - start.tv_sec * 1e6 + end.tv_usec - start.tv_usec;
|
||||
LOGI("printf time is runTime: %s", std::to_string(runTime).c_str());
|
||||
LOGD("printf time is runTime: %s", std::to_string(runTime).c_str());
|
||||
if (runTime < sleepTime) {
|
||||
usleep(sleepTime - runTime);
|
||||
}
|
||||
@ -283,7 +283,6 @@ FpsInfoProfiler ProfilerFPS::GetFpsInfo()
|
||||
uniteLayer = gameLayerName;
|
||||
isGameSurface = true;
|
||||
} else if (!rkFlag) {
|
||||
LOGI("uniteLayer is UniRender");
|
||||
uniteLayer = "UniRender";
|
||||
} else {
|
||||
ProfilerFPS &profilerFps = ProfilerFPS::GetInstance();
|
||||
@ -293,7 +292,7 @@ FpsInfoProfiler ProfilerFPS::GetFpsInfo()
|
||||
uniteLayer = GetSurface();
|
||||
}
|
||||
if (pkgName.empty() || pkgName.find("sceneboard") != std::string::npos || isGameSurface) {
|
||||
LOGI("ProfilerFPS.pkgName: %s", pkgName.c_str());
|
||||
LOGD("ProfilerFPS.pkgName: %s", pkgName.c_str());
|
||||
OHOS::SmartPerf::SPUtils::GetCurrentTime(fifty, lastFpsInfoResult.curTime);
|
||||
fpsInfoMax = GetSurfaceFrame(uniteLayer);
|
||||
} else {
|
||||
@ -302,7 +301,6 @@ FpsInfoProfiler ProfilerFPS::GetFpsInfo()
|
||||
OHOS::SmartPerf::SPUtils::GetCurrentTime(fifty, lastFpsInfoResult.curTime);
|
||||
fpsInfoMax = GetSurfaceFrame(uniteLayer);
|
||||
} else {
|
||||
LOGI("ProfilerFPS::app is in the background");
|
||||
if (processId.empty()) {
|
||||
processFlag = true;
|
||||
fpsInfoMax.Clear();
|
||||
@ -347,12 +345,11 @@ FpsInfoProfiler ProfilerFPS::GetFrameInfoFromMap(std::string name)
|
||||
}
|
||||
fpsNum = 0;
|
||||
prevScreenTimestamp = -1;
|
||||
LOGI("ProfilerFPS dump time: start!");
|
||||
struct timespec time1 = { 0 };
|
||||
clock_gettime(CLOCK_MONOTONIC, &time1);
|
||||
fpsInfo.curTime = static_cast<int>(time1.tv_sec - 1);
|
||||
fpsInfo.currTimeDump = (time1.tv_sec - 1) * mod + time1.tv_nsec;
|
||||
LOGI("ProfilerFPS fpsInfo.curTime: %d", fpsInfo.curTime);
|
||||
LOGD("ProfilerFPS fpsInfo.curTime: %d", fpsInfo.curTime);
|
||||
while (fgets(tmp, sizeof(tmp), fp) != nullptr) {
|
||||
std::string str(tmp);
|
||||
LOGD("ProfilerFPS dump time: %s", str.c_str());
|
||||
@ -369,7 +366,7 @@ FpsInfoProfiler ProfilerFPS::GetFrameInfoFromMap(std::string name)
|
||||
LOGE("Error: Failed to close file");
|
||||
return fpsInfo;
|
||||
}
|
||||
LOGI("ProfilerFPS fpsNum: %d", fpsNum);
|
||||
LOGD("ProfilerFPS fpsNum: %d", fpsNum);
|
||||
return fpsInfo;
|
||||
}
|
||||
|
||||
@ -451,7 +448,7 @@ std::string ProfilerFPS::GetGameLayer()
|
||||
std::string nodeIdStr;
|
||||
uint64_t nodeId;
|
||||
if (dumperSurface.empty()) {
|
||||
LOGI("ProfilerFPS::DUMPER_SURFACE failed");
|
||||
LOGE("ProfilerFPS::DUMPER_SURFACE failed");
|
||||
return gameLayer;
|
||||
}
|
||||
FILE *fd = popen(dumperSurface.c_str(), "r");
|
||||
@ -464,7 +461,7 @@ std::string ProfilerFPS::GetGameLayer()
|
||||
size_t endPos = line.find(end);
|
||||
if (startPos != std::string::npos && endPos != std::string::npos) {
|
||||
nodeIdStr = line.substr(startPos + start.length(), endPos - startPos - start.length());
|
||||
LOGI("ProfilerFPS::nodeIdStr: (%s)", nodeIdStr.c_str());
|
||||
LOGD("ProfilerFPS::nodeIdStr: (%s)", nodeIdStr.c_str());
|
||||
}
|
||||
const int kShiftAmount = 32;
|
||||
if (!nodeIdStr.empty()) {
|
||||
@ -474,7 +471,7 @@ std::string ProfilerFPS::GetGameLayer()
|
||||
return gameLayer;
|
||||
}
|
||||
nodeId = nodeId >> kShiftAmount;
|
||||
LOGI("ProfilerFPS::nodeId: (%d)", nodeId);
|
||||
LOGD("ProfilerFPS::nodeId: (%d)", nodeId);
|
||||
GetLayerName(gameLayer, nodeId, line, endPos);
|
||||
}
|
||||
}
|
||||
@ -482,7 +479,7 @@ std::string ProfilerFPS::GetGameLayer()
|
||||
LOGE("Error: Failed to close file");
|
||||
return gameLayer;
|
||||
}
|
||||
LOGI("ProfilerFPS::gameLayer: (%s)", gameLayer.c_str());
|
||||
LOGD("ProfilerFPS::gameLayer: (%s)", gameLayer.c_str());
|
||||
return gameLayer;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace OHOS {
|
||||
params.receiveFd[index] = -1;
|
||||
return "";
|
||||
}
|
||||
LOGI("Fd %d,%d, receove %s", index, params.receiveFd[index], receiveBuf);
|
||||
LOGD("Fd %d,%d, receove %s", index, params.receiveFd[index], receiveBuf);
|
||||
receiveBuffer = receiveBuf;
|
||||
|
||||
bool processFlag = true;
|
||||
|
@ -33,7 +33,7 @@ namespace OHOS {
|
||||
namespace SmartPerf {
|
||||
SmartPerfCommand::SmartPerfCommand(std::vector<std::string> argv)
|
||||
{
|
||||
LOGI("SmartPerfCommand::SmartPerfCommand size(%u)", argv.size());
|
||||
LOGD("SmartPerfCommand::SmartPerfCommand size(%u)", argv.size());
|
||||
if (argv.size() == oneParam) {
|
||||
OHOS::SmartPerf::StartUpDelay sd;
|
||||
sd.GetSpTcp();
|
||||
@ -66,12 +66,10 @@ SmartPerfCommand::SmartPerfCommand(std::vector<std::string> argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOGI("SmartPerfCommand::SmartPerfCommand complete");
|
||||
}
|
||||
void SmartPerfCommand::HelpCommand(CommandHelp type) const
|
||||
{
|
||||
LOGI("SmartPerfCommand::HelpCommand type(%d)", type);
|
||||
LOGD("SmartPerfCommand::HelpCommand type(%d)", type);
|
||||
if (type == CommandHelp::HELP) {
|
||||
std::cout << smartPerfMsg << std::endl;
|
||||
}
|
||||
@ -120,7 +118,7 @@ void SmartPerfCommand::CreateSocketThread() const
|
||||
}
|
||||
void SmartPerfCommand::HandleCommand(std::string argStr, const std::string &argStr1)
|
||||
{
|
||||
LOGI("SmartPerfCommand::HandleCommand argStr(%s) argStr1(%s)", argStr.c_str(), argStr1.c_str());
|
||||
LOGD("SmartPerfCommand::HandleCommand argStr(%s) argStr1(%s)", argStr.c_str(), argStr1.c_str());
|
||||
switch (COMMAND_MAP.at(argStr)) {
|
||||
case CommandType::CT_N:
|
||||
num = SPUtilesTye::StringToSometype<int>(argStr1.c_str());
|
||||
@ -250,9 +248,7 @@ std::string SmartPerfCommand::ExecCommand()
|
||||
SaveGpuCounter();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(freq));
|
||||
LOGI("SmartPerfCommand::WriteCsv start");
|
||||
SpCsvUtil::WriteCsv(std::string(outPath.c_str()), vmap);
|
||||
LOGI("SmartPerfCommand::WriteCsv finish");
|
||||
return std::string("command exec finished!");
|
||||
}
|
||||
void SmartPerfCommand::PrintfExecCommand(const std::map<std::string, std::string> data) const
|
||||
@ -279,7 +275,7 @@ void SmartPerfCommand::InitSomething()
|
||||
std::string cmdResult;
|
||||
std::string stat = CMD_COMMAND_MAP.at(CmdCommand::PROC_STAT);
|
||||
if (SPUtils::LoadCmd(stat, cmdResult)) {
|
||||
LOGI("SmartPerfCommand::InitSomething Privilege escalation!");
|
||||
LOGE("SmartPerfCommand::InitSomething Privilege escalation!");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ int SpServerSocket::Init(ProtoType type)
|
||||
}
|
||||
}
|
||||
|
||||
LOGI("SpServerSocket::Init OK,prot(%d)", sockPort);
|
||||
LOGD("SpServerSocket::Init OK,prot(%d)", sockPort);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ void SpServerSocket::Close()
|
||||
local.sin_port = htons(sockPort);
|
||||
local.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
if (::bind(sock, reinterpret_cast<struct sockaddr *>(&local), sizeof(local)) < 0) {
|
||||
LOGI("SpServerSocket::Init Socket Bind failed");
|
||||
LOGE("SpServerSocket::Init Socket Bind failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,6 +109,9 @@ int SpServerSocket::Recvfrom()
|
||||
int l = recvfrom(sock, rbuf, sizeof(rbuf) - 1, 0, reinterpret_cast<struct sockaddr *>(&client), &len);
|
||||
if (l > 0) {
|
||||
std::cout << "Client:" << rbuf << std::endl;
|
||||
} else {
|
||||
LOGE("SpServerSocket::Recvfrom Error(%d)", l);
|
||||
return -1;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
@ -111,7 +111,6 @@ static std::string MapToString(std::map<std::string, std::string> myMap)
|
||||
|
||||
ErrCode SPTask::InitTask(const std::string &recvStr)
|
||||
{
|
||||
LOGI("SPTask::InitTask start param(%s)", recvStr.c_str());
|
||||
std::string result = "";
|
||||
std::string hiprofiler = CMD_COMMAND_MAP.at(CmdCommand::HIPROFILER);
|
||||
SPUtils::LoadCmd(hiprofiler, result);
|
||||
@ -122,12 +121,11 @@ ErrCode SPTask::InitTask(const std::string &recvStr)
|
||||
ExceptionMsg exMsg = ParseToTask(recvStr, curTaskInfo);
|
||||
if (exMsg == ExceptionMsg::NO_ERR) {
|
||||
isInit = true;
|
||||
LOGI("SPTask::InitTask Ok");
|
||||
return ErrCode::OK;
|
||||
}
|
||||
|
||||
std::string errInfo = EXCEPTION_MSG_MAP.at(exMsg);
|
||||
LOGI("SPTask::InitTask error(%s)", errInfo.c_str());
|
||||
LOGE("SPTask::InitTask error(%s)", errInfo.c_str());
|
||||
return ErrCode::FAILED;
|
||||
}
|
||||
|
||||
@ -368,11 +366,10 @@ void SPTask::AsyncGetDataMap(std::function<void(std::string data)> msgTask)
|
||||
|
||||
ErrCode SPTask::StartTask(std::function<void(std::string data)> msgTask)
|
||||
{
|
||||
LOGI("SPTask::StartTask start ");
|
||||
RAM &ram = RAM::GetInstance();
|
||||
ram.SetFirstFlag();
|
||||
if (!isInit) {
|
||||
LOGW("SPTask::StartTask initialization failed");
|
||||
LOGE("SPTask::StartTask initialization failed");
|
||||
return ErrCode::FAILED;
|
||||
}
|
||||
isRunning = true;
|
||||
@ -387,7 +384,6 @@ ErrCode SPTask::StartTask(std::function<void(std::string data)> msgTask)
|
||||
AsyncGetDataMap(msgTask);
|
||||
}
|
||||
});
|
||||
LOGI("SPTask::StartTask complete");
|
||||
return ErrCode::OK;
|
||||
}
|
||||
|
||||
@ -450,8 +446,6 @@ void SPTask::StopGpuCounterRecv()
|
||||
}
|
||||
void SPTask::StopTask()
|
||||
{
|
||||
LOGI("SPTask::StopTask start");
|
||||
|
||||
if (GetRecordState()) {
|
||||
StopGetInfo();
|
||||
StopSdkRecv();
|
||||
@ -474,10 +468,7 @@ void SPTask::StopTask()
|
||||
if (thread.joinable()) {
|
||||
thread.join();
|
||||
}
|
||||
|
||||
KillHiperfCmd();
|
||||
|
||||
LOGI("SPTask::StopTask complete");
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> SPTask::DetectionAndGrab()
|
||||
@ -541,10 +532,9 @@ void SPTask::GetHiperf(const std::string &traceName)
|
||||
std::string result;
|
||||
std::string tmp = SetHiperf(traceName);
|
||||
std::cout << tmp << std::endl;
|
||||
LOGD("hiprofiler exec (%s)", tmp.c_str());
|
||||
LOGI("hiprofiler exec trace name(%s)", traceName.c_str());
|
||||
SPUtils::LoadCmd(tmp, result);
|
||||
LOGI("hiprofiler exec end (%s)", result.c_str());
|
||||
LOGD("hiprofiler exec (%s), hiprofiler exec trace name(%s), hiprofiler exec end (%s)",
|
||||
tmp.c_str(), traceName.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -574,7 +564,6 @@ void SPTask::KillHiperfCmd()
|
||||
runTime = now > startCaptuerTime ? now - startCaptuerTime : LLONG_MAX - startCaptuerTime + now;
|
||||
runTime = runTime / RM_1000; // Convert to seconds
|
||||
|
||||
LOGI("Preparing to exit run time(%lld)", runTime);
|
||||
do {
|
||||
out.clear();
|
||||
std::string hiprofilerPid = CMD_COMMAND_MAP.at(CmdCommand::HIPROFILER_PID);
|
||||
@ -591,7 +580,6 @@ void SPTask::KillHiperfCmd()
|
||||
std::string hiprofilerPid = CMD_COMMAND_MAP.at(CmdCommand::HIPROFILER_PID);
|
||||
SPUtils::LoadCmd(hiprofilerPid, result);
|
||||
SPUtils::StrSplit(result, " ", out);
|
||||
LOGI("pidof hiprofiler_cmd size(%u)", out.size());
|
||||
for (auto it = out.begin(); out.end() != it; ++it) {
|
||||
result.clear();
|
||||
SPUtils::LoadCmd(killCmd + (*it), result);
|
||||
@ -617,7 +605,6 @@ bool SPTask::GetRecordState()
|
||||
}
|
||||
void SPTask::StartRecord()
|
||||
{
|
||||
LOGI("SPTask::StartRecord");
|
||||
startTime = SPUtils::GetCurTime();
|
||||
InitDataFile();
|
||||
recordState = true;
|
||||
@ -625,7 +612,6 @@ void SPTask::StartRecord()
|
||||
|
||||
void SPTask::StopRecord()
|
||||
{
|
||||
LOGI("SPTask::StopRecord");
|
||||
std::string outGpuCounterDataPath = baseOutPath + "/" + curTaskInfo.sessionId;
|
||||
|
||||
if (isInit) {
|
||||
|
@ -293,7 +293,7 @@ std::string SPUtils::GetDeviceInfoMap()
|
||||
deviceInfoMap.insert(deviceInfo.begin(), deviceInfo.end());
|
||||
deviceInfoMap["activeMode"] = screenSize;
|
||||
if (deviceInfoMap.empty()) {
|
||||
LOGI("Failed to obtain device information");
|
||||
LOGE("Failed to obtain device information");
|
||||
}
|
||||
for (auto iter = deviceInfoMap.cbegin(); iter != deviceInfoMap.cend(); ++iter) {
|
||||
printf("%s: %s\n", iter->first.c_str(), iter->second.c_str());
|
||||
@ -629,7 +629,7 @@ std::string SPUtils::GetCpuNum()
|
||||
cpuCores += std::to_string(cpuNum);
|
||||
if (cpuNum == 0) {
|
||||
std::cout << "CPU frequency collection failed." << std::endl;
|
||||
LOGI("CPU frequency collection failed.");
|
||||
LOGE("CPU frequency collection failed.");
|
||||
}
|
||||
return cpuCores;
|
||||
}
|
||||
@ -720,7 +720,7 @@ bool SPUtils::GetPathPermissions(const std::string &path)
|
||||
std::string result = cmdResult.substr(0, 10);
|
||||
return result == "-rw-r--r--";
|
||||
} else {
|
||||
LOGI("THE path is empty");
|
||||
LOGE("THE path is empty");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ double StallingRateTrace::StallingRateResult(std::string file)
|
||||
}
|
||||
infile.open(realPath);
|
||||
if (infile.fail()) {
|
||||
LOGI("StallingRateTrace open file(%s) fialed ", file.c_str());
|
||||
LOGE("StallingRateTrace open file(%s) fialed ", file.c_str());
|
||||
return stalligRate;
|
||||
}
|
||||
stalligRate = SmartPerf::StallingRateTrace::CalculateTime();
|
||||
@ -70,21 +70,22 @@ void StallingRateTrace::CalcFrameRate()
|
||||
} else {
|
||||
appFrameLossRate = -1;
|
||||
}
|
||||
LOGI("result.appFrameLossRate: (%s)", std::to_string(appFrameLossRate).c_str());
|
||||
|
||||
if (swiperDynamicFinishTime != 0 && swiperDynamicStartTime != 0) {
|
||||
swiperFrameLossRate = (frameLossSwiperTime / (swiperDynamicFinishTime - swiperDynamicStartTime) * oneThousand);
|
||||
} else {
|
||||
swiperFrameLossRate = -1;
|
||||
}
|
||||
LOGI("result.swiperFrameLossRate: (%s)", std::to_string(swiperFrameLossRate).c_str());
|
||||
|
||||
if (appTabsDynamicStartTime != 0 && appTabsDynamicFinishTime != 0) {
|
||||
tabsFrameLossRate = (frameLossTabsTime / (appTabsDynamicFinishTime - appTabsDynamicStartTime) * oneThousand);
|
||||
} else {
|
||||
tabsFrameLossRate = -1;
|
||||
}
|
||||
LOGI("result.tabsFrameLossRate: (%s)", std::to_string(tabsFrameLossRate).c_str());
|
||||
LOGD("result.appFrameLossRate: (%s), result.swiperFrameLossRate: (%s), result.tabsFrameLossRate: (%s)",
|
||||
std::to_string(appFrameLossRate).c_str(),
|
||||
std::to_string(swiperFrameLossRate).c_str(),
|
||||
std::to_string(tabsFrameLossRate).c_str());
|
||||
}
|
||||
|
||||
void StallingRateTrace::JudgFrameRate()
|
||||
@ -98,15 +99,12 @@ void StallingRateTrace::JudgFrameRate()
|
||||
bool tabsDynamicExists = hasDynamic(appTabsDynamicFinishTime, appTabsDynamicStartTime);
|
||||
|
||||
if (!appListDynamicExists) {
|
||||
LOGI("no app list Dynamic");
|
||||
frameLossRate = swiperDynamicExists ? swiperFrameLossRate :
|
||||
tabsDynamicExists ? tabsFrameLossRate : -1;
|
||||
} else if (!swiperDynamicExists) {
|
||||
LOGI("no swiper Dynamic");
|
||||
frameLossRate = appListDynamicExists ? appFrameLossRate :
|
||||
tabsDynamicExists ? tabsFrameLossRate : -1;
|
||||
} else if (!tabsDynamicExists) {
|
||||
LOGI("no tabs Dynamic");
|
||||
frameLossRate = appListDynamicExists ? appFrameLossRate :
|
||||
swiperDynamicExists ? swiperFrameLossRate : -1;
|
||||
} else {
|
||||
@ -117,7 +115,6 @@ void StallingRateTrace::JudgFrameRate()
|
||||
void StallingRateTrace::MultiLaneFrameRate()
|
||||
{
|
||||
if (appFrameLossRate == 0) {
|
||||
LOGI("no app list hitchTime");
|
||||
if (swiperFrameLossRate > 0) {
|
||||
frameLossRate = swiperFrameLossRate;
|
||||
} else if (tabsFrameLossRate > 0) {
|
||||
@ -126,7 +123,6 @@ void StallingRateTrace::MultiLaneFrameRate()
|
||||
frameLossRate = 0;
|
||||
}
|
||||
} else if (swiperFrameLossRate == 0) {
|
||||
LOGI("no swiper list hitchTime");
|
||||
if (appFrameLossRate > 0) {
|
||||
frameLossRate = appFrameLossRate;
|
||||
} else if (tabsFrameLossRate > 0) {
|
||||
@ -135,7 +131,6 @@ void StallingRateTrace::MultiLaneFrameRate()
|
||||
frameLossRate = 0;
|
||||
}
|
||||
} else if (tabsFrameLossRate == 0) {
|
||||
LOGI("no tabs list hitchTime");
|
||||
if (appFrameLossRate > 0) {
|
||||
frameLossRate = appFrameLossRate;
|
||||
} else if (swiperFrameLossRate > 0) {
|
||||
@ -182,14 +177,14 @@ void StallingRateTrace::AppList(const std::string &line, const std::string &sign
|
||||
line.find("H:LAUNCHER_APP_LAUNCH_FROM_DOCK,") != std::string::npos ||
|
||||
line.find("H:LAUNCHER_APP_LAUNCH_FROM_APPCENTER,") != std::string::npos) {
|
||||
if (listFlag) {
|
||||
LOGI("AppList line start: (%s)", line.c_str());
|
||||
appListDynamicFinishTime = GetTimes(line, signF);
|
||||
LOGI("appListDynamicFinishTime: (%s)", std::to_string(appListDynamicFinishTime).c_str());
|
||||
LOGD("AppList line start: (%s), appListDynamicFinishTime: (%s)",
|
||||
line.c_str(), std::to_string(appListDynamicFinishTime).c_str());
|
||||
listFlag = false;
|
||||
} else {
|
||||
LOGI("AppList line finish: (%s)", line.c_str());
|
||||
appListDynamicStartTime = GetTimes(line, signS);
|
||||
LOGI("appListDynamicStartTime: (%s)", std::to_string(appListDynamicStartTime).c_str());
|
||||
LOGD("AppList line finish: (%s), appListDynamicStartTime: (%s)",
|
||||
line.c_str(), std::to_string(appListDynamicStartTime).c_str());
|
||||
listFlag = true;
|
||||
frameLossTime = 0;
|
||||
}
|
||||
@ -199,13 +194,12 @@ void StallingRateTrace::AppList(const std::string &line, const std::string &sign
|
||||
if (upperScreenFlag) {
|
||||
if (line.find("|H:Present Fence ") != std::string::npos) {
|
||||
fenceId = GetFenceId(line);
|
||||
LOGI("fenceId: (%d)", fenceId);
|
||||
}
|
||||
std::string waitFenceId = "|H:Waiting for Present Fence " + std::to_string(fenceId);
|
||||
if (line.find(waitFenceId) != std::string::npos) {
|
||||
nowTime = SPUtilesTye::StringToSometype<double>(StallingRateTrace::GetOnScreenTimeStart(line));
|
||||
GetFrameLossTime(nowTime, lastTime, roundTime, frameLossTime);
|
||||
LOGI("frameLossTime: (%s)", std::to_string(frameLossTime).c_str());
|
||||
LOGD("frameLossTime: (%s)", std::to_string(frameLossTime).c_str());
|
||||
lastTime = nowTime;
|
||||
upperScreenFlag = false;
|
||||
}
|
||||
@ -217,9 +211,9 @@ void StallingRateTrace::GetFrameLossTime(double curTime, double prevTime, double
|
||||
{
|
||||
if ((curTime - prevTime) > drawTime && prevTime != 0) {
|
||||
double diffTime = (curTime - prevTime) - drawTime;
|
||||
LOGI("diffTime: (%s)", std::to_string(diffTime).c_str());
|
||||
totalFrameLossTime += diffTime;
|
||||
LOGI("totalFrameLossTime: (%s)", std::to_string(totalFrameLossTime).c_str());
|
||||
LOGD("diffTime: (%s), totalFrameLossTime: (%s)",
|
||||
std::to_string(diffTime).c_str(), std::to_string(totalFrameLossTime).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +234,6 @@ void StallingRateTrace::GetRsHardWareRate(double curFrameRate, const std::string
|
||||
break;
|
||||
}
|
||||
curFrameRate = GetFrameRate(line);
|
||||
LOGI("curFrameRate1: (%s)", std::to_string(curFrameRate).c_str());
|
||||
if (curFrameRate != 0) {
|
||||
UpdateRoundTime(curFrameRate, type);
|
||||
}
|
||||
@ -259,7 +252,6 @@ void StallingRateTrace::GetRsHardWareRate(double curFrameRate, const std::string
|
||||
break;
|
||||
}
|
||||
curFrameRate = GetFrameRate(line);
|
||||
LOGI("curFrameRate2: (%s)", std::to_string(curFrameRate).c_str());
|
||||
if (curFrameRate != 0) {
|
||||
UpdateRoundTime(curFrameRate, type);
|
||||
}
|
||||
@ -293,9 +285,9 @@ void StallingRateTrace::AppSwiperScroll(const std::string &line, const std::stri
|
||||
line.find("H:APP_SWITCH_FRAME_ANIMATION") != std::string::npos ||
|
||||
line.find("H:APP_SWIPER_SCROLL,") != std::string::npos) {
|
||||
if (swiperScrollFlag == 0) {
|
||||
LOGI("AppSwiperScroll line start: (%s)", line.c_str());
|
||||
swiperDynamicStartTime = GetTimes(line, signS);
|
||||
LOGI("swiperDynamicStartTime: (%s)", std::to_string(swiperDynamicStartTime).c_str());
|
||||
LOGD("AppSwiperScroll line start: (%s), swiperDynamicStartTime: (%s)",
|
||||
line.c_str(), std::to_string(swiperDynamicStartTime).c_str());
|
||||
frameLossSwiperTime = 0;
|
||||
swiperScrollFlag = 1;
|
||||
swiperFlag = true;
|
||||
@ -305,9 +297,9 @@ void StallingRateTrace::AppSwiperScroll(const std::string &line, const std::stri
|
||||
line.find("H:APP_SWIPER_NO_ANIMATION_SWITCH") != std::string::npos ||
|
||||
line.find("H:APP_SWITCH_FRAME_ANIMATION") != std::string::npos) {
|
||||
if (swiperFlingFlag == 1) {
|
||||
LOGI("AppSwiper FinishTime line: (%s)", line.c_str());
|
||||
swiperDynamicFinishTime = GetTimes(line, signF);
|
||||
LOGI("swiperDynamicFinishTime: (%s)", std::to_string(swiperDynamicFinishTime).c_str());
|
||||
LOGD("AppSwiper FinishTime line: (%s), swiperDynamicFinishTime: (%s)",
|
||||
line.c_str(), std::to_string(swiperDynamicFinishTime).c_str());
|
||||
swiperFlag = false;
|
||||
}
|
||||
if (swiperDynamicFinishTime == 0) {
|
||||
@ -320,14 +312,13 @@ void StallingRateTrace::AppSwiperScroll(const std::string &line, const std::stri
|
||||
if (upperScreenSwiperFlag) {
|
||||
if (line.find("|H:Present Fence ") != std::string::npos) {
|
||||
fenceIdSwiper = GetFenceId(line);
|
||||
LOGI("fenceIdSwiper: (%d)", fenceIdSwiper);
|
||||
}
|
||||
std::string waitFenceId = "|H:Waiting for Present Fence " + std::to_string(fenceIdSwiper);
|
||||
if (line.find(waitFenceId) != std::string::npos) {
|
||||
nowSwiperTime = SPUtilesTye::StringToSometype<double>(StallingRateTrace::GetOnScreenTimeStart(line));
|
||||
LOGI("nowSwiperTime: (%s)", std::to_string(nowSwiperTime).c_str());
|
||||
GetFrameLossTime(nowSwiperTime, lastSwiperTime, roundSwiperTime, frameLossSwiperTime);
|
||||
LOGI("frameLossSwiperTime: (%s)", std::to_string(frameLossSwiperTime).c_str());
|
||||
LOGD("nowSwiperTime: (%s), frameLossSwiperTime: (%s)",
|
||||
std::to_string(nowSwiperTime).c_str(), std::to_string(frameLossSwiperTime).c_str());
|
||||
lastSwiperTime = nowSwiperTime;
|
||||
upperScreenSwiperFlag = false;
|
||||
}
|
||||
@ -345,14 +336,14 @@ void StallingRateTrace::APPTabs(const std::string &line, const std::string &sign
|
||||
line.find(appTabsFrameAnimation) != std::string::npos ||
|
||||
line.find(appTabsScroll) != std::string::npos) {
|
||||
if (tabsFlag) {
|
||||
LOGI("APPTabs line start: (%s)", line.c_str());
|
||||
appTabsDynamicFinishTime = GetTimes(line, signF);
|
||||
LOGI("appTabsDynamicFinishTime: (%s)", std::to_string(appTabsDynamicFinishTime).c_str());
|
||||
LOGD("APPTabs line start: (%s), appTabsDynamicFinishTime: (%s)",
|
||||
line.c_str(), std::to_string(appTabsDynamicFinishTime).c_str());
|
||||
tabsFlag = false;
|
||||
} else {
|
||||
LOGI("APPTabs line finish: (%s)", line.c_str());
|
||||
appTabsDynamicStartTime = GetTimes(line, signS);
|
||||
LOGI("appTabsDynamicStartTime: (%s)", std::to_string(appTabsDynamicStartTime).c_str());
|
||||
LOGD("APPTabs line finish: (%s), appTabsDynamicStartTime: (%s)",
|
||||
line.c_str(), std::to_string(appTabsDynamicStartTime).c_str());
|
||||
tabsFlag = true;
|
||||
frameLossTabsTime = 0;
|
||||
}
|
||||
@ -362,16 +353,11 @@ void StallingRateTrace::APPTabs(const std::string &line, const std::string &sign
|
||||
if (upperScreenTabsFlag) {
|
||||
if (line.find("|H:Present Fence ") != std::string::npos) {
|
||||
fenceIdTabs = GetFenceId(line);
|
||||
LOGI("fenceIdTabs: (%s)", std::to_string(fenceIdTabs).c_str());
|
||||
}
|
||||
std::string waitFenceId = "|H:Waiting for Present Fence " + std::to_string(fenceIdTabs);
|
||||
if (line.find(waitFenceId) != std::string::npos) {
|
||||
nowTabsTime = std::stod(SmartPerf::StallingRateTrace::GetOnScreenTimeStart(line));
|
||||
LOGI("nowTabsTime: (%s)", std::to_string(nowTabsTime).c_str());
|
||||
LOGI("lastTabsTime: (%s)", std::to_string(lastTabsTime).c_str());
|
||||
LOGI("roundTabsTime: (%s)", std::to_string(roundTabsTime).c_str());
|
||||
GetFrameLossTime(nowTabsTime, lastTabsTime, roundTabsTime, frameLossTabsTime);
|
||||
LOGI("app tabs frameLossTabsTime: (%s)", std::to_string(frameLossTabsTime).c_str());
|
||||
lastTabsTime = nowTabsTime;
|
||||
upperScreenTabsFlag = false;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void StartUpDelay::ClearOldServer() const
|
||||
|
||||
if (token != curPid) {
|
||||
SPUtils::LoadCmd(killCmd + token, killResult);
|
||||
LOGI("Find old server: %s, killed.", token.c_str());
|
||||
LOGD("Find old server: %s, killed.", token.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ std::string StartUpDelay::GetPidByPkg(const std::string &curPkgName)
|
||||
std::string resultProcId = ExecuteCommand(args);
|
||||
if (!resultProcId.empty() && resultProcId.back() == '\n') {
|
||||
resultProcId.pop_back();
|
||||
LOGI("startup_delay::output: (%s)", resultProcId.c_str());
|
||||
LOGD("startup_delay::output: (%s)", resultProcId.c_str());
|
||||
}
|
||||
return resultProcId;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user