Hacker News new | past | comments | ask | show | jobs | submit login
Hidden gems in Mac OS X (dtrace.org)
345 points by ahalan on March 10, 2012 | hide | past | favorite | 50 comments



Not sure if it qualifies as a "hidden gem" in OS X itself, but the new Signature management in Preview, using the built in iSight to scan a handwritten sig off a sheet of paper, is an amazing time saver.

// Number 8, bitesize.d, rocks.


This article is not like a lifehacker “10 neato things to be more productive on your mac” article. It's specifically about using DTrace to get detailed statistics on processes making system calls.

It's also several months old :)


Honestly, so far none of these have been the major performance bottleneck on my Macbook. For me, it's been RAM. Even though I have 4 GB of RAM, I have at least 3 GB wired or active at any given time - Chrome alone takes up roughly 1 GB of it, with all its helper processes. But unfortunately I really have no idea how to bring my RAM usage down.


You don't really want to bring your RAM usage down. Unused RAM is a performance hit. Sure, some applications are hogs and that can result in a performance hit for background processes and task switching, but high RAM utilization is GOOD for performance, not bad.


High RAM utilization is only good when your RAM is topped off with cache and buffer use. It's bad when it's all consumed by program data that forces the OS to swap other running application stuff to disk, especially if you're using several programs at once.


why would all the memory of chrome be in RAM and other programs not? I suppose there must be lots of swapped data there too. Doesn't crome have a separate sub? process for each tab with not much shared between tabs?

In looking for ways to free disk space on my SSD I find that the chrome ~Library/Cache can grow to insane proportions (5G?)


I had the same issue until I upgraded to 8 GB. I'd recommend to anybody to go for 8GB directly. For me (or any other heavy user), 4GB is just not enough to run MacOS X (the 'kernel_task' alone takes >500MB).


I just upgraded to 16 gigs and it's amazing. The time for a suspend and restore of a parallels virtual instance went down by a large factor; it's now just 10 seconds to restore and 5 seconds to suspend with 2 gigs allocated to it.


I wanted to pipe in to say the same thing. For the longest time, I thought my Late 2008 15" MBP couldn't handle 8GB (chipset issue, I though). I figured 6GB was the largest, and I just stayed with the 4GB as it came from the factory. Then one day late last year, I realized that a) the Late 2008 15" MBP can take 8GB and b) 8GB of RAM was now VERY affordable.

It made a huge difference. No more constant thrashing of the HDD as it tries to manage a large swap file.


And here's a link with some evidence for 8GB in that MacBook Pro, for posterity: http://blog.macsales.com/9102-secret-firmware-lets-late-08-m...


Agreed, particularly on my MacBook Air where ~1GB is reserved for the shared video memory. I have to close Firefox or Chrome if I want to do any development work (our research compiler is a bit of a memory hog) without having a process get swapped out.

I would offer ridiculous gobs of money to upgrade to even 6GB.


Where did you get your ~1GB number? It's 384 megabytes on machines with 4GB, probably 256 on 2GB.

