Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7691901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:43:45+00:00 2026-05-31T20:43:45+00:00

I am implementing a logging function and I would like to keep track of

  • 0

I am implementing a logging function and I would like to keep track of how much data a request to my PHP script returns to the client.

Basically I want to add a logger in the end of my function that determines the time the request took (using microtime() function), how much memory was used at peak (using memory_get_peak_usage() function) and how much data was returned to the client (basically how much data my script output generates, even if this was not actually sent to the client). This allows me to basically calculate the approximate possible bandwidth my script generates per request.

Now, I do know that I could use ob_*() series of functions that deal with output buffer, but I am already using these functions across the script in number of places and I don’t want to suffer from performance hit when adding another layer on top of everything.

Is there a function I could use in PHP that tells me at any point in the script how much output data has been generated by my script so far?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:43:46+00:00Added an answer on May 31, 2026 at 8:43 pm

    PHP does not keep an internal count of what you have sent to the client so far (that would be adding another layer on top of everything, even for those who do not need this functionality), so there is nothing you can do except using the output buffering functions to gather content before sending it.

    Did you actually try wrapping more output buffering around your script and found the performance difference unacceptable?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a RESTful web service in python and would like to add some
I would like to extend the cakephp logging facility. Using $this->log($msg, $level) you can
I would like to somehow log every time Thread.interrupt() is called, logging which Thread
I'm implementing a web application and on the serverside I need to keep track
we are currently implementing logging functionality with Log4net into our ASP.NET web-services. Therefore we
implementing publishActivity in PHP using the REST API using this code: $activity = array(
I'm implementing a logging feature on a asp.net mvc2 application, that uses SqlServer2008 as
I'm currently working on implementing a logging system for a new Hadoop cluster I've
How would I go about implementing the MainPage class? import cgi import os import
I'm writing a Facebook iframe/canvas app and would like to give users the ability

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.