View Javadoc
1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  package org.apache.hc.core5.benchmark;
28  
29  import org.apache.hc.core5.http.ProtocolVersion;
30  
31  /**
32   * Benchmark results
33   *
34   * @since 4.3
35   */
36  public final class Results {
37  
38      private final String serverName;
39      private final ProtocolVersion protocolVersion;
40      private final String hostName;
41      private final int hostPort;
42      private final String documentPath;
43      private final long contentLength;
44      private final int concurrencyLevel;
45      private final long totalTimeMillis;
46      private final long successCount;
47      private final long failureCount;
48      private final long keepAliveCount;
49      private final long totalBytesRcvd;
50      private final long totalBytesSent;
51      private final long totalContentBytesRecvd;
52  
53      public Results(
54              final String serverName,
55              final ProtocolVersion protocolVersion,
56              final String hostName,
57              final int hostPort,
58              final String documentPath,
59              final long contentLength,
60              final int concurrencyLevel,
61              final long totalTimeMillis,
62              final long successCount,
63              final long failureCount,
64              final long keepAliveCount,
65              final long totalBytesRcvd,
66              final long totalBytesSent,
67              final long totalContentBytesRecvd) {
68          this.serverName = serverName;
69          this.protocolVersion = protocolVersion;
70          this.hostName = hostName;
71          this.hostPort = hostPort;
72          this.documentPath = documentPath;
73          this.contentLength = contentLength;
74          this.concurrencyLevel = concurrencyLevel;
75          this.totalTimeMillis = totalTimeMillis;
76          this.successCount = successCount;
77          this.failureCount = failureCount;
78          this.keepAliveCount = keepAliveCount;
79          this.totalBytesRcvd = totalBytesRcvd;
80          this.totalBytesSent = totalBytesSent;
81          this.totalContentBytesRecvd = totalContentBytesRecvd;
82      }
83  
84      public String getServerName() {
85          return serverName;
86      }
87  
88      public ProtocolVersion getProtocolVersion() {
89          return protocolVersion;
90      }
91  
92      public String getHostName() {
93          return hostName;
94      }
95  
96      public int getHostPort() {
97          return hostPort;
98      }
99  
100     public String getDocumentPath() {
101         return documentPath;
102     }
103 
104     public long getContentLength() {
105         return contentLength;
106     }
107 
108     public int getConcurrencyLevel() {
109         return concurrencyLevel;
110     }
111 
112     public long getTotalTimeMillis() {
113         return totalTimeMillis;
114     }
115 
116     public long getSuccessCount() {
117         return successCount;
118     }
119 
120     public long getFailureCount() {
121         return failureCount;
122     }
123 
124     public long getKeepAliveCount() {
125         return keepAliveCount;
126     }
127 
128     public long getTotalBytesRcvd() {
129         return totalBytesRcvd;
130     }
131 
132     public long getTotalBytesSent() {
133         return totalBytesSent;
134     }
135 
136     public long getTotalContentBytesRecvd() {
137         return totalContentBytesRecvd;
138     }
139 
140     @Override
141     public String toString() {
142         final StringBuilder builder = new StringBuilder();
143         builder.append("[serverName=").append(serverName)
144                 .append(", hostName=").append(hostName)
145                 .append(", hostPort=").append(hostPort)
146                 .append(", documentPath=").append(documentPath)
147                 .append(", contentLength=").append(contentLength)
148                 .append(", concurrencyLevel=").append(concurrencyLevel)
149                 .append(", totalTimeMillis=").append(totalTimeMillis)
150                 .append(", successCount=").append(successCount)
151                 .append(", failureCount=").append(failureCount)
152                 .append(", keepAliveCount=").append(keepAliveCount)
153                 .append(", totalBytesRcvd=").append(totalBytesRcvd)
154                 .append(", totalBytesSent=").append(totalBytesSent)
155                 .append(", totalContentBytesRecvd=").append(totalContentBytesRecvd)
156                 .append("]");
157         return builder.toString();
158     }
159 
160 }