Ejemplo n.º 1
0
static void
set_uri (Event_Type et, Call * c)
{
  int len, did_wrap = 0;
  const char *uri;

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

  do
    {
      if (fcurrent >= fend)
	{
	  if (did_wrap)
	    panic ("%s: %s does not contain any valid URIs\n",
		   prog_name, param.wlog.file);
	  did_wrap = 1;

	  /* We reached the end of the uri list so wrap around to the
	     beginning.  If not looping, also ask for the test to stop
	     as soon as possible (the current request will still go
	     out, but httperf won't wait for its reply to show up).  */
	  fcurrent = fbase;
	  if (!param.wlog.do_loop)
	    core_exit ();
	}
      uri = fcurrent;
      len = strlen (fcurrent);
      call_set_uri (c, uri, len);
      fcurrent += len + 1;
    }
  while (len == 0);

  if (verbose)
    printf ("%s: accessing URI `%s'\n", prog_name, uri);
}
Ejemplo n.º 2
0
static void
sess_destroyed (Event_Type et, Object *obj, Any_Type regarg, Any_Type callarg)
{
  Sess_Private_Data *priv;
  Sess *sess;
  Time now;
  
  assert (et == EV_SESS_DESTROYED && object_is_sess (obj));
  sess = (Sess *) obj;

  priv = SESS_PRIVATE_DATA (sess);
 
  now=timer_now();
  if(now>=end)core_exit();
  if (++num_sessions_destroyed >= param.wsessreq.num_sessions) core_exit ();
}
Ejemplo n.º 3
0
static void
sess_destroyed(Event_Type et, Object *obj, Any_Type regarg, Any_Type callarg) {
    Sess_Private_Data *priv;
    Sess *sess;

    assert(et == EV_SESS_DESTROYED && object_is_sess(obj));
    sess = (Sess *) obj;

    priv = SESS_PRIVATE_DATA (sess);
    if (priv->timer) {
        timer_cancel(priv->timer);
        priv->timer = 0;
    }

    if (++num_sessions_destroyed >= param.wsesslog.num_sessions)
        core_exit();
}
Ejemplo n.º 4
0
static void
set_uri (Event_Type et, Call * c)
{
  char *uri;
  int uri_len, did_wrap = 0, range_len, input_len;
  const char *input_line;

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

  do
    {
      if (fcurrent >= fend)
		{
    	  if (did_wrap)
			panic ("%s: %s does not contain any valid URIs\n",
			   prog_name, param.wrangelog.file);
		  did_wrap = 1;

		  /* We reached the end of the uri list so wrap around to the
			 beginning.  If not looping, also ask for the test to stop
			 as soon as possible (the current request will still go
			 out, but httperf won't wait for its reply to show up).  */
		  fcurrent = fbase;
		  if (!param.wrangelog.do_loop)
			core_exit ();

		}
        input_line = fcurrent;

        input_len = strlen (fcurrent);


      /*****************************/
//        int j;
//        while (input_line[j] != ' ') {
//        	j++;
//        	if (j > input_len)
//        	{
//        		panic ("Error: illegal format for wrangelog\n");
//        	}
//        }
//
//        uri_len = j;

        uri_len = strcspn( input_line, " ");

        uri = fcurrent;

        /***************************/
        int range_size = input_len - uri_len - 1;

        char prefix_extra_hdrs[] = "Range: bytes=";
		size_t prefix_size = strlen(prefix_extra_hdrs);
		char suffix_extra_hdrs[] = "\r\n";
		size_t suffix_size = strlen(suffix_extra_hdrs);

		size_t  extra_header_len = prefix_size + range_size + suffix_size;
		c->extra_header = (char*) malloc( sizeof(char) * extra_header_len);



		// Copy the prefix
   	    strncpy(c->extra_header, prefix_extra_hdrs, prefix_size);

   	    // Copy the range value
   	    strncpy(c->extra_header + prefix_size, fcurrent + uri_len + 1, range_size);

   	    // Copy the suffix
   	    strncpy(c->extra_header + prefix_size + range_size, suffix_extra_hdrs, suffix_size);

   	    call_set_uri (c, uri, uri_len);
   	 	fcurrent += input_len + 1;

   	 	call_append_request_header (c, c->extra_header,extra_header_len);



    }
  while (input_len == 0);

  if (verbose)
    printf ("%s: accessing URI `%s'\n", prog_name, uri);
}
Ejemplo n.º 5
0
static void
destroyed (void)
{
  if (++num_conns_destroyed >= param.num_conns)
    core_exit ();
}