On Sat, Oct 10, 2009 at 11:08 AM, jon <trambl...@mac.com> wrote:

> Hi Bill,  in this theme of normal behavior,  maybe this would make what i'm
> asking more clear.
>
> in an exercise of thought,  if you wrote an app,  and the only thing it did
> was  put up a window permanently (for the run of it's process life),  with a
> single webview in it,  and hardwired a load of any particular website you
> wished that had any substance to load in that webview...   and then put in a
> trigger to simply reload that same website every 20 seconds...   and that
> was it,  no number crunching,  or extra processes, or UI.
>
> if you had to guess,  if you looked in activity monitor,   do you think
> this thought experiment would use disk IO every 20 seconds?


I built a simple application with a single window, a WebView, a text field
for URL, and a button to trigger a reload... all defined in the main xib. No
other code written. I turned off support for plugins, java and javascript
for the fun of it. Then I monitored that application and found the following
every time I loaded a page.

MacPro:~ shawnce$ sudo fs_usage -w -f filesys 26906 | tee fstrace.txt
11:24:03.163  open              F=7        (R_____)
 /Users/shawnce/Library/Cookies/Cookies.plist
             0.000071   MyBasicWebView
11:24:03.163  fstat             F=7
                                                                 0.000005
MyBasicWebView
11:24:03.165  read              F=7    B=0xe55d1
                                                                0.000544
MyBasicWebView
11:24:03.165  close             F=7
                                                                 0.000016
MyBasicWebView
11:24:03.272  ioctl             F=7   <CMD=0x8004667e>
                                                                0.000003
MyBasicWebView
11:24:03.272  ioctl             F=10  <CMD=0xc0206911>
                                                                0.000004
MyBasicWebView
11:24:03.272  fcntl             F=7   <GETFL>
                                                                 0.000003
MyBasicWebView
11:24:03.322  ioctl             F=10  <CMD=0xc0206911>
                                                                0.000005
MyBasicWebView
11:24:03.322  ioctl             F=10  <CMD=0xc0206911>
                                                                0.000002
MyBasicWebView
11:24:03.322  ioctl             F=10  <CMD=0xc0206911>
                                                                0.000002
MyBasicWebView
11:24:03.322  ioctl             F=10  <CMD=0xc0206911>
                                                                0.000002
MyBasicWebView
11:24:03.322  ioctl             F=10  <CMD=0xc0206911>
                                                                0.000002
MyBasicWebView
11:24:03.645  fcntl             F=3   <SETLK>
                                                                 0.000007
MyBasicWebView
11:24:03.645  fcntl             F=3   <SETLK>
                                                                 0.000002
MyBasicWebView
11:24:03.645  fcntl             F=3   <SETLK>
                                                                 0.000003
MyBasicWebView
11:24:03.645  access                 [  2] (___F)
 /Users/shawnce/Library/Caches/com.yourcompany.MyBasicWebView/Cache.db-journal
          0.000082   MyBasicWebView
....long list of stuff snipped...

If I watch this application using the File Activity template of Instruments
I get a lot of nice information. For example I can see the stack track
related to a disk write among many other things.

  13 CFNetwork CFURLCacheWorkerThread(void*)
  12 CoreFoundation CFRunLoopRunInMode
  11 CoreFoundation CFRunLoopRunSpecific
  10 CFNetwork CFURLCacheTimerCallback(__CFRunLoopTimer*, void*)
   9 CFNetwork ProcessCacheTasks(__CFURLCache*)
   8 CFNetwork __CFURLCache::ExecuteSQLInsert(_CFCachedURLResponse const*,
__CFString const*, _CFURLRequest const*)
   7 CFNetwork __CFURLCache::StepSQLStatementToCompletion(sqlite3_stmt*,
long)
   6 libsqlite3.0.dylib sqlite3_step
   5 libsqlite3.0.dylib sqlite3Step
   4 libsqlite3.0.dylib sqlite3VdbeExec
   3 libsqlite3.0.dylib sqlite3BtreeInsert
   2 libsqlite3.0.dylib sqlite3PagerWrite
   1 libsqlite3.0.dylib pager_write
   0 libSystem.B.dylib pwrite$UNIX2003

Which is exactly what I expected (and others) given the fact that by default
the URL loading sub-system used on Mac OS X will attempt to cache remote
resources. This is all done in support of the standard HTTP resource caching
scheme.

For example review...

<
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/URLLoadingSystem/Concepts/CachePolicies.html#//apple_ref/doc/uid/20001843-BAJEAIEE
>

<
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/WebKit/Classes/WebPreferences_Class/Reference/Reference.html#//apple_ref/occ/instm/WebPreferences/setCacheModel
:>

-Shawn
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to