Re: Memory and CPU Usage Script

2014-06-15 Thread Mark Wieder
Richard-

Thursday, June 12, 2014, 3:45:55 PM, you wrote:

 http://osxbook.com/book/bonus/ancient/procfs/

That's a dead link, and even osxbook.com just returns Hello.

I treasure my hardcopy of that book, and apparently there's an updated
version in the works. Serious geeky wonderfulness for anyone willing
do dive that deep, but definitely in need of an upgrade: a lot has
changed since 2006.

http://blog.darkrainfall.org/2013/01/os-x-internals/

For now, check out the sysctl commands:

https://superuser.com/questions/631693/where-is-the-proc-folder-on-mac-os-x

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-12 Thread J. Landman Gay

On 6/6/2014, 7:33 PM, Richard Gaskin wrote:


But even more fun, you can take a trip back to 1997 to read Scott
Raney's article in Linux Journal about using LiveCode (back then called
MetaCard) to build a GUI for top:
http://porky.linuxjournal.com:8080/LJ/043/2110.html


This looked pretty cool so I recreated his stack. I think Mavericks 
stores the file somewhere else because the scripts ran just fine but I 
got no data back.


If anyone knows where Mavericks put the file, I'd like to try it. As-is, 
it's looking for /proc/stat and there is no proc folder in OS X.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-12 Thread Richard Gaskin

J. Landman Gay wrote:


On 6/6/2014, 7:33 PM, Richard Gaskin wrote:


But even more fun, you can take a trip back to 1997 to read Scott
Raney's article in Linux Journal about using LiveCode (back then called
MetaCard) to build a GUI for top:
http://porky.linuxjournal.com:8080/LJ/043/2110.html


This looked pretty cool so I recreated his stack. I think Mavericks
stores the file somewhere else because the scripts ran just fine but I
got no data back.

If anyone knows where Mavericks put the file, I'd like to try it. As-is,
it's looking for /proc/stat and there is no proc folder in OS X.


One nice thing about Unix/Linux is that everything is setup to appear as 
a file, so piping and other goodies work together nicely.


One tricky thing about Unix/Linux is that not everything that appears to 
be a file is actually a file. :)


/proc is a virtual file system containing system info (processes). 
It's more akin to an associative array than a directory tree.


Handy as it is, not all *nixes support it - this site explains more, 
with some suggestions of OS X alternatives to some /proc info:


http://osxbook.com/book/bonus/ancient/procfs/

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-12 Thread J. Landman Gay

On 6/12/2014, 5:45 PM, Richard Gaskin wrote:


Handy as it is, not all *nixes support it - this site explains more,
with some suggestions of OS X alternatives to some /proc info:

http://osxbook.com/book/bonus/ancient/procfs/



Thanks, but this would be way more work than the simple example I was 
trying to build, so until I become proficient with *nix I think I'll let 
this go. I'd have to study for days before I could even understand what 
that web page is saying. I'll just put my little stack into a pending 
folder for now.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Earthednet-wp
Kay,
Thanks for that. It may come in handy some time.
Bill

William Prothero
http://es.earthednet.org

 On Jun 6, 2014, at 4:38 AM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
 For the first time, on OS X, I ran out of memory. Whilst Activity
 Monitor is good, it doesn’t really give you a way to log memory usage
 and trace areas that may be causing concern. So I googled the problem
 and discovered a LOT of answers involving php,ruby,awk,grep,pipes and
 a bunch of other stuff that suggested I could roll my own with LC. So
 at the bottom you’ll find a script that will output* some nice tab
 formatted memory and CPU info:

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Memory and CPU Usage Script

2014-06-06 Thread Mark Wieder
Kay C Lan lan.kc.macmail@... writes:

 at the bottom you’ll find a script that will output* some nice tab
 formatted memory and CPU info:

Nice, but top didn't give you what you were looking for?

-- 
 Mark Wieder
 ahsoftw...@gmail.com



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Memory and CPU Usage Script

2014-06-06 Thread Kay C Lan
On Sat, Jun 7, 2014 at 2:21 AM, Mark Wieder mwie...@ahsoftware.net wrote:

 Nice, but top didn't give you what you were looking for?

I noticed in my search that people reported top as being quite CPU
intensive and in my own tests it went to No2, just below LC when I was
running my stacks; so a bit chicken and egg, I wanted to know what was
using my memory and CPU and using top was always going to place itself
in the list.  This is understandable as top is active whilst the id,
ps, and vm_stat are all static, but I notice that even Activity
Monitor with all it's bells and whistles uses significantly less CPU
than top.

Plus, it was more of an exercise to see if I could reinvent the wheel
and build something similar in LC that could be customised to report
exactly what I was interested in, when I was interested in it, no
more, no less. Hopefully it will provide a stepping off point for
others to adjust the output to exactly meet their needs.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Richard Gaskin

Kay C Lan wrote:

 I wanted to know what was using my memory and CPU and using top
 was always going to place itself in the list.  This is understandable
 as top is active whilst the id, ps, and vm_stat are all static, but I
 notice that even Activity Monitor with all it's bells and whistles
 uses significantly less CPU than top.

You can run top just once with:

top -bn1

But even more fun, you can take a trip back to 1997 to read Scott 
Raney's article in Linux Journal about using LiveCode (back then called 
MetaCard) to build a GUI for top:

http://porky.linuxjournal.com:8080/LJ/043/2110.html

--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter:  http://twitter.com/FourthWorldSys

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Kay C Lan
Thanks Richard, I strangely feel chuffed about the fact that I'm
reinventing a wheel already built by the legendary Man himself. I
might have to look into a few more of the top options: -bn1 didn't
work on my 10.9.3 but clearly there must be an OS X equivalent.

On Sat, Jun 7, 2014 at 8:33 AM, Richard Gaskin
ambassa...@fourthworld.com wrote:
 Kay C Lan wrote:

 I wanted to know what was using my memory and CPU and using top
 was always going to place itself in the list.  This is understandable
 as top is active whilst the id, ps, and vm_stat are all static, but I
 notice that even Activity Monitor with all it's bells and whistles
 uses significantly less CPU than top.

 You can run top just once with:

 top -bn1

 But even more fun, you can take a trip back to 1997 to read Scott Raney's
 article in Linux Journal about using LiveCode (back then called MetaCard)
 to build a GUI for top:
 http://porky.linuxjournal.com:8080/LJ/043/2110.html

 --
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys


 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Richard Gaskin

Kay C Lan wrote:

 Thanks Richard, I strangely feel chuffed about the fact that I'm
 reinventing a wheel already built by the legendary Man himself.

Au contraire:  I consider it one of those great GMTA moments - at least 
you're in good company. :)


Besides, your layout bested top's - not bad.


 I might have to look into a few more of the top options: -bn1
 didn't work on my 10.9.3 but clearly there must be an OS X
 equivalent.

Yeah, there are just enough differences between OS X and Linux that it 
can get annoying jumping between them all day (worse if you need the 
latest, most secure versions of things like Apache and rsync - OS X 
ships with some surprisingly old stuff) - I think this is the OS X version:


top -l1

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for Desktop, Mobile, and Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Mark Wieder
Richard-

Friday, June 6, 2014, 8:25:19 PM, you wrote:

 OS X ships with some surprisingly old stuff

homebrew

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Mark Wieder
Kay-

Friday, June 6, 2014, 5:19:10 PM, you wrote:

 I noticed in my search that people reported top as being quite CPU
 intensive and in my own tests it went to No2, just below LC when I was
 running my stacks; so a bit chicken and egg, I wanted to know what was
 using my memory and CPU and using top was always going to place itself
 in the list.  This is understandable as top is active whilst the id,
 ps, and vm_stat are all static, but I notice that even Activity
 Monitor with all it's bells and whistles uses significantly less CPU
 than top.

OK. That makes sense. Top is cpu-intensive, and has to be in order to
do what it does. I don't think it's a memory hog, though, and I
thought that was what you were concerned with in the first place,
since you posted that you ran out of memory.

 Plus, it was more of an exercise to see if I could reinvent the wheel
 and build something similar in LC that could be customised to report
 exactly what I was interested in, when I was interested in it, no
 more, no less. Hopefully it will provide a stepping off point for
 others to adjust the output to exactly meet their needs.

Yes, thanks for posting it. It's quite nicely done.

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Memory and CPU Usage Script

2014-06-06 Thread Richard Gaskin

Mark Wieder wrote:

 Richard-

 Friday, June 6, 2014, 8:25:19 PM, you wrote:

 OS X ships with some surprisingly old stuff

 homebrew

Homebrew is a great solution for people like you and me, but for most 
Mac customers Apple hasn't been forthcoming about how outdated and 
vulnerable many system components are, any more than they've let the 19% 
of Mac users still depending on Snow Leopard know that they're not 
getting any more critical security updates at all.


For a company whose marketing message frequently devolves into random 
jabs against other systems' security (often unfounded), I'm surprised 
Cook has let the situation with their own products continue in this 
cavalier way so long.  I had always seen Cook as the cool-headed 
long-term thinker


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for Desktop, Mobile, and Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode