add per-connection request counting

This commit is contained in:
ed 2021-06-30 01:00:00 +02:00
parent 66adb470ad
commit 05345ddf8b
4 changed files with 5 additions and 4 deletions

View file

@ -614,8 +614,6 @@ in the `scripts` folder:
roughly sorted by priority roughly sorted by priority
* option to set rgba 126,163,75,0.6 bg on barbuf
* include num req in _spd
* ctrl-click overrides onclick (tree, ...) * ctrl-click overrides onclick (tree, ...)
* indicate dropped queries in search ui * indicate dropped queries in search ui
* readme.md as epilogue * readme.md as epilogue

View file

@ -499,7 +499,7 @@ class HttpCli(object):
spd1 = get_spd(nbytes, self.t0) spd1 = get_spd(nbytes, self.t0)
spd2 = get_spd(self.conn.nbyte, self.conn.t0) spd2 = get_spd(self.conn.nbyte, self.conn.t0)
return spd1 + " " + spd2 return "{} {} n{}".format(spd1, spd2, self.conn.nreq)
def handle_post_multipart(self): def handle_post_multipart(self):
self.parser = MultipartParser(self.log, self.sr, self.headers) self.parser = MultipartParser(self.log, self.sr, self.headers)
@ -1562,7 +1562,7 @@ class HttpCli(object):
th_fmt = self.uparam.get("th") th_fmt = self.uparam.get("th")
if th_fmt is not None: if th_fmt is not None:
if is_dir: if is_dir:
for fn in self.args.th_covers.split(','): for fn in self.args.th_covers.split(","):
fp = os.path.join(abspath, fn) fp = os.path.join(abspath, fn)
if os.path.exists(fp): if os.path.exists(fp):
vrem = "{}/{}".format(vrem.rstrip("/"), fn) vrem = "{}/{}".format(vrem.rstrip("/"), fn)

View file

@ -43,6 +43,7 @@ class HttpConn(object):
self.t0 = time.time() self.t0 = time.time()
self.stopping = False self.stopping = False
self.nreq = 0
self.nbyte = 0 self.nbyte = 0
self.workload = 0 self.workload = 0
self.u2idx = None self.u2idx = None
@ -188,6 +189,7 @@ class HttpConn(object):
if self.workload >= 2 ** 31: if self.workload >= 2 ** 31:
self.workload = 100 self.workload = 100
self.nreq += 1
cli = HttpCli(self) cli = HttpCli(self)
if not cli.run(): if not cli.run():
return return

View file

@ -121,6 +121,7 @@ class VHttpConn(object):
self.log_src = "a" self.log_src = "a"
self.lf_url = None self.lf_url = None
self.hsrv = VHttpSrv() self.hsrv = VHttpSrv()
self.nreq = 0
self.nbyte = 0 self.nbyte = 0
self.workload = 0 self.workload = 0
self.ico = None self.ico = None