Hotrian / OpenVRTwitchChat

Put your favorite Twitch Chat directly into any OpenVR game!
Other
174 stars 50 forks source link

High CPU Usage when window is minimized #28

Open jaredcat opened 6 years ago

jaredcat commented 6 years ago

OpenVRTwitchChat seems to eat up a lot of CPU. I have to set the priority to low just to ensure that games run smoothly. Is this normal or known behavior? If not what diagnostics should I perform?

Hotrian commented 6 years ago

From what I remember it should use a pretty low level of resources. High CPU usage likely indicates an error. Could you attach the output_log.txt?

Unfortunately I haven’t been actively developing OVRTC in something like two years, so it likely had issues by now - for example Twitch seems to change the API requirements every 3-6 months.

Edit: Seems I was developing OVRTC about 22 months ago. Keep in mind it was as a demonstration for other developers - a proof of concept - unfortunately the interest never seemed to pick up.

jaredcat commented 6 years ago

Yea, I realized you moved on to OVRdrop (which i own) but this is just simpler for the one use case I want. I was thinking maybe outdated Unity library, but I'll try to post the logs tonight.

Hotrian commented 6 years ago

I believe OVRTC uses the same version of the SteamVR APIs that OVRdrop still currently uses (although OVRdrop has been made a hybrid and is running multiple versions of the API now), so I don't believe this issue is due to outdated libraries.

The only code really doing any heavy lifting would be the TwitchIRC (which I mostly did not write). Everything else is pretty lightweight, mostly relying on events so as to minimize looping. I'm guessing an error is spamming the output log - Unity is notoriously slow at writing log entries, even from inside the editor.

From your description it sounds like OVRTC may be stuck in a loop, eating up as much processing as possible - or possibly you set the framerate to unlimited - which would make OVRTC run at 100% max speed, but which I'm not sure if the end user can do or not as Unity does allow some internal configuration and commands itself.

I guess it's possible Unity itself is having issues on your system. OVRTC uses the same version of Unity as OVRdrop, but it is doing a lot of things OVRdrop does not do, such as playing sounds and processing the emojis. I know certain versions of Unity have issues with this kind of stuff - for example an older version of Unity completely broke the emojis, but updating to fix the emojis temporarily broke the sound and code had to be refactored. It's possible something about Unity that OVRTC is doing doesn't play well on your system, but it would be very difficult to determine.

jaredcat commented 5 years ago

Sorry for the delay. Heres the output log output_log.txt

Yea I'm not aware of any way to change settings. My computer glitched once and I saw unity launch menu once and I set the graphics to "fastest" but I've only seen that once and not sure if it had any effect.

I know this is something you don't really work on but any help or updates are appreciated. I use this for every VR stream and besides this its works great for allowing me to talk to chat. Super useful tool for us!

Hotrian commented 5 years ago

You can create a shortcut and add the flag -show-screen-selector after the file location in the Target box to tell Unity to show that window again.

GiantPandas commented 5 years ago

I'd like to report same issue. Happens with 1.0.7.5 and 1.0.7.3

Perhaps it's Windows Mixed Reality related?

With no game running, Just the WMR Portal, and steamVR, task manager reports ~50% cpu usage and ~25% gpu usage by OpenVRtwitchChat.

2018-09-03 20_31_54-task manager

Unity options as far as gfx quality or resolution don't seem to make any difference.

This is on an i5 4590 and a gtx 1070.

Hotrian commented 5 years ago

Very strange. Might be a Unity issue — I’m not sure what could be causing it in OVRTC but I’ll look into it if/when I get a WMR device.

jaredcat commented 5 years ago

Just to clarify, I am using a Vive and not a WMR device.

GiantPandas commented 5 years ago

I just purchased ovrdrop to test and to support your work.

Got about 10 % cpu and gpu usage on main branch.

Getting 2% cpu and gpu usage on latest beta.

Hotrian commented 5 years ago

Oh, my mistake @jaredkotoff - for some reason I thought you were both on WMR.

Cunningcory commented 4 years ago

I can add some information to this as well...over a year later. I'm on a Rift S. CPU usage spikes to 30% when I minimize the TwitchChatOverlay application. Leaving the app on the desktop keeps CPU usage to a minimum (1-4%), even if I tab over to other apps.

Hotrian commented 4 years ago

Thanks @Cunningcory , perhaps Unity is doing something weird or it may be because the frame rate rises dramatically when the application is minimized.