Very serious problem high CPU usage! #6308

Closed
opened 2023-04-06 15:40:39 +00:00 by sxzxs · 4 comments
sxzxs commented 2023-04-06 15:40:39 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

Version: 1.89
Branch: viewport/docking

win32 dx11 win10

Back-ends: win32 dx11
Compiler: vs2022
Operating System: win10

My Issue/Question:

When its win32 dx11 binding process, minimize the interface, the utilization rate of CPU occupancy rate rise immediately to 50

Screenshots/Video
minisize
No nimisize

**Version/Branch of Dear ImGui:** Version: 1.89 Branch: viewport/docking **win32 dx11 win10** Back-ends: win32 dx11 Compiler: vs2022 Operating System: win10 **My Issue/Question:** When its win32 dx11 binding process, minimize the interface, the utilization rate of CPU occupancy rate rise immediately to 50 **Screenshots/Video** ![minisize](https://user-images.githubusercontent.com/26515268/230429231-ae868294-3deb-4257-abbc-dfe3d130d076.png) ![No nimisize](https://user-images.githubusercontent.com/26515268/230429105-f948c514-8652-4c97-9f17-445693f14235.png)
ocornut commented 2023-04-06 16:13:23 +00:00 (Migrated from github.com)

We don't have an Idle process in place for minimization in our examples, and likely the app is running at maximum possible framerate since the Present() call doesn't wait for vsync.

Your application code can decide to pause when Minimized.

We don't have an Idle process in place for minimization in our examples, and likely the app is running at maximum possible framerate since the `Present()` call doesn't wait for vsync. Your application code can decide to pause when Minimized.
ocornut commented 2023-04-06 16:15:08 +00:00 (Migrated from github.com)

Closing as duplicate of #2496
Aside from a more generic Idle scheme I suppose we could rework some of our example apps to simply stop when minimized.

Closing as duplicate of #2496 Aside from a more generic Idle scheme I suppose we could rework some of our example apps to simply stop when minimized.
sxzxs commented 2023-04-06 16:16:11 +00:00 (Migrated from github.com)

On the issue, I have found this problem, I'm sorry before without browsing
1、https://github.com/ocornut/imgui/pull/3907
2、

	if (ImGui::GetIO().Framerate > 61.f) 
        {
		std::this_thread::sleep_for(std::chrono::milliseconds(200)); // drop to 5 FPS when invisible
	}

On the issue, I have found this problem, I'm sorry before without browsing 1、https://github.com/ocornut/imgui/pull/3907 2、 ``` if (ImGui::GetIO().Framerate > 61.f) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); // drop to 5 FPS when invisible } ```
ocornut commented 2023-04-06 16:17:34 +00:00 (Migrated from github.com)

The solution in #3907 is more correct than checking for Framerate > 61.f

The solution in #3907 is more correct than checking for `Framerate > 61.f`
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#6308
No description provided.