Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandboxie-Plus is constantly using about 2% of CPU, whereas Sandboxie-Classic uses about 0% CPU #1424

Open
Brifien opened this issue Dec 10, 2021 · 9 comments
Labels
Confirmation pending Further confirmation is requested CPU usage High CPU usage Known issue Old known Sandboxie issues

Comments

@Brifien
Copy link

Brifien commented Dec 10, 2021

Hello,

I noticed that Sandboxie-Plus (SandMan.exe) is constantly using about 2% of CPU, event when no sandboxed application is running. When a sandboxed application is running, the CPU usage remains the same (about 2%).

I check with Sandboxie-Classic, and the CPU usage is nearly 0%, without and with sandboxed running application.

It seems then that Sandboxie-Plus (SandMan.exe) is using significantly more CPU than Sandboxie-Classic.

Sandboxie-Plus
(without sandboxed application)
Sandboxie_plus_noapp_2

(with sandboxed application)
Sandboxie_plus_Firefox

Sandboxie_plus_Firefox_2

Sandboxie-Classic
Sandboxie_classic_1

sandboxie_classic_2

Note that Sandboxie was running only for a few minutes when I took this screenshots, reason why the accumulated CPU time is still low.

I observed this behavior on previous versions too, but these screenshots were done with:

  • Sandboxie-Plus-x64-v1.0.2.0.0
  • Sandboxie-Classic-x64-v5.55.2.0

Operating system: Windows 10 Pro 21H2.

Is it expected that Sandboxie-Plus (SandMan.exe) uses "so much" CPU, compared to Sandboxie-Classic?

Thanks.

@DavidXanatos
Copy link
Member

Its expected to use more as its Qt based and that has more overhead than a 20 year old MFC application, but 2% on a modern PC seams excessive.

@isaak654
Copy link
Collaborator

isaak654 commented Dec 10, 2021

CPU spikes of 2% can be reached in idle after opening SandMan.exe, while the CPU is dropped to a constant 0,94% of usage if you reduce it as tray icon.

If you open some menu entry like Help -> About the Qt Framework, the CPU will raise temporarily to a maximum of 5%.

@isaak654 isaak654 added the CPU usage High CPU usage label Dec 10, 2021
@Brifien
Copy link
Author

Brifien commented Dec 10, 2021

I have measured more "statistics".

I started Sandboxie for 5 minutes (300 seconds) and checked the accumulated CPU time with Process Explorer. On my system, the results are the followings.

Sandboxie-Plus (SandMan.exe)

  • Sandboxie-Plus (SandMan.exe) open:

    • CPU time: ~30 seconds
    • CPU usage: 10% (30s CPU time / 300s runtime)
      Sandboxie_plus_maximuzed_noapp_2021-12-10_141247
  • Sandboxie-Plus (SandMan.exe) reduced as tray icon:

    • CPU time: ~30 seconds
    • CPU usage: 10% (30s CPU time / 300s runtime)
      Sandboxie_plus_tray_noapp_2021-12-10_141247

Results are more or less identical. But, as mentioned by isaak654, on Windows Task Manager it seems that CPU is less on tray.

Sandboxie-Classic (SbieCtrl.exe)

  • Sandboxie-Classic (SbieCtrl.exe) open:
    • CPU time: ~1.3 seconds
    • CPU usage: 0.4% (1.3s CPU time / 300s runtime)

BUT, it seems that most of the CPU time was used by Sandboxie-Classic (SbieCtrl.exe) when the application starts. Then, CPU time stays nearly unchanged:

  • After 4 minutes: CPU time: ~1.281 seconds
    Sandboxie_classic_maximized_noapp_4min_2021-12-10_141247

  • After 5 minutes: CPU time: ~1.343 seconds
    Sandboxie_classic_maximized_noapp_5min_2021-12-10_141247

  • =>So, the additional CPU usage is more realistically 0.1% ( (1.343-1.281)s CPU time / 60 s runtime)

@isaak654
Copy link
Collaborator

But, as mentioned by isaak654, on Windows Task Manager it seems that CPU is less on tray.

Nope, I used Process Hacker 2.39.

@isaak654
Copy link
Collaborator

isaak654 commented Dec 10, 2021

Originally posted by @DavidXanatos in #post-3056238

well its always looking if new boxed processes were started t be able to change the icon on demand but when its minimized it should not use much spu

What about this?

If you open some menu entry like Help -> About the Qt Framework, the CPU will raise temporarily to a maximum of 5%.

@typpos
Copy link
Contributor

typpos commented Dec 13, 2021

I think this is a very old problem. The issue scales with the number of sandboxes registered. For example, 200 empty boxes with SB+ in tray draws ~2% processor time, and (idle) open SB+ over 5%. From (ancient code review) memory, I think it's nothing to do with the default Qt event loop. Rather, SB+ actively polls some configuration info repeatedly from the driver. Maybe here:

void CSandMan::timerEvent(QTimerEvent* pEvent)

(Apologies, I may be wrong with this. It's been a long time).

Regardless, it would be great to have this fixed. If CPU goes above some low %, the fans kick in 😅

Example; 200 all-empty sandboxie boxes. 4 Core / 8 thread CPU:

Tray icon / Minimized:
Screenshot 2021-12-13 105002

UI visible and idle:
Screenshot 2021-12-13 105323

@isaak654 isaak654 added Confirmation pending Further confirmation is requested Known issue Old known Sandboxie issues and removed Confirmation pending Further confirmation is requested labels Dec 13, 2021
@isaak654
Copy link
Collaborator

isaak654 commented Dec 13, 2021

In 1.0.3, the startTimer value in SandMan.cpp was raised from 250 to 1000, see 9cf189b

That might help a bit...

@isaak654 isaak654 added the Confirmation pending Further confirmation is requested label Dec 13, 2021
@olliebean
Copy link

Because of this, I've set SB Plus not to close to the tray. I open it when I need it from a pinned taskbar icon, and it's also set to open automatically when I run a sandboxed program. This way, when not in use, it consumes 0% CPU.

@isaak654
Copy link
Collaborator

isaak654 commented Feb 8, 2022

This seems improved in latest versions.

@isaak654 isaak654 removed the Must-fix label Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmation pending Further confirmation is requested CPU usage High CPU usage Known issue Old known Sandboxie issues
Projects
None yet
Development

No branches or pull requests

5 participants