Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: FSDirectorySize code finished
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FSDirectorySize code finished




On Oct 30, 2005, at 3:03 PM, Lawrence Sanbourne wrote:

How did you get Shark to tell you this? I have very little experience
with Shark, and when I ran it it said that about 40% of the time was
spent in dyld_something_or_other. How do you get it to show you the
useful information you got?

It's hard to explain how to use it exactly. It's kind of like explaining how to walk on two feet without falling over. You fail a lot and then finally you just figure out how to do it. I'm by no means an expert but I've gotten better at "getting to the information."

In particular your "dyld something or other" might look more interesting to you if you check the "Charge System Libraries to Callers" box in the Callstack Data Mining section of the side-drawer.  If you check this and then switch to "Heavy" view, you'll see the function from you app that was heaviest in the sample tree. Other tips:

1. Play with both the "Heavy" and "Top Down" views. You might find the "top-down" confusing and misleading if there is a lot of recursion or what-not. But it does give a good perspective on "where everything goes." 

2. When you get to something "heavy," double click it. You'll get a source/assembly view of the function you clicked.  You can spot "hot spots" from this view and figure out exactly where you'll get the biggest bang for your buck.

How does it compare to Finder on your computer (which, granted, may be
able to benefit from some creative caching)? Try doing File > Get Info
on your home directory and stop your timer when the directory size
appears. Interestingly enough, I actually found that my routine ran
twice as fast as du -skh, but I guess that's probably an artifact of
caching.

It took a heck of a long time in the Finder, too. I tried to capture it but I messed up, and now it's cached.

So: You'd recommend trying the STL? Or should I focus on eliminating
recursion and reducing the number of memory allocations by doing this
computation iteratively?

I've never used STL stuff myself, but it sounds like it would probably be at least a bit faster.

And if you don't mind: How do I use Shark to figure out how much time
is spent allocating memory (and thus answer the above question
myself)? I had trouble making sense of the documentation; it's very
vague/general.

I haven't played too much with the malloc trace functionality, but maybe that would be helpful. I usually find it helpful enough to just capture all activity in an app and then go mining for interesting stuff.

Daniel

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: FSDirectorySize code finished (From: Laurence Harris <email@hidden>)
 >Re: FSDirectorySize code finished (From: Daniel Jalkut <email@hidden>)
 >Re: FSDirectorySize code finished (From: Lawrence Sanbourne <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.