1) Moved tprintf and related functions to their own file in common/libc/printf/tprintf.c.

This file is included by both libc and hostcompat.

2) Changed printf -> tprintf in all testbin programs
This commit is contained in:
Scott Haseley
2016-01-15 13:33:11 -05:00
parent 98ff530afb
commit 0ab862abfa
49 changed files with 501 additions and 478 deletions

View File

@@ -229,7 +229,7 @@ runit(unsigned numthinkers, unsigned numgrinders,
char buf[32];
unsigned i;
printf("Running with %u thinkers, %u grinders, and %u pong groups "
tprintf("Running with %u thinkers, %u grinders, and %u pong groups "
"of size %u each.\n", numthinkers, numgrinders, numponggroups,
ponggroupsize);
@@ -242,7 +242,7 @@ runit(unsigned numthinkers, unsigned numgrinders,
&pids[i+2]);
}
usem_open(&startsem);
printf("Forking done; starting the workload.\n");
tprintf("Forking done; starting the workload.\n");
__time(&startsecs, &startnsecs);
Vn(&startsem, numthinkers + numgrinders +
numponggroups * ponggroupsize);
@@ -252,20 +252,20 @@ runit(unsigned numthinkers, unsigned numgrinders,
openresultsfile(O_RDONLY);
printf("--- Timings ---\n");
tprintf("--- Timings ---\n");
if (numthinkers > 0) {
calcresult(0, startsecs, startnsecs, buf, sizeof(buf));
printf("Thinkers: %s\n", buf);
tprintf("Thinkers: %s\n", buf);
}
if (numgrinders > 0) {
calcresult(1, startsecs, startnsecs, buf, sizeof(buf));
printf("Grinders: %s\n", buf);
tprintf("Grinders: %s\n", buf);
}
for (i=0; i<numponggroups; i++) {
calcresult(i+2, startsecs, startnsecs, buf, sizeof(buf));
printf("Pong group %u: %s\n", i, buf);
tprintf("Pong group %u: %s\n", i, buf);
}
closeresultsfile();

View File

@@ -100,7 +100,7 @@ pong_cyclic(unsigned id)
P(&sems[id]);
}
#ifdef VERBOSE_PONG
printf(" %u", id);
tprintf(" %u", id);
#else
if (nextid == 0 && i % 16 == 0) {
putchar('.');
@@ -151,7 +151,7 @@ pong_reciprocating(unsigned id)
P(&sems[id]);
}
#ifdef VERBOSE_PONG
printf(" %u", id);
tprintf(" %u", id);
#else
if (id == 0 && i % 16 == 0) {
putchar('.');
@@ -197,11 +197,11 @@ pong(unsigned groupid, unsigned id)
waitstart();
pong_cyclic(id);
#ifdef VERBOSE_PONG
printf("--------------------------------\n");
tprintf("--------------------------------\n");
#endif
pong_reciprocating(id);
#ifdef VERBOSE_PONG
printf("--------------------------------\n");
tprintf("--------------------------------\n");
#endif
pong_cyclic(id);