Guest post by Mike! I had originally posted this as a gist on github, but Paul selflessly insisted that I blog about it, so here you go.
I like to use kcachegrind for doing profiling of my ruby code via ruby-prof. This works fantastically if you’re on a platform that has KDE installed. However, most of my development is done on OSX, and while you can install kcachegrind via macports, it takes hours and hours because it has to build KDE, as well. Much to my surprise, the fine folks who wrote kcachegrind also made a QT version, qcachegrind. I was able to build this on OSX in about 10 minutes without too much effort, only having to install QT and GraphViz. Yippie!
I should note that I’m running OSX 10.6.7, with Xcode 4. My default gcc/g++ version is 4.2. I’m sure it will build just fine on earlier versions of Xcode, but I haven’t tested it.
You could do this via “brew install qt” if you have homebrew, but this takes a long time, so I downloaded the binary distribution of version 4.7.3 for OSX 10.5/10.6 from this page. Installing is easy: open up the dmg, and install QT via the mpkg file contained within.
Second, you should install Graphviz so that qcachegrind can generate pretty call graphs for you. Like before, you could install this via “brew install graphviz”, but this also takes a really long time and I’m super impatient, so I just downloaded the latest binary installer from this page.
sudo ln -s /usr/local/bin/dot /usr/bin/dot
This is actually simple. Check out the source code for kcachegrind and switch to the qcachegrind directory:
svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk/kcachegrind kcachegrind cd kcachegrind/qcachegrind
You build the application by running ‘qmake’, a QT utility that can generate a boring-old Makefile, if we ask it nicely enough. By default, qmake wanted to build an xcode project on my box. I pointed it at spec profile that generates a Makefile that will build using g++, and things seemed to work fine. You can see all the profiles available in this directory: /usr/local/Qt4.7/mkspecs. This command also managed to spit out a whole bunch of errors and warnings, yet everything seemed to build properly.
qmake -spec 'macx-g++' make
You should now have a beautiful little “qcachegrind.app” sitting in your build directory. You can run this directly via “open qcachegrind.app”, or you can drop it in your /Applications directory for easy access.
brew install qt --with-qt3support
(I haven’t tested this out, myself).
We’ve recently started integrating MongoDB more extensively into our systems at work and found ourselves wanting some basic monitoring during dev to see what the DB was doing. A friend suggested Mongo Live, which fit the bill but was only compatible with Chrome. Since I switch frequently between Safari and Chrome I decided to port it.
Fortunately the extension for Chrome required only minimal changes to get it working in Safari. The most significant change is that the Safari extension uses a toolbar button to activate. The fork is available on Github and supports Chrome and Safari. Hopefully someone finds it helpful!