Codebergdnkl
foot
master
1#pragma once
3#include <stdbool.h>
4#include <stdint.h>
5#include <string.h>
6#include <threads.h>
8#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
9#define min(x, y) ((x) < (y) ? (x) : (y))
10#define max(x, y) ((x) > (y) ? (x) : (y))
12static inline bool
13streq(const char *a, const char *b)
14{
15 return strcmp(a, b) == 0;
16}
18static inline const char *
19thrd_err_as_string(int thrd_err)
20{
21 switch (thrd_err) {
22 case thrd_success: return "success";
23 case thrd_busy: return "busy";
24 case thrd_nomem: return "no memory";
25 case thrd_timedout: return "timedout";
27 case thrd_error:
28 default: return "unknown error";
29 }
31 return "unknown error";
32}
34static inline uint64_t
35sdbm_hash(const char *s)
36{
37 uint64_t hash = 0;
39 for (; *s != '\0'; s++) {
40 int c = *s;
41 hash = c + (hash << 6) + (hash << 16) - hash;
42 }
44 return hash;
45}
47enum {
48 HEX_DIGIT_INVALID = 16
49};
51static inline uint8_t
52hex2nibble(char c)
53{
54 switch (c) {
55 case '0': case '1': case '2': case '3': case '4':
56 case '5': case '6': case '7': case '8': case '9':
57 return c - '0';
59 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
60 return c - 'a' + 10;
62 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
63 return c - 'A' + 10;
64 }
66 return HEX_DIGIT_INVALID;
67}
Diagnostics5 git calls · 1.2 s
CallStatusSizeTime01.2 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 KiB1.2 s
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=1204 git.response.bytes=10322 git.response.cache=EXPIRED git.response.duration_ms=1225 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
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=8830 git.response.cache=HIT git.response.duration_ms=3 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
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=3 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=10Open pack map
fetch200598 B · hit16 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=16 git.response.bytes=598 git.response.cache=HIT git.response.duration_ms=16 git.fetch.wants=3746e269ee6277eae2f73d80d4ded0179958449e 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=598 git.pkt.payload.max=571 git.sideband.band1.bytes=571 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
- a5e29f8eec8d1293
- Request
- 60c239c5…
- 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