6 * Copyright (C) 2002 RealVNC Ltd.
7 * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
9 * This is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this software; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
29 static char* encNames[] = {
30 "raw", "copyRect", "RRE", "[encoding 3]", "CoRRE", "hextile",
31 "[encoding 6]", "[encoding 7]", "[encoding 8]", "[encoding 9]",
32 "[encoding 10]", "[encoding 11]", "[encoding 12]", "[encoding 13]",
33 "[encoding 14]", "[encoding 15]", "ZRLE", "[encoding 17]",
34 "[encoding 18]", "[encoding 19]", "[encoding 20]"
39 rfbResetStats(rfbClientPtr cl)
42 for (i = 0; i < MAX_ENCODINGS; i++) {
43 cl->rfbBytesSent[i] = 0;
44 cl->rfbRectanglesSent[i] = 0;
46 cl->rfbFramebufferUpdateMessagesSent = 0;
47 cl->rfbRawBytesEquivalent = 0;
48 cl->rfbKeyEventsRcvd = 0;
49 cl->rfbPointerEventsRcvd = 0;
53 rfbPrintStats(rfbClientPtr cl)
56 int totalRectanglesSent = 0;
57 int totalBytesSent = 0;
59 rfbLog("Statistics:\n");
61 if ((cl->rfbKeyEventsRcvd != 0) || (cl->rfbPointerEventsRcvd != 0))
62 rfbLog(" key events received %d, pointer events %d\n",
63 cl->rfbKeyEventsRcvd, cl->rfbPointerEventsRcvd);
65 for (i = 0; i < MAX_ENCODINGS; i++) {
66 totalRectanglesSent += cl->rfbRectanglesSent[i];
67 totalBytesSent += cl->rfbBytesSent[i];
70 rfbLog(" framebuffer updates %d, rectangles %d, bytes %d\n",
71 cl->rfbFramebufferUpdateMessagesSent, totalRectanglesSent,
74 for (i = 0; i < MAX_ENCODINGS; i++) {
75 if (cl->rfbRectanglesSent[i] != 0)
76 rfbLog(" %s rectangles %d, bytes %d\n",
77 encNames[i], cl->rfbRectanglesSent[i], cl->rfbBytesSent[i]);
80 if ((totalBytesSent - cl->rfbBytesSent[rfbEncodingCopyRect]) != 0) {
81 rfbLog(" raw bytes equivalent %d, compression ratio %f\n",
82 cl->rfbRawBytesEquivalent,
83 (double)cl->rfbRawBytesEquivalent
84 / (double)(totalBytesSent
85 - cl->rfbBytesSent[rfbEncodingCopyRect]));