exeldro / obs-source-profiler

GNU General Public License v2.0
49 stars 2 forks source link

CPU values of stacked filters look wrong #7

Open xurei opened 1 month ago

xurei commented 1 month ago

Consider this setup: A simple scene with a source and two Effect filters:

The Profiler looks like this: image

It gets even worse when you stack more filters: image

This gives the wrong impression that all filters takes a lot of CPU, where only the first one is actually CPU-intensive. The source has a very high CPU usage, but the scene itself uses less CPU time, which does not make sense.

I see two options to fix this:

  1. show the CPU usage of the filters MINUS the CPU usage of the filters above it, - or -
  2. only add the CPU usage of the last filter to the CPU usage of the source, and maybe show the filters in a waterfall view (but this might quickly become unreadable for sources with many filters)

I think solution 1 is better: it is less confusing than solution 2 and is consistent with how sources are displayed in a scene, i. e. by showing the "Self CPU usage" of each child item, and adding them as the total CPU time of the parent element.

exeldro commented 1 month ago

I agree solution 1 sounds like the better one.

exeldro commented 1 month ago

Made a fix for it in main branch, let me know if this works as expected for you

xurei commented 1 month ago

There is an improvement, but there is still something incorrect : image

Virtually-nothing number 1 is incorrectly calculated

Interestingly, the order of the filters is: image

But if I reorder like that: image

The calculation looks correct: image

exeldro commented 1 month ago

What kind of filter are you using for CPU-intensive?

xurei commented 1 month ago

This is a plugin I made myself with face tracking done on the CPU. That was the most CPU intensive filter I had at hand, but you can see the same pattern with e.g. Composite Blur and these settings:

Blur algo: Box
Blur type: Area
Blur Radius: max
Passes: max
Bg source for compositing: None
Effect Mask: None 

Screenshot From 2024-10-28 09-47-15 image

Less spectacular, but well present.

exeldro commented 1 month ago

I was not able to replicate it yet: image image

xurei commented 1 month ago

You need a disabled filter between "Composite Blur" and "Color Correction 2"

exeldro commented 1 month ago

I saw the comment just after I created 0.0.6. I was able to replicate it now and made a fix on main branch