ref: b3e875d7db45fca0cde9f4efa12872f61afc54d7
dir: /tests/sizes.c/
#include <u.h> #include <libc.h> #include "../dat.h" #include "../fns.h" void main(int, void**) { int t; u64 n; print("Blocksize %llud Maxdatablockunits %d\n", Blocksize, Maxdatablockunits); print("Dentry size %d\n", sizeof(Dentry)); print(" Dentryhdr size %d Ddatasize %llud trailing path %d\n", sizeof(Dentryhdr), Ddatasize, sizeof(u64)); print("Datahdr size %d trailing path %d Ddataidssize %d Maxdatablocksize %llud\n", sizeof(Datahdr), sizeof(u64), Ddataidssize, Maxdatablocksize); print("Ndblock %d Niblock %d\n", Ndblock, Niblock); print("Nindperblock %llud Maxdatablocksize %llud\n", Nindperblock, Maxdatablocksize); for (t = Tind0; t < Maxtind; t++) { n = nperindunit(t); print("A %s unit points to %lld data blocks (%llud bytes)\n", tagnames[t], n, n*Maxdatablocksize); print(" block points to %llud data blocks\n", nperiblock(t)); print(" reli start %llud max %llud\n", tagstartreli(t), maxreli(t)); print(" max size %llud*Maxdatablocksize = %llud bytes", maxblocks(t), maxblocks(t)*Maxdatablocksize); if(maxblocks(t)*Maxdatablocksize/(TiB) > 0) print(" = %llud TiB\n",maxblocks(t)*Maxdatablocksize/(TiB)); else if(maxblocks(t)*Maxdatablocksize/(GiB) > 0) print(" = %llud GiB\n",maxblocks(t)*Maxdatablocksize/(GiB)); else if(maxblocks(t)*Maxdatablocksize/(MiB) > 0) print(" = %llud MiB\n",maxblocks(t)*Maxdatablocksize/(MiB)); else print("\n"); } exits(nil); } /* static uvlong maxsize1(void) { int i; uvlong max = Ndblock, ind = 1; for (i = 0; i < Niblock; i++) { ind = muluvlongov(ind, Nindperblock); \/* power of Nindperblock *\/ if (ind == 0) return 0; max = adduvlongov(max, ind); print("maxsize %d %llud max %llud\n", i, ind, max); if (max == 0) return 0; } return muluvlongov(max, Blocksize); } static uvlong maxsize(void) { int i; uvlong max = Ndblock, ind; print("maxsize direct blocks max %llud\n", max); for (i = 0; i < Niblock; i++) { ind = nperiblock(Tind0+i); max += ind; print("maxsize %s %llud max %llud\n", tagnames[Tind0+i], ind, max); } return max; } */