shithub: bench9

ref: a7f13757d67c3169a938c95d2db667d1bd4ee407
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 p[100];
	uvlong *c;
	int nc, ic;
	char *name;
};

/* private */
void benchstep(B *b);
void tstart(uvlong *c);
extern 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)