You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/11/21 20:30:29 UTC

[httpcomponents-core] 01/03: Improved data frame output by the benchmark with HTTP/2

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 78d56d8e91333fe2c3d25bd4d515539d44af1ed6
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Nov 21 21:11:17 2020 +0100

    Improved data frame output by the benchmark with HTTP/2
---
 .../apache/hc/core5/benchmark/HttpBenchmark.java   | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java
index f5b6e18..c3141b8 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java
@@ -63,6 +63,7 @@ import org.apache.hc.core5.http.protocol.RequestUserAgent;
 import org.apache.hc.core5.http2.HttpVersionPolicy;
 import org.apache.hc.core5.http2.config.H2Config;
 import org.apache.hc.core5.http2.frame.FramePrinter;
+import org.apache.hc.core5.http2.frame.FrameType;
 import org.apache.hc.core5.http2.frame.RawFrame;
 import org.apache.hc.core5.http2.impl.nio.H2StreamListener;
 import org.apache.hc.core5.http2.impl.nio.bootstrap.H2RequesterBootstrap;
@@ -372,7 +373,7 @@ public class HttpBenchmark {
                             final List<? extends Header> headers) {
                         if (config.getVerbosity() >= 3) {
                             for (final Header header : headers) {
-                                System.out.println(">> " + header);
+                                System.out.println("<< " + header);
                             }
                             System.out.println();
                         }
@@ -385,7 +386,7 @@ public class HttpBenchmark {
                             final List<? extends Header> headers) {
                         if (config.getVerbosity() >= 3) {
                             for (final Header header : headers) {
-                                System.out.println("<< " + header);
+                                System.out.println(">> " + header);
                             }
                             System.out.println();
                         }
@@ -397,12 +398,16 @@ public class HttpBenchmark {
                             final int streamId,
                             final RawFrame frame) {
                         if (config.getVerbosity() >= 4) {
-                            System.out.print(">> ");
+                            System.out.print("<< ");
                             try {
                                 framePrinter.printFrameInfo(frame, System.out);
+                                System.out.println();
+                                if (!frame.isType(FrameType.DATA)) {
+                                    framePrinter.printPayload(frame, System.out);
+                                    System.out.println();
+                                }
                             } catch (final IOException ignore) {
                             }
-                            System.out.println();
                         }
                     }
 
@@ -412,12 +417,16 @@ public class HttpBenchmark {
                             final int streamId,
                             final RawFrame frame) {
                         if (config.getVerbosity() >= 4) {
-                            System.out.print("<< ");
+                            System.out.print(">> ");
                             try {
                                 framePrinter.printFrameInfo(frame, System.out);
+                                System.out.println();
+                                if (!frame.isType(FrameType.DATA)) {
+                                    framePrinter.printPayload(frame, System.out);
+                                    System.out.println();
+                                }
                             } catch (final IOException ignore) {
                             }
-                            System.out.println();
                         }
                     }
 
@@ -428,7 +437,7 @@ public class HttpBenchmark {
                             final int delta,
                             final int actualSize) {
                         if (config.getVerbosity() >= 5) {
-                            System.out.println(">> stream " + streamId + ": " + actualSize + " " + delta);
+                            System.out.println("<< stream " + streamId + ": " + actualSize + " " + delta);
                         }
                     }
 
@@ -439,7 +448,7 @@ public class HttpBenchmark {
                             final int delta,
                             final int actualSize) {
                         if (config.getVerbosity() >= 5) {
-                            System.out.println("<< stream " + streamId + ": " + actualSize + " " + delta);
+                            System.out.println(">> stream " + streamId + ": " + actualSize + " " + delta);
                         }
                     }