Branch: Tag:

1996-11-26

1996-11-26 15:35:13 by Per Hedbor <ph@opera.com>

Se ticketdatabasen

Rev: server/base_server/config/low_describers.pike:1.3
Rev: server/base_server/configuration.pike:1.4
Rev: server/base_server/disk_cache.pike:1.7
Rev: server/base_server/hosts.pike:1.2
Rev: server/base_server/read_config.pike:1.3
Rev: server/base_server/roxen.pike:1.8
Rev: server/base_server/roxenlib.pike:1.3
Rev: server/etc/roxen_master.pike:1.6
Rev: server/languages/portuguese.pike:1.1
Rev: server/modules/directories/directories.pike:1.2
Rev: server/modules/filesystems/filesystem.pike:1.2
Rev: server/modules/filesystems/userfs.pike:1.3
Rev: server/modules/filters/htaccess.pike:1.2
Rev: server/modules/logging/home_logger.pike:1.2
Rev: server/modules/misc/userdb.pike:1.2
Rev: server/modules/proxies/proxy.pike:1.4
Rev: server/modules/tags/htmlparse.pike:1.4
Rev: server/protocols/ftp.pike:1.2
Rev: server/protocols/gopher.pike:1.2
Rev: server/protocols/http.pike:1.3
Rev: server/protocols/ssl.pike:1.2

30:   }       - /* For debug and statistics info only */ - int requests; - int received, received_wrapped; - int sent, sent_wrapped; - int hsent, hsent_wrapped; +     - static private program prip=class { + static private program Priority = class + {    array (object) url_modules = ({ });    array (object) logger_modules = ({ });    array (object) location_modules = ({ });
59:    int a;    array (object) tmp;    tmp=allocate(10); -  for(a=0; a<10; a++) tmp[a]=prip(); +  for(a=0; a<10; a++) tmp[a]=Priority();    return tmp;   }      void create(string n) { name=n; }    - float mb; // <blink>Ugly</blink> global variable.. -  - /* Describe a pseudo-64 bit integer as a string. If 'c' is present, it -  is either a factor (3.5, e.g.) that will be used to multiply the -  number of MBytes, igf it is an integer (like '1'), the actual -  number of MBytes will be returned, instead of a string that will -  describe them. This is perhaps just a tad bit too horrible... */ -  - string|float describe_large(int a, int b, int|void|float c) + class Bignum { +  object this = this_object(); +  program This = object_program(this); + #if efun(Mpz) +  inherit Mpz; +  float mb()    { -  mb=(float)(b*(4*1024)); -  -  if(a<0) -  { -  a -= 2<<16; -  mb += (float)(2*1024); +  return (float)this_object()/(1024.0*1024.0);    } -  + #else +  int msb; +  int lsb=-0x7ffffffe;    -  mb += (float)a / (float)(1024*1024); -  if(intp(c)) -  return mb; -  if(floatp(c)) -  mb *= c; -  if(mb < 1024.0) -  return sprintf("%.2f Mb", mb); -  return sprintf("%.2f Gb", mb/1024.0); - } -  -  - float sent_mb() +  object `+(int i)    { -  return describe_large( sent, sent_wrapped, 1 ); +  object res = This(lsb+i,msb,2); +  if(res->lsb < lsb) res->msb++; +  return res;    }    -  - void add_received(int i) +  object `-(int i)    { -  int o; -  o=received; -  received+=i; -  if(received<o) -  received_wrapped++; +  object res = This(lsb-i,msb,2); +  if(res->lsb > lsb) res->msb--; +  return res;    }    - float|string describe_received(int|void|float a) +  float mb()    { -  return describe_large(received, received_wrapped, a); +  return ((((float)lsb/1024.0/1024.0)+2048.0)+(msb*4096.0));    }    - void add_sent(int i) +  void create(int num, int|void bnum, int|void d)    { -  if(i < 0) return; -  int o; -  o=sent; -  sent+=i; -  if(sent<o) -  sent_wrapped++; +  if(!d) +  lsb = num-0x7ffffffe; +  else +  lsb = num; +  msb = bnum;    } -  - float|string describe_sent(int|void a) - { -  return describe_large(sent, sent_wrapped, a); + #endif   }    - void add_hsent(int i) - { -  if(sent < 0) return; -  int o; -  o=hsent; -  hsent+=i; -  if(hsent<o) -  hsent_wrapped++; - } +     - float|string describe_hsent(int|void a) - { -  return describe_large(hsent, hsent_wrapped, a); - } +     - // Min/Average/Max access time, in milliseconds. Not currently used. + /* For debug and statistics info only */ + int requests;    - // int avgs=30; - // int maxs; - // int mins=10000; + object sent=Bignum(); // Sent data + object hsent=Bignum(); // Sent headers + object received=Bignum(); // Received data    - // static private int _ct; // Used to mark the beginning of a request +     - void begin_request() - { +     - } -  - void end_request() - { -  - } -  -  +    // Used to store 'parser' modules before the main parser module   // is added to the configuration.