CPUUsage: always print something

This commit is contained in:
李通洲
2023-11-01 15:36:13 +08:00
parent 6e816fca6e
commit 1b3d713e50
2 changed files with 9 additions and 6 deletions
+3 -1
View File
@@ -78,7 +78,9 @@ void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t
if (colored && !options->pipe)
{
if(green < yellow)
if(percent != percent)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
else if(green < yellow)
{
if (percent <= green)
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_GREEN "m");
+6 -5
View File
@@ -40,11 +40,12 @@ retry:
FFCpuUsageInfo* cpuTime2 = ffListGet(&cpuTimes2, i);
if (cpuTime2->totalAll <= cpuTime1->totalAll)
{
ffListClear(&cpuTimes2);
ffTimeSleep(200);
if (++retryCount >= 10)
return "Retry count exceeded";
goto retry;
if (++retryCount <= 3)
{
ffListClear(&cpuTimes2);
ffTimeSleep(200);
goto retry;
}
}
}