SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict MarekS's Avatar
    Join Date
    Jan 2003
    Location
    Estonia / Tallinn
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 Q's 1) used memory 2) requests made

    Here are my 2 questions:

    1) It is possible to set a max usable memory limit for a page (ini_set memory_limit), but is it somehow possible to get the amount (say bytes) of USED memory?

    I quess not, but still - maybe?

    2) I sow somewhere on the net a website that had a similar message on the footer: "Page generated in 0.08 seconds, 45 requests was made". Now, I can handle the execution time, but how do you do the request count?

    muchos gracias,

    - MarekS -

  2. #2
    SitePoint Member
    Join Date
    Aug 2003
    Location
    Brazil
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) You can get the memory usage with a function which appeared only in 4.3.0(?) and seems to work only on linux(?), memory_get_usage()

    2) Probably what is meant is that there were 45 sql queries... Unless it is some kind of hit couting? There are free scripts avaliable for that, if this is the case..

  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I seriously doubt that there were 45 SQL queries on the page, thats huge!

  4. #4
    SitePoint Addict MarekS's Avatar
    Join Date
    Jan 2003
    Location
    Estonia / Tallinn
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes that might be a SQL query count (since I'm not sure if it was 40 or 20 or even less). I saw this information on some phpBB based site - though - it seems not be in the phpBB package by default. (I took a quick peek today)

    - MarekS -

  5. #5
    SitePoint Guru
    Join Date
    Nov 2002
    Posts
    841
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that memory_get_usage only works if you have compiled PHP with --enable-memory-limit. You can compile older versions of PHP with this option to see the memory usage via the log file...See this post.

  6. #6
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DJ P@CkMaN
    I seriously doubt that there were 45 SQL queries on the page, thats huge!
    Off Topic:

    Heh, I found a script that I use was generating over 300 SQL queries per page view not so long ago. Needless to say neither I nor my hosts were very pleased!

    A few hours spent with PHPEdit and PEAR::Cache_Lite got the average query count down to 16 though. I suspect the apps internal caching was actually broken.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Location
    Bay Area, CA; (Pasadena, CA this fall)
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps there's a better way, but how I did a sql-query counter:
    Replace all calls to mysql_query with db_query
    Define my own function called db_query that looks like this:
    function db_query ($sql)
    {
    global $counter;
    $counter++;
    return mysql_query($sql);
    }
    Last edited by webhappy; Sep 16, 2003 at 20:40.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •