ref: eef0fe67ee4bb8c254f0f9e61c24ef5d34d05a4f
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("Namelen %llud Ndblock %d Niblock %d\n", Namelen, Ndblock, Niblock); print("Blocksize %llud Nindperblock %llud\n", Blocksize, Nindperblock); 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*Blocksize); 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*Blocksize = %llud bytes", maxblocks(t), maxblocks(t)*Blocksize); if(maxblocks(t)*Blocksize/(TiB) > 0) print(" = %llud TiB\n",maxblocks(t)*Blocksize/(TiB)); else if(maxblocks(t)*Blocksize/(GiB) > 0) print(" = %llud GiB\n",maxblocks(t)*Blocksize/(GiB)); else if(maxblocks(t)*Blocksize/(MiB) > 0) print(" = %llud MiB\n",maxblocks(t)*Blocksize/(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; } */