ref: 56bd332994102b4e194819abb5e087a8895452f9
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 Metadataunits %d Maxdatablockunits %d\n", Blocksize, Metadataunits, Maxdatablockunits); print("Dentryhdr size %d Ddatasize %llud\n", sizeof(Dentryhdr), Ddatasize); print("Dentry size %d Namelen %d\n", sizeof(Dentry), Namelen); print("Namelen %d Ndblock %d Niblock %d\n", Namelen, 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; } */