(If you have 13.3" MBP with 8GB of RAM, it carves out 512 MB for video memory.)


Maybe he has the 27" screen attached.


Yup, I connect to an external monitor. And worse, it doesn't seem to give that memory back without rebooting.

Sorry --- that was an important detail that I should have included.


"Even though I have 40 employees, I have at least 30 employees working at any given time."


My system starts to swap as it gets down to the last ~20% of its memory.


I had the same issue, and seriously: buy more RAM. A 2x4G kit from Crucial cost me $45 shipped.


And it's not much more of a financial leap to get to 16gb in a MacBook. 16.


I did not know some models were capable of supporting 16gb of RAM. Unfortunately, I don't think I have one of those models (I think I got mine in 2009). This is good to know, though.


I didn't know either, I'm actually not sure if 16 is officially supported, since Apple said my Macbook was only capable of 8. Crucial has a tool you can download to check compatibility with their various products and your specific macbook model.


Only specific, later generation models of Apple laptops can use 16 GB of RAM. It is NOT officially supported, but it works. The thermal profile likely hasn't been certified by Apple to the point they are comfortable supporting it, but it works at the electrical and logic signal levels.


The 2009 will support 6 or 8, depending on model. It is worth it.


Yeah I have 8 in a mid-2009 model, but I'm trying to sell it so that I can put it towards whatever Apple releases in the next few months. If I do sell it, I'll be torn between a MBA or a MBP.


sadly, can't upgrade the ram in the newer MBAs. this is the main reason i didn't keep mine (even though i wanted to)...VM + IDE + lots of browser instances open turned out to be kinda painful.


This.

I don't have a MacBook, but upgrading 4 Gb to 16 Gb in my iMac made a huge difference.


I hear you. I have a 2008 IMac and I wish i could put 8GB or more in it.


One of the features that differentiated Macs from Windows early on for me was how they systemized PDFs. Not only could it read and write PDFs, it was eager to do so.


It's really easy to create PDFs from Apple's built-in Quartz 2D drawing engine (of the Core Graphics framework). That probably has a lot to do with it.


And the reason for that is because NeXT used PostScript for rendering - use the same language for displaying on-screen as on paper. When NeXTStep became OSX PDF was used instead (I believe because of a bust up between Steve Jobs and Adobe over licensing)


OS9 seemed to have great PDF support if I remember.

Is what you say the reason macs are preferred for desktop publishing?


It's going back a while but I believe it was the graphical nature of Macs, coupled with the LaserWriter printer that made DTP important for Macs. Which in turn prompted the use of Postscript in NeXTstep.


Is there anything that lets you view how much network _bandwidth_ an application is using? I've looked before with no luck.


Since Lion, nettop ships with the system. Hit d to switch to delta instead of total usage, p for human-readable numbers, and left arrow to collapse into process names.


Awesome tip. Thanks!!!


On linux there's nethogs. http://nethogs.sourceforge.net/

Apparently there's ntop which works on all platforms and has all kinds of snazzy features but I've never tried it personally. http://www.ntop.org/products/ntop/


There's an app for that, http://rubbernetapp.com (not free)


iStat pro widget gives you this info (and much more). Once installed, one key press (F4) and you've got all the info you need.


About "why is my Macbook fan so loud?", has anyone successfully attempted to clean out dust from inside the laptop to reduce the fan noise?


I did on my older MacbookPro5,1. It didn't even seem like I dislodged much dust, but it made a huge difference. Now the fans don't go above 3-4000 rpm even with the cpu pegged, which is quiet. Before it would consistently spin the fan at max speed even with modest cpu use. This old beast is far quieter under load than the new MacBook Air 13" I had for a week and returned.


I'd suggest downloading smcFanControl. That's what I use on my MB Pro, and it works well. You can set different modes that will keep the fan at or below a certain RPM. If I'm gaming, I let it go up to 6200 rpm. If I'm not doing much (like now, just browsing on the internet and maybe running a couple other programs) I drop it to 3000rpm. That usually puts me around 45* C and keeps it nice and quiet. Then I've got a middle setting at about 4200rpm that makes some noise, but isn't quite as obnoxious as full throttle.


+1 from me: smcFanControl is seriously handy if you do any sort of coding on a macbook. Was recently running a genetic algorithm on it and the app allowed me to bump the fan speed up to something ridiculous in order to keep the cpu at a comfortable temperature. I also tend to raise the speed if I'm watching flash video, since that's still ridiculously cpu intensive on a mac...


Yup. Last time I opened it up (to replace the optical with a second SSD), I placed it electronics-down over open space (propped an edge against the table, held it up with a hand) and air-canned all the crap out of it.


Excellent list, one of those things that I keep coming back to hacker news for.


Nice one. Getting to know DTrace was on my todo list for the next few moths.


>> Why Unix? Mac OS X is Unix under the hood: the Darwin kernel

Just beeing pedantic but I think Darwin is the operating system, not the kernel. The kernel is Mach 3.


Well if we're being pedants about it, then the kernel is XNU ( http://opensource.apple.com/source/xnu/xnu-1699.24.23/ )


I once tried to look into dtrace because I was missing strace from Linux. I gave up when I realized I had to learn a whole language just to do what strace did for me on Linux.

Now I'm enlightened to see there is dtruss. It works different than strace and needs privileges, but I'm glad that I've found the strace alternative.


dtrace is not supposed to replace strace on Linux. It's allows you track and process all sorts of parameters of your operating system and it's programs. It's essentially a quick way to introspect into your application without tons of printf hacks, and get to the buttom of bugs and performance issues.


The language is really just awk.


I never knew about this tool--my mind has been blown. Thank you OP!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: