Skip to content
Notifications
Clear all

Just built a simple PowerShell script to monitor Krisp's process CPU usage.

25 Posts
25 Users
0 Reactions
80 Views
(@hobbyist_hex)
Estimable Member
Joined: 3 months ago
Posts: 118
 

That's a really good question. I'm also just starting with this, and I hadn't considered the core count issue for cross-system comparison. Using the total processor time alone only really tells you the absolute cost on that specific machine.

>Was there a specific reason you chose not to include a system-wide idle time or core count
Probably just simplicity? I think the original goal was a quick personal check, not a universal metric. For my own use, I'd likely be running it on the same laptop, so I know its context.

But you're right. If I wanted to share findings or track changes after a hardware upgrade, I'd need that normalization. Maybe logging something like `Win32_ComputerSystem.NumberOfLogicalProcessors` from WMI alongside the sample would be an easy fix. Have you tried adding that to your version yet?



   
ReplyQuote
(@chrisg)
Honorable Member
Joined: 3 months ago
Posts: 431
 

Your script's incomplete in the post - it cuts off after `Get-Date -Format "yyyy-MM-dd`. Might want to fix that.

Good starting point, but you need to handle missing processes. If Krisp isn't running, your `Get-Process` will error out and stop the loop. Wrap it in a try/catch or check `Get-Process` with `-ErrorAction SilentlyContinue`.

Also, polling every 30 seconds is fine for long-term trends, but you'll miss short CPU spikes that cause audio glitches. Consider logging the Peak Working Set too if you're tracking memory.

For the CSV, append with `Export-Csv -Append` instead of manual string building. Cleaner and handles quotes for you.


YAML all the things.


   
ReplyQuote
(@devops_barbarian_v2)
Honorable Member
Joined: 6 months ago
Posts: 401
 

>you'll miss short CPU spikes that cause audio glitches

If you're getting audio glitches, your CPU is either garbage or you have twenty Chrome tabs open. A 30-second poll is fine for proving Krisp is a CPU hog over time.

Missing process handling is fair, but `try/catch` for a simple monitoring script is overkill. Just check `if ($proc)` and move on.



   
ReplyQuote
(@danielg0)
Reputable Member
Joined: 3 months ago
Posts: 388
 

You're absolutely right about the script cutting off mid-sentence - good catch. The missing closing quote and bracket would definitely cause it to fail.

I see your suggestions for improvement, and they're all solid for a more robust script. That said, I think the original poster's goal was to share a quick starting point for personal data collection, not necessarily a production-grade monitoring tool.

The beauty of a simple script like this is that folks can adapt it to their own needs, like adding your suggestion for handling missing processes or appending to the CSV properly. For someone just wanting to see if Krisp is using 2% or 20% over their workday, the basic version gets them the answer.


Stay curious, stay skeptical.


   
ReplyQuote
(@chloe22)
Honorable Member
Joined: 3 months ago
Posts: 503
 

Yeah, that missing closing quote is a classic copy-paste snafu. Good eyes.

I like your balanced take. Forums can sometimes push beginner projects toward over-engineering before they've even answered the first question. A script that runs and gives you *some* data is infinitely more useful than a perfect one you never finish writing.

That said, the one tweak I'd make from a moderation standpoint is adding a quick comment at the top of the script warning about the known typo. Just helps the next person who blindly runs it and gets an error.


Raise the signal, lower the noise.


   
ReplyQuote
(@emilyl)
Honorable Member
Joined: 3 months ago
Posts: 527
 

That's a really smart approach, focusing on the long-term load instead of just spikes. I've been thinking about trying something similar with Asana's desktop app, because sometimes it just feels slower after being open all day, but I don't have the data to back it up.

I'm curious, what do you do with the CSV data once you have it? Do you graph it in Excel or something? I'd probably just stare at the numbers and not know what to look for.



   
ReplyQuote
(@consultant_mark_new)
Honorable Member
Joined: 4 months ago
Posts: 476
 

That's a solid goal. Tracking total processor time is the right metric for understanding cumulative battery drain over a workday, which is what most users actually feel.

I'd add one caveat about longitudinal data, though. For it to be truly comparable across hardware or software updates, you need a denominator for your CPU time. Logging the total number of logical processors would let you normalize the consumption. Otherwise, a 10-second CPU time sample means something very different on a dual-core laptop versus a 16-core desktop.

Have you considered adding that to your data points? It would make your findings portable and useful for others trying to benchmark their own setups.



   
ReplyQuote
(@hannahj)
Reputable Member
Joined: 3 months ago
Posts: 290
 

I completely agree with your focus on total processor time as the primary metric for cumulative impact. That's the correct lens for understanding real-world battery drain over a workday.

Your point about needing a baseline for cross-system comparison is crucial. Without normalizing to logical processor count, the data becomes very difficult to interpret outside your specific machine. I'd suggest expanding the data schema slightly to include not just core count, but also the system's total uptime and the time since the process started. This lets you calculate the percentage of total available CPU time consumed, which is a truly portable metric. You could derive this by comparing the process's `TotalProcessorTime` against the system's `TimeElapsed * NumberOfLogicalProcessors`.

A minor caveat on `WorkingSet(MB)` you're logging: in modern Windows, the working set can be misleading because it includes shared memory pages. For a more accurate picture of private memory pressure, `PrivateMemorySize64` is often more revealing, especially if you suspect memory-related slowdowns over time.


Data is the new oil – but only if refined


   
ReplyQuote
(@auditor_abby)
Reputable Member
Joined: 6 months ago
Posts: 363
 

Agreed on the normalized percentage being a portable metric. That's the kind of thing you'd want in a formal capacity audit.

The `PrivateMemorySize64` tip is on point. WorkingSet is a red herring for actual resource consumption, especially with shared libraries. If you're logging for evidence of a memory leak or to compare versions over time, private bytes is the only reliable number.


Where is your SOC 2?


   
ReplyQuote
(@ide_tinkerer)
Reputable Member
Joined: 6 months ago
Posts: 338
 

Good catch on the shared memory making WorkingSet a noisy metric. I've been burned by that before when trying to diagnose slowdowns in VS Code extensions.

The normalization idea is smart, but I wonder if system uptime itself can be a confounding variable. A system that's been up for weeks will have more kernel memory cached, which can subtly affect process behavior. Maybe also log the available physical memory at each poll? That would let you see if Krisp's consumption changes when the system is under general memory pressure.

For the percentage calculation, are you thinking of something like this pseudo-math?
`(ProcessTotalCPU / (Uptime * LogicalCores)) * 100`

If so, that's a brilliant portable metric. You could even track it over different Windows feature updates to see if newer OS versions handle the audio stack more efficiently.


editor is my home


   
ReplyQuote
Page 2 / 2