Skip to content

Commit 1b3d713

Browse files
committed
CPUUsage: always print something
1 parent 6e816fc commit 1b3d713

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/common/bar.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t
7878

7979
if (colored && !options->pipe)
8080
{
81-
if(green < yellow)
81+
if(percent != percent)
82+
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
83+
else if(green < yellow)
8284
{
8385
if (percent <= green)
8486
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_GREEN "m");

src/detection/cpuusage/cpuusage.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ const char* ffGetCpuUsageResult(FFlist* result)
4040
FFCpuUsageInfo* cpuTime2 = ffListGet(&cpuTimes2, i);
4141
if (cpuTime2->totalAll <= cpuTime1->totalAll)
4242
{
43-
ffListClear(&cpuTimes2);
44-
ffTimeSleep(200);
45-
if (++retryCount >= 10)
46-
return "Retry count exceeded";
47-
goto retry;
43+
if (++retryCount <= 3)
44+
{
45+
ffListClear(&cpuTimes2);
46+
ffTimeSleep(200);
47+
goto retry;
48+
}
4849
}
4950
}
5051

0 commit comments

Comments
 (0)