Skip to content

Commit c7ba9c9

Browse files
committed
TurboBench: Benchmark App
1 parent 1b75e7f commit c7ba9c9

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

turbobench.c

+15-8
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ void plugprtth(FILE *f, int fmt) {
530530

531531
switch(fmt) {
532532
case FMT_TEXT:
533-
fprintf(f," C Size ratio%% C MB/s D MB/s Name File\n");
533+
fprintf(f," C Size ratio%% C MB/s D MB/s SCORE Name File\n");
534534
break;
535535
case FMT_VBULLETIN:
536536
fprintf(f,"[table]C Size|ratio%|C MB/s|D MB/s|Name|File (MB=1.000.0000)\n");
@@ -581,11 +581,12 @@ void plugprttf(FILE *f, int fmt) {
581581

582582
#define RATIO(_clen_, _len_) ((double)_clen_*100.0/_len_)
583583
#define FACTOR(_clen_, _len_) ((double)_len_/(double)_clen_)
584+
#define SCORE(_clen_, _len_,_tc_,_td_) (_tc_ + 2.0 * _td_ + (double)_clen_/1000000.0)
584585

585586
void plugprt(struct plug *plug, long long totinlen, char *finame, int fmt, double *ptc, double *ptd, FILE *f) {
586587
double ratio = RATIO(plug->len,totinlen),
587588
//ratio = FACTOR(plug->len,totinlen),
588-
tc = TMBS(totinlen,plug->tc), td = TMBS(totinlen,plug->td);
589+
tc = TMBS(totinlen,plug->tc), td = TMBS(totinlen,plug->td), score = SCORE(plug->len,totinlen,plug->tc,plug->td);
589590
char name[256];
590591
if(plug->lev != INVLEV)
591592
sprintf(name, "%s%s %d%s", plug->err?"?":"", plug->s, plug->lev, plug->prm);
@@ -601,25 +602,31 @@ void plugprt(struct plug *plug, long long totinlen, char *finame, int fmt, doubl
601602
#ifdef _WIN32
602603
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
603604
fprintf(f, "%12"PRId64" %5.1f ", plug->len, ratio);
604-
#define BBOLD 15
605+
#define BBOLD 2 //2=green, 15=white
605606
if(c) SetConsoleTextAttribute(h, BBOLD);
606607
fprintf(f, "%8.2f ", tc);
607608
if(c) SetConsoleTextAttribute(h, 7);
609+
608610
if(d) SetConsoleTextAttribute(h, BBOLD);
609611
fprintf(f, "%8.2f ", td);
610612
if(d) SetConsoleTextAttribute(h, 7);
613+
611614
if(n) SetConsoleTextAttribute(h, BBOLD);
612-
fprintf(f, "%-16s", name);
615+
fprintf(f, "%8.2f ", score);
613616
if(n) SetConsoleTextAttribute(h, 7);
617+
618+
if(n) SetConsoleTextAttribute(h, BBOLD);
619+
fprintf(f, "%-16s", name);
620+
if(n) SetConsoleTextAttribute(h, 7);
614621
fprintf(f, "%s\n", finame);
615622
#undef BBOLD
616623
#else
617-
fprintf(f, "%12"PRId64" %5.1f %s%8.2f%s %s%8.2f%s %s%-16s%s%s\n",
618-
plug->len, ratio, c?BOLDB:"", tc, c?BOLDE:"", d?BOLDB:"", td, d?BOLDE:"", n?BOLDB:"", name, n?BOLDE:"", finame);
624+
fprintf(f, "%12"PRId64" %5.1f %s%8.2f%s %s%8.2f%s %s%8.2f%s %s%-16s%s%s\n",
625+
plug->len, ratio, c?BOLDB:"", tc, c?BOLDE:"", d?BOLDB:"", td, d?BOLDE:"", n?BOLDB:"", score, n?BOLDE:"", n?BOLDB:"", name, n?BOLDE:"", finame);
619626
#endif
620627
}
621628
else
622-
fprintf(f,"%12"PRId64" %5.1f %8.2f %8.2f %-32s %s\n", plug->len, ratio, tc, td, name, finame);
629+
fprintf(f,"%12"PRId64" %5.1f %8.2f %8.2f %8.2f %-32s %s\n", plug->len, ratio, tc, td, score, name, finame);
623630
break;
624631
case FMT_VBULLETIN:
625632
fprintf(f, "%12"PRId64"|%5.1f|%s%8.2f%s|%s%8.2f%s|%s%-16s%s|%s\n",
@@ -1185,7 +1192,7 @@ unsigned long long plugfile(struct plug *plug, char *finame, unsigned long long
11851192

11861193
unsigned char *_cpy = _in, *out = (unsigned char*)_valloc(outsize,2); if(!out) die("malloc error out size=%u\n", outsize);
11871194

1188-
if((cmp || tid) && insizem && !(_cpy = _valloc(insizem,3)))
1195+
if((cmp || tid) && insizem && !(_cpy = _valloc(insizem*3,3)))
11891196
die("malloc error cpy size=%u\n", insizem);
11901197

11911198
codini(insize, plug->id, plug->lev, plug->prm);

0 commit comments

Comments
 (0)