shithub: bench9

ref: 02f047daee598f22e641365d01934973b14f89f3
dir: /b.h/

View raw version
typedef struct B B;
typedef struct Cns Cns;

struct Cns {
	uvlong c;
	uvlong ns;
};

#pragma varargck type "σ" B*
#pragma varargck type "τ" Cns

struct B {
	uvlong n;
	uvlong tin;
	uvlong tout;
	uvlong step;
	uvlong t0;
	Cns tot, avg, med, min, max;
	Cns p96, p98, p99;
	u32int *c;
	int nc, ic;
	char *name;
};

/* private */
void benchstep(B *b);
void _tstart(uvlong *c);
void _tend(uvlong *c);

/* public */
void benchinit(B *b, char *name);
void benchprint(B *b, int nb, int fd);
#define benchin(b) do{ _tstart(&(b)->tin); }while(0)
#define benchout(b) do{ _tend(&(b)->tout); benchstep(b); }while(0)