From 05345ddf8b994faf9d12f0eb163fe98b4bcd95e3 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 30 Jun 2021 01:00:00 +0200 Subject: [PATCH] add per-connection request counting --- README.md | 2 -- copyparty/httpcli.py | 4 ++-- copyparty/httpconn.py | 2 ++ tests/util.py | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 25621592..76d5b017 100644 --- a/README.md +++ b/README.md @@ -614,8 +614,6 @@ in the `scripts` folder: 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, ...) * indicate dropped queries in search ui * readme.md as epilogue diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 17d37148..8953059f 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -499,7 +499,7 @@ class HttpCli(object): spd1 = get_spd(nbytes, self.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): self.parser = MultipartParser(self.log, self.sr, self.headers) @@ -1562,7 +1562,7 @@ class HttpCli(object): th_fmt = self.uparam.get("th") if th_fmt is not None: 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) if os.path.exists(fp): vrem = "{}/{}".format(vrem.rstrip("/"), fn) diff --git a/copyparty/httpconn.py b/copyparty/httpconn.py index fbdbd4de..342683bd 100644 --- a/copyparty/httpconn.py +++ b/copyparty/httpconn.py @@ -43,6 +43,7 @@ class HttpConn(object): self.t0 = time.time() self.stopping = False + self.nreq = 0 self.nbyte = 0 self.workload = 0 self.u2idx = None @@ -188,6 +189,7 @@ class HttpConn(object): if self.workload >= 2 ** 31: self.workload = 100 + self.nreq += 1 cli = HttpCli(self) if not cli.run(): return diff --git a/tests/util.py b/tests/util.py index e04c31ce..a1536f64 100644 --- a/tests/util.py +++ b/tests/util.py @@ -121,6 +121,7 @@ class VHttpConn(object): self.log_src = "a" self.lf_url = None self.hsrv = VHttpSrv() + self.nreq = 0 self.nbyte = 0 self.workload = 0 self.ico = None