aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vac/wtest.c
blob: 35dc8233bc46cb8dfdadcfee68e8fde91e20ff3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "stdinc.h"

enum {
	Nblock = 10000,
	BlockSize = 8*1024
};

uchar data[Nblock*BlockSize];

void
main(int argc, char *argv[])
{
	VtSession *z;
	int i;
	uchar score[VtScoreSize];
	int start;

	ARGBEGIN{
	}ARGEND

	for(i=0; i<Nblock; i++) {
		if(readn(0, data+i*BlockSize, BlockSize) < BlockSize)
			sysfatal("read failed: %r");
	}

	vtAttach();

	z = vtDial("iolaire2");
	if(z == nil)
		sysfatal("cound not connect to venti");
	if(!vtConnect(z, 0))
		vtFatal("vtConnect: %s", vtGetError());

	print("starting\n");

	start = times(0);

	for(i=0; i<Nblock; i++) {
		if(!vtWrite(z, score, VtDataType, data+i*BlockSize, BlockSize))
			vtFatal("vtWrite failed: %s", vtGetError());
	}

	print("time = %f\n", (times(0) - start)*0.001);

	vtClose(z);
	vtDetach();
}