Codebergdnkl

foot

master
ply5 git calls1.6 s29 KiB2 cachedprotocol v2
50 lines1.3 KiBexecutableRaw
1#!/usr/bin/env -S python3 -u
3import argparse
4import fcntl
5import os
6import statistics
7import struct
8import sys
9import termios
10from datetime import UTC, datetime
13def main() -> None:
14 parser = argparse.ArgumentParser()
15 parser.add_argument('files', type=argparse.FileType('rb'), nargs='+')
16 parser.add_argument('--iterations', type=int, default=20)
18 args = parser.parse_args()
20 lines, cols, height, width = struct.unpack(
21 'HHHH',
22 fcntl.ioctl(sys.stdout.fileno(),
23 termios.TIOCGWINSZ,
24 struct.pack('HHHH', 0, 0, 0, 0)))
26 times: dict[str, list[float]] = {name: [] for name in [f.name for f in args.files]}
28 for f in args.files:
29 bench_bytes = f.read()
31 for _ in range(args.iterations):
32 start = datetime.now(tz=UTC)
33 sys.stdout.buffer.write(bench_bytes)
34 stop = datetime.now(tz=UTC)
36 times[f.name].append((stop - start).total_seconds())
38 del bench_bytes
40 print('\033[J')
41 print(times)
42 print(f'cols={cols}, lines={lines}, width={width}px, height={height}px')
43 for f in args.files:
44 print(f'{os.path.basename(f.name)}: '
45 f'{statistics.mean(times[f.name]):.3f}s '
46 f'±{statistics.stdev(times[f.name]):.3f}')
49if __name__ == '__main__':
50 main()
Diagnostics5 git calls · 1.6 s
CallStatusSizeTime01.6 s
discover200178 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=178
git.server.agent=git/2.56.1-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=178
git.pkt.payload.max=35
ls-refs20010 KiB677 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=652
git.response.bytes=10322
git.response.cache=EXPIRED
git.response.duration_ms=677
git.protocol.version=2
git.pkt.frames=108
git.pkt.data=107
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=10322
git.pkt.payload.max=106
git.ls_refs.count=107
git.ls_refs.head=refs/heads/master
fetchtree:0 · deepen 102009.3 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=9489
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=9489
git.pkt.payload.max=9389
git.sideband.band1.bytes=9389
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=10
git.pack.bytes=9389
git.pack.ofs_delta=0
git.pack.ref_delta=0
git.pack.chain.max=0
git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a
git.pack.full=10
Open pack map
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=8830
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=8830
git.pkt.payload.max=8730
git.sideband.band1.bytes=8730
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=14
git.pack.bytes=8730
git.fetch.wide.objects=14
git.fetch.wide.extra_bytes=9909
git.fetch.wide.blobs=0
fetch200680 B883 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=883
git.response.bytes=680
git.response.cache=MISS
git.response.duration_ms=883
git.fetch.wants=8f161fbefcee43f13cc4b4764cdbb58f977c1ae0
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=680
git.pkt.payload.max=653
git.sideband.band1.bytes=653
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://codeberg.org/dnkl/foot
Ref
refs/heads/master
Commit
c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
cf-ray
a5e1dc2199ddecfa
Request
181784f1…
Protocol
v2 · sha1
Agent
git/2.56.1-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format