[httperf] Response Times

Arlitt, Martin martin.arlitt at hp.com
Wed Aug 15 08:40:43 PDT 2007

Hi Anoop

As you know there is currently no option in httperf to enable this, but
it is possible and relatively straightforward to do.

Also, as I'm sure you are aware, httperf distinguishes between the
response time and the transfer time for each reply, so I'll describe how
to record each of these.

You will need to modify two functions in stat/basic.c; recv_start (for
response times) and recv_stop (for transfer times).

static void
recv_start (Event_Type et, Object *obj, Any_Type reg_arg, Any_Type
  Call *c = (Call *) obj;
  Time now;
  Time delta; /* add this */

  assert (et == EV_CALL_RECV_START && object_is_call (c));

  now = timer_now ();

  delta = now - c->basic.time_send_start; /* add this */

  /* the following two lines print the response time information; */
  /* the if statement is optional */
  /* the print statement prints the response time and timestamp */
  /* modify the print statement to suit your needs */
  if (verbose) 
    printf("response-time = %-8.3f at %-8.3f\n", delta, now); 

  basic.call_response_sum += delta; /* modified */
  c->basic.time_recv_start = now;

static void
recv_stop (Event_Type et, Object *obj, Any_Type reg_arg, Any_Type
  Call *c = (Call *) obj;
  int index;
  Time now; /* added */
  Time delta; /* added */

  assert (et == EV_CALL_RECV_STOP && object_is_call (c));
  assert (c->basic.time_recv_start > 0);

  now = timer_now(); /* added */
  delta = now - c->basic.time_recv_start; /* added */

  /* as with recv_start, modify this to suit your needs */
  if (verbose)
    printf("transfer-time = %-8.3f at %-8.3f\n", delta, now);

  basic.call_xfer_sum += delta; /* modified */

  basic.hdr_bytes_received += c->reply.header_bytes;
  basic.reply_bytes_received += c->reply.content_bytes;
  basic.footer_bytes_received += c->reply.footer_bytes;

  index = (c->reply.status / 100);
  assert ((unsigned) index < NELEMS (basic.num_replies));


If you want to print out other information, you'll have to experiment
and test yourself; the above is what I did some years back, and it may
not be particularly useful for what you are trying to do (for example,
it does not record a connection or call identifier with each response or
transfer time, which you may want.

Keep in mind that this can easily generate a lot of data, and adds load
to httperf, so if you are really trying to stress a server, you may
significantly reduce the capacity of each httperf client.  In other
words, depending on what you are using this for, you may have to
reevaluate the capacity of your httperf clients.


> -----Original Message-----
> From: httperf-bounces at napali.hpl.hp.com [mailto:httperf-
> bounces at napali.hpl.hp.com] On Behalf Of anoop aryal
> Sent: Wednesday, August 15, 2007 8:11 AM
> To: httperf at napali.hpl.hp.com
> Subject: [httperf] Response Times
> Hi,
> Is there any way to collect the response times? I've seen that with
> LoadRunner - Wondering if that is possible with httperf.
> Anoop.
> aaryal at foresightint.com
> _______________________________________________
> httperf mailing list
> httperf at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/httperf/

More information about the httperf mailing list