Re: [sqlite] How to retrieve number of cached pages in memory?

2008-04-22 Thread Ralf Junker

>  See the "Pager" data structure and associated variables and functions
>  in "sqlite-3.5.x/src/pager.c".

OK, it seems that the number I am interested in is stored as part of the Pager 
struct:

int nPage;  /* Total number of in-memory pages */

Now I just have to figure out how to access this number reliably.

Many thanks,

Ralf 

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to retrieve number of cached pages in memory?

2008-04-22 Thread Richard Klein
You're right!  A grep of the source code confirms
that.  My mistake.

- Richard

Jay A. Kreibich wrote:
> On Tue, Apr 22, 2008 at 03:33:27PM -0700, Richard Klein scratched on the wall:
>> You can call sqlite3_memory_highwater() to find
>> the maximum amount of memory (in bytes) that your
>> app has used.
>>
>> Then you can divide this number by 2000 (the default
>> size of a page) to determine the max number of pages
>> that have been cached.
> 
> 
>   The default page size is 1024 bytes.
> 
>   The default cache size (in pages) is 2000.
> 
> 
>   (At least according to http://www.sqlite.org/compile.html)
> 
> 
> -j
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to retrieve number of cached pages in memory?

2008-04-22 Thread Jay A. Kreibich
On Tue, Apr 22, 2008 at 03:33:27PM -0700, Richard Klein scratched on the wall:
> You can call sqlite3_memory_highwater() to find
> the maximum amount of memory (in bytes) that your
> app has used.
> 
> Then you can divide this number by 2000 (the default
> size of a page) to determine the max number of pages
> that have been cached.


  The default page size is 1024 bytes.

  The default cache size (in pages) is 2000.


  (At least according to http://www.sqlite.org/compile.html)


-j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to retrieve number of cached pages in memory?

2008-04-22 Thread Jay A. Kreibich
On Wed, Apr 23, 2008 at 12:19:45AM +0200, Ralf Junker scratched on the wall:
> I need to retrieve the number of pages a SQLite database connection has 
> currently allocated in memory. The documentation unfortunately turned up
> no results. I know about "PRAGMA cache_size", but this returns the
> maximum number of pages possibly allowed in the cache, not the actual
> number of pages currently cached.
> 
> My aim is to calculate the accurate number of bytes actually consumed by
> a single cached page. This figure will then allow to set PRAGMA
> cache_size to a more precise value in order to limit memory usage.
> 
> I do mind using undocumented APIs and will not cry tears if they
> change without notice, so any pointers are welcome!

  See the "Pager" data structure and associated variables and functions
  in "sqlite-3.5.x/src/pager.c".

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to retrieve number of cached pages in memory?

2008-04-22 Thread Richard Klein
You can call sqlite3_memory_highwater() to find
the maximum amount of memory (in bytes) that your
app has used.

Then you can divide this number by 2000 (the default
size of a page) to determine the max number of pages
that have been cached.

- Richard Klein

Ralf Junker wrote:
> I need to retrieve the number of pages a SQLite database connection has 
> currently allocated in memory. The documentation unfortunately turned up no 
> results. I know about "PRAGMA cache_size", but this returns the maximum 
> number of pages possibly allowed in the cache, not the actual number of pages 
> currently cached.
> 
> My aim is to calculate the accurate number of bytes actually consumed by a 
> single cached page. This figure will then allow to set PRAGMA cache_size to a 
> more precise value in order to limit memory usage.
> 
> I do mind using undocumented APIs and will not cry tears if they change 
> without notice, so any pointers are welcome!
> 
> Many thanks,
> 
> Ralf
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users