[Newbiesh] Buf Switches

From: Gary Barnett (gbarnett@polarnet.com)
Date: 02/27/97

I have recently noticed that show stats is reporting a much higher
number of buf switches lately. (around 700 after 16 hours uptime)

After looking through the code, I'm still confused as to exactly
why this is happening.. or if it's even A Bad Thing?

Here is what seems to be the relevant section of the code


/* if we have enough space, just write to buffer and that's it! */
  if (t->bufspace >= size) {
    strcpy(t->output + t->bufptr, txt);
    t->bufspace -= size;
    t->bufptr += size;
   * If we're already using the large buffer, or if even the large buffer
   * is too small to handle this new text, chuck the text and switch to the
   * overflow state.
  if (t->large_outbuf || ((size + strlen(t->output)) > LARGE_BUFSIZE)) {
    t->bufptr = -1;

  /* if the pool has a buffer in it, grab it */
  if (bufpool != NULL) {
    t->large_outbuf = bufpool;
    bufpool = bufpool->next;
  } else {			/* else create a new one */
    CREATE(t->large_outbuf, struct txt_block, 1);
    CREATE(t->large_outbuf->text, char, LARGE_BUFSIZE);

It would seem that the mud is allocating a new buffer to store output
designated to be sent to a player. (and logging this as a buf switch)

Is this a sign that many players are losing link and therefore more
buffers are required to store this info, or is this something I have
caused via a code addition somewhere along the way?

If this is allocating a new buffer to store this info, does it destroy
the buffer and return the memory when it's no longer needed?

Additionaly I'm using a new OS, so I'm worried that there may be something
different about this OS's behavior that may be either causing the problem
or causing a previously coded 'problem' to appear.

Sorry for the newbiesh post, I'm just wanting to nail down the reason
that this happens so that I may cross it off of my 'worry list' .. or
start worrying about it in earnest if it's something I've caused. :-)

Thanks for your time.

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |

This archive was generated by hypermail 2b30 : 12/18/00 PST