|
@@ -5152,6 +5152,11 @@ void ResourceWatcherFSM::ConfirmWindowEffectHasBeenOpen()
|
|
|
}
|
|
|
#endif // RVC_OS_LINUX
|
|
|
|
|
|
+
|
|
|
+bool cmpPid(const pair<int, CSimpleStringA>& a, const pair<int, CSimpleStringA>& b) {
|
|
|
+ return a.first < b.first;
|
|
|
+}
|
|
|
+
|
|
|
void ResourceWatcherFSM::GetSystemProccess()
|
|
|
{
|
|
|
if(processName.empty())
|
|
@@ -5165,26 +5170,23 @@ void ResourceWatcherFSM::GetSystemProccess()
|
|
|
CSimpleStringA endStr = ",";
|
|
|
CSimpleStringA totalProcStr = "{";
|
|
|
|
|
|
- int uploadTime = 0, procNo = 0;
|
|
|
- int size = processName.size();
|
|
|
- unordered_map<int, CSimpleStringA>::iterator it;
|
|
|
- for (it = processName.begin(); it != processName.end(); ++it)
|
|
|
+ vector<pair<int, CSimpleStringA>> vec(processName.begin(), processName.end());
|
|
|
+ sort(vec.begin(), vec.end(), cmpPid);
|
|
|
+
|
|
|
+ for (int i = 0; i < vec.size(); i++)
|
|
|
{
|
|
|
- procNo++;
|
|
|
- //"pid1":"name1"
|
|
|
- curProcStr = CSimpleStringA("\"") + to_string(it->first).c_str() + "\":\"" + it->second + "\"";
|
|
|
+ curProcStr = CSimpleStringA("\"") + to_string(vec[i].first).c_str() + "\":\"" + vec[i].second + "\"";
|
|
|
len = totalProcStr.GetLength() + curProcStr.GetLength();
|
|
|
- if (len > 1000 || procNo == size)
|
|
|
+ if (len > 1000 || i == (vec.size()-1))
|
|
|
{
|
|
|
endStr = "}";
|
|
|
- uploadTime++;
|
|
|
- if (procNo == size)
|
|
|
+ if (i == (vec.size() - 1)) //最后一个
|
|
|
{
|
|
|
totalProcStr = totalProcStr + curProcStr + endStr;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetSystemProccess")(totalProcStr.GetData());
|
|
|
break;
|
|
|
}
|
|
|
- else
|
|
|
+ else //长度超限
|
|
|
{
|
|
|
totalProcStr[totalProcStr.GetLength() - 1] = '}';
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetSystemProccess")(totalProcStr.GetData());
|