]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/lib/java/src/org/apache/thrift/TNonblockingMultiFetchStats.java
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / java / src / org / apache / thrift / TNonblockingMultiFetchStats.java
CommitLineData
f67539c2
TL
1/**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18package org.apache.thrift;
19
20/**
21 * This class keeps track of statistics for TNonblockinMultiFetchClient.
22 */
23public class TNonblockingMultiFetchStats {
24 private int numTotalServers;
25 private int numReadCompletedServers;
26 private int numConnectErrorServers;
27 private int totalRecvBufBytes;
28 private int maxResponseBytes;
29 private int numOverflowedRecvBuf;
30 private int numInvalidFrameSize;
31 // time from the beginning of fetch() function to the reading finish
32 // time of the last socket (in milli-second)
33 private long readTime;
34
35 public TNonblockingMultiFetchStats() {
36 clear();
37 }
38
39 public void clear() {
40 numTotalServers = 0;
41 numReadCompletedServers = 0;
42 numConnectErrorServers = 0;
43 totalRecvBufBytes = 0;
44 maxResponseBytes = 0;
45 numOverflowedRecvBuf = 0;
46 numInvalidFrameSize = 0;
47 readTime = 0;
48 }
49
50 public String toString() {
51 String stats = String.format("numTotalServers=%d, " +
52 "numReadCompletedServers=%d, numConnectErrorServers=%d, " +
53 "numUnresponsiveServers=%d, totalRecvBufBytes=%fM, " +
54 "maxResponseBytes=%d, numOverflowedRecvBuf=%d, " +
55 "numInvalidFrameSize=%d, readTime=%dms",
56 numTotalServers, numReadCompletedServers, numConnectErrorServers,
57 (numTotalServers-numReadCompletedServers-numConnectErrorServers),
58 totalRecvBufBytes/1024.0/1024, maxResponseBytes, numOverflowedRecvBuf,
59 numInvalidFrameSize, readTime);
60 return stats;
61 }
62
63 public void setNumTotalServers(int val) { numTotalServers = val; }
64 public void setMaxResponseBytes(int val) { maxResponseBytes = val; }
65 public void setReadTime(long val) { readTime = val; }
66 public void incNumReadCompletedServers() { numReadCompletedServers++; }
67 public void incNumConnectErrorServers() { numConnectErrorServers++; }
68 public void incNumOverflowedRecvBuf() { numOverflowedRecvBuf++; }
69 public void incTotalRecvBufBytes(int val) { totalRecvBufBytes += val; }
70 public void incNumInvalidFrameSize() { numInvalidFrameSize++; }
71
72 public int getMaxResponseBytes() { return maxResponseBytes; }
73 public int getNumReadCompletedServers() { return numReadCompletedServers; }
74 public int getNumConnectErrorServers() { return numConnectErrorServers; }
75 public int getNumTotalServers() { return numTotalServers; }
76 public int getNumOverflowedRecvBuf() { return numOverflowedRecvBuf;}
77 public int getTotalRecvBufBytes() { return totalRecvBufBytes;}
78 public int getNumInvalidFrameSize() { return numInvalidFrameSize; }
79 public long getReadTime() { return readTime; }
80}