Logging "Activity Monitor" to file?

Posted on
Tue Dec 26, 2017 6:10 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Logging "Activity Monitor" to file?

Do any of you Mac gurus know if it's possible to log a CPU and Memory usage snapshot to file per day?

I've a problem with my Mac which I suspect is a plugin getting a tiny bit greedy every day such that after about 6-8 weeks my Mac becomes unresponsive.

I can't get in it remotely to debug it as it's unresponsive, and I can't use traditional user input devices as the monitor is "blanked" by TeamViewer (to stop my monitor constantly switching over when PC goes to sleep) and I can't therefore see what's happening on screen.

I can't see the last time it happened as text-searching for "Starting Indigo Server" in the /Logs folder doesn't find anything within the log retention.

I'm fancying logging daily snapshot of CPU/Memory then I can browse it after-the-fact next time the Mac goes in a coma.

Peter

Posted on
Wed Dec 27, 2017 5:03 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Logging "Activity Monitor" to file?

Not sure if this would help https://github.com/jeetsukumaran/Syrupy

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Wed Dec 27, 2017 5:20 am
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Logging "Activity Monitor" to file?


I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Dec 27, 2017 8:50 am
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: Logging "Activity Monitor" to file?

You can use something like this to dump the RSS (resident Set Size) memory usage for a given process. In the example below I check the Sonos Plugin process and dump to a file in the Indigo user's Document folder:

Code: Select all
ps x -o rss,command | grep Sonos.indigoPlugin |awk '{print $1}'|head -1>>/Users/Indigo/Documents/output.csv

In this example, 'output csv will contain one line for each time the process is ran, containing the RSS value of the process "Sonos.indigoPlugin"
Code: Select all
101976
101976

If you want a date and timestamp in the file, then use something like this:
Code: Select all
printf "`date '+%D, %X,'` `ps x -o rss,command | grep Sonos.indigoPlugin |awk '{print $1}'|head -1`\n" >>/Users/Indigo/Documents/output.csv

Which will produce this:
Code: Select all
12/27/17, 09:01:18, 101976
12/27/17, 09:01:20, 101976
12/27/17, 09:01:22, 101976
12/27/17, 09:01:23, 101976

You can use either cron or create a schedule in Indigo to run the above line (modified to suit your plugin and output path/file) and whatever interval you wish. Then just import the file into Excel or whatever to view the memory usage.

Terry

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests

cron