shithub: bench9

ref: cce6dfb94a75af67751e2fab0d961a004e9e51d5
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);
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)