Skip to content

Commit

Permalink
[dynpick driver test-com] More throughput measurements.
Browse files Browse the repository at this point in the history
  • Loading branch information
130s committed Apr 6, 2016
1 parent 841b197 commit aff4ee2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test-com.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int main() {
num = 0;

// Data Requests
struct timeval wr0, wr1, tcd0, tcd1;
struct timeval wr0, wr1, tcd0, tcd1, loop0, loop1, fscan0, fscan1;
gettimeofday(&wr0, NULL);
n = write(fd, "R", 1);
gettimeofday(&wr1, NULL);
Expand Down Expand Up @@ -166,6 +166,7 @@ int main() {
len = 0;
bzero(str, 27); // Setting the first 27 bytes of the area starting `str` to zero.
while (len < DATA_LENGTH) {
gettimeofday(&loop0, NULL);
n = read(fd, str + len, DATA_LENGTH - len);
printf("read data (ret %d, %d bytes read))\n", n, len + n);
if (n > 0) {
Expand All @@ -177,6 +178,8 @@ int main() {
usleep(10000);
//goto loop_exit;
}
gettimeofday(&loop1, NULL);
printf("(Loop took %7.3f [msec]\n", DELTA_SEC(loop0, loop1) * 1000);
}
//goto skip;
loop_exit: {
Expand All @@ -186,11 +189,14 @@ int main() {
}
}

gettimeofday(&fscan0, NULL);
sscanf(str, "%1d%4hx%4hx%4hx%4hx%4hx%4hx", &tick, &data[0], &data[1],
&data[2], &data[3], &data[4], &data[5]);

sprintf(str, "%05d,%d,%05d,%05d,%05d,%05d,%05d,%05d\n", clk / tw * tw,
tick, data[0], data[1], data[2], data[3], data[4], data[5]);
gettimeofday(&fscan1, NULL);
printf("sscanf, sprintf took %7.3f [msec]\n", DELTA_SEC(fscan0, fscan1) * 1000);

fprintf(stderr, str);
//fprintf(fd, str);
Expand Down

0 comments on commit aff4ee2

Please sign in to comment.