struct timeval t1, t2;
char s1[64], s2[64], ts[64];
char *infile = NULL;
+ int Cflag;
int c, fd = -1;
+ Cflag = 0;
init_cvtnum(&blocksize, §size);
- while ((c = getopt(argc, argv, "f:i:")) != EOF) {
+ while ((c = getopt(argc, argv, "Cf:i:")) != EOF) {
switch (c) {
+ case 'C':
+ Cflag = 1;
case 'f':
fd = atoi(argv[1]);
if (fd < 0 || fd >= filecount) {
gettimeofday(&t2, NULL);
t2 = tsub(t2, t1);
- printf(_("sent %lld/%lld bytes from offset %lld\n"),
- total, count, (long long)offset);
- cvtstr((double)total, s1, sizeof(s1));
- cvtstr(tdiv((double)total, t2), s2, sizeof(s2));
- timestr(&t2, ts, sizeof(ts));
- printf(_("%s, %d ops; %s (%s/sec and %.4f ops/sec)\n"),
- s1, c, ts, s2, tdiv((double)c, t2));
+ /* Finally, report back -- -C gives a parsable format */
+ timestr(&t2, ts, sizeof(ts), Cflag ? VERBOSE_FIXED_TIME : 0);
+ if (!Cflag) {
+ cvtstr((double)total, s1, sizeof(s1));
+ cvtstr(tdiv((double)total, t2), s2, sizeof(s2));
+ printf(_("sent %lld/%lld bytes from offset %lld\n"),
+ total, count, (long long)offset);
+ printf(_("%s, %d ops; %s (%s/sec and %.4f ops/sec)\n"),
+ s1, c, ts, s2, tdiv((double)c, t2));
+ } else {/* bytes,ops,time,bytes/sec,ops/sec */
+ printf("%lld,%d,%s,%.3f,%.3f\n",
+ total, c, ts,
+ tdiv((double)total, t2), tdiv((double)c, t2));
+ }
done:
if (infile)
close(fd);
sendfile_cmd.altname = _("send");
sendfile_cmd.cfunc = sendfile_f;
sendfile_cmd.argmin = 2;
- sendfile_cmd.argmax = 4;
+ sendfile_cmd.argmax = -1;
sendfile_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
sendfile_cmd.args =
_("-i infile | -f N [off len]");