7600 zfs rollback should pass target snapshot to kernel
[unleashed.git] / usr / src / cmd / bnu / statlog.c
blob9897587d3c4728f983963ce7ef3614e2310817ba
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1988 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
33 #include "uucp.h"
35 int Retries;
38 Report and log file transfer rate statistics.
39 This is ugly because we are not using floating point.
42 void
43 statlog( direction, bytes, millisecs, breakmsg)
44 char *direction;
45 unsigned long bytes;
46 time_t millisecs;
47 char *breakmsg; /* "PARTIAL FILE" or "" */
49 char text[ 100 ];
50 unsigned long bytes1000;
52 /* bytes1000 = bytes * 1000; */
53 /* on fast machines, times(2) resolution may not be enough */
54 /* so millisecs may be zero. just use 1 as best guess */
55 if ( millisecs == 0 )
56 millisecs = 1;
59 if (bytes < 1<<22)
60 bytes1000 = (bytes*1000/millisecs);
61 else
62 bytes1000 = ((bytes/millisecs)*1000);
64 (void) sprintf(text, "%s %lu / %lu.%.3lu secs, %lu bytes/sec %s",
65 direction, bytes, millisecs/1000, millisecs%1000,
66 bytes1000, breakmsg );
67 if (Retries) {
68 sprintf(text + strlen(text), " %d retries", Retries);
69 Retries = 0;
71 /* bytes1000/millisecs, breakmsg ); */
72 CDEBUG(4, "%s\n", text);
73 usyslog(text);
74 return;
77 static unsigned long filesize; /* size of file been
78 transferred or received */
80 return the size of file been transferred or received
82 unsigned long
83 getfilesize()
85 return(filesize);
89 update the size of file been transferred or received
91 void
92 putfilesize(bytes)
93 unsigned long bytes;
95 filesize = bytes;
96 return